First design for the ALU. The ALU takes two 8-bit inputs 'A' and 'B' plus the Carry Flag 'C' and can perform 6 operations based upon how control inputs 1 to 6 are set.
Mathematical Operations
- Add
- Subtract
Logical Operations
- AND
- OR
- XOR
- NOT
Outputs
- Result
- Zero flag - 1 if the output is equal to zero; 0 if the output is non-zero. The zero flag is set for every operation.
- Carry flag
The control lines are used as follows.
Control 1
- '0' select non-inverted 'B' into Adder (i.e. perform addition)
- '1' select inverted 'B' into Adder. (used to to perform subtraction)
Controls 2 and 3
- '23'
- '00' select Carry Flag as input to Adder
- '10' force Carry Flag value to '1' as input into Adder (used to perform subtraction)
- '01' force Carry Flag value to '0' as input into Adder
Controls 4, 5 and 6 - select which operation to output as the result
- '456'
- '000' output the result of 'A' AND 'B'
- '100' output the result of 'A' OR 'B'
- '010' output the result of 'A' XOR 'B'
- '110' output the result of NOT 'B'
- '001' output the result of the Adder

No comments:
Post a Comment