04-30-2014, 07:36 PM
(04-30-2014, 06:42 PM)Nickster258 Wrote:(04-30-2014, 06:29 PM)Cutlassw30 Wrote:(04-30-2014, 06:08 PM)Nickster258 Wrote:(04-30-2014, 05:34 PM)Cutlassw30 Wrote:(04-30-2014, 04:48 PM)Nickster258 Wrote: Thanks! I spent a long time just thinking about it and slowly making adjustments. I want my next CPU to be well planned out and have great functionality with good speed.
Is the fact that it will take 2 cycles to branch all that bad? I notice many use that and I can add 13 more branch functions if I wanted to, but it may not be worth it. (Plus others can add their own branch functions and have it somewhat customizable.)
Do you mean in terms of a branch delay slot? for example:
BEQ, R1, R5, 0x5
NOP
Or a compare before a branch:
CMP, R1, R5
BEQ, 0x5
MIPS uses the first way while x86 and ARM use the second. While they are not recommended if you can avoid them but if it allows you to add 13 more branches then go for it. Kind of a necessary evil
Either one actually. I am debating on making both of those plausible since I have so much room in the branch function.
I perfer the second one to keep assembly closer the x86/z80 and ARM. Its more well known and easier to program. The first option is used to speed up pipelines.
That would probably be best. If I was to add branch functions, what should I add? BET, BGT, and BLT, is not many.
I do not like BGT/BLT for one. For signed numbers you need a 2's complement comparator then for unsigned you're screwed. This is my current list of branches for my ISA:
Branch if equal to zero (BEQZ)
Branch if not equal to zero (BNEQZ)
Branch if greater than zero (BGTZ)
Branch if less than zero (BLTZ)
Branch if greater than or equal to zero (BGETZ)
Branch if less then or equal to zero (BLETZ)
Branch if odd parity (BOP) (used for checking data corruption)
Branch if even parity (BEP) (same as above but even parity)
Parity checking is checking the amount of one bits that are on. For example the number 101 is a even parity number because there is a even amount of 1s compared to 0s. This is really useful for checking for data corruption because one sends a extra "parity check bit" with data to compare it. In a odd parity checking system there is always a odd number of data bits on or there is a corruption. More of that here: http://en.wikipedia.org/wiki/Parity_bit
This is why ASCII was made to be 7 bits as the last bit could be used as a parity check bit.