4 bits Arithmetic Logic Unit
- 4 bits Accumulator
- 2 inputs: ACC, A
- 7 instructions.
The first two rows of bits are respectively A and the operation code.
Opcodes:
NOP 0000 ; No Operation
ADD 0001 ; ACC + A
SUB 0010 ; ACC - A
AND 0100 ; ACC AND A
NOT 0101 ; NOT ACC
OR 1000 ; ACC OR A
LDA 1010 ; Loads A into the accumulator
How to use:
This one has an accumulator. So the operations are done with its own previous value. To do 5 + 2 you do:
LDA 5 (0101)
ADD 2 (0010)
output: 7 (0111)
To do another operation, you must load another number into the acc or use the result as input for other operation.
You must wait the clock time or set it manually using the switch above
I decided to reupload this since the older was 4 bits but the instructions needed 6 bits. So it was a fake 4 bits. I fixed that just adding some AND & XOR Logic gates.