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 xx00 0000 ; No Operation
ADD xx00 0001 ; ACC + A
SUB xx00 0010 ; ACC - A
AND xx00 0100 ; ACC AND A
OR xx00 1000 ; ACC OR A
NOT xx01 0000 ; NOT ACC
LDA xx10 0000 ; 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
Does not have a MUX and DEMUX cause it would be too much expensive for the simulator. Because of that, you could do multiple operations at once but will result in undetermined behavior.