| ALU: k-bit | |||||||||||||
| What about conditional branch? | |||||||||||||
| Branch if 2 values are either equal or not equal | |||||||||||||
| Easiest way to test if a == b: subtract, test result: | |||||||||||||
| OR all result bits together and complement | |||||||||||||
| One more refinement: combine Binvert and CarryIn control values into Bnegate: | |||||||||||||
| subtract: both are 1 | |||||||||||||
| add or logical ops: both are 0 | |||||||||||||
| Bnegate (1 bit) and Operation (2 bits) are 3-bit control for MUX: | |||||||||||||
| control | function | ||||||||||||
| 000 | AND | ||||||||||||
| 001 | OR | ||||||||||||
| 010 | ADD | ||||||||||||
| 110 | SUB | ||||||||||||
| 111 | SLT | ||||||||||||