The 4-bit datapath uses four registers (R1–R4), two operand-selection multiplexers, a custom ALU, a destination decoder, and a write-data multiplexer.
- The source multiplexers select the two register operands.
- The ALU processes the operands using the selected
OPRcode. - The write-data multiplexer selects manual data or the ALU result.
- The destination decoder selects the register to be updated on the clock edge.
| Signal | Width | Function |
|---|---|---|
Manual_IN |
4 | 4-bit manual data input |
LOAD |
1 | Select manual input or ALU write-back |
SEL_A |
2 | Select operand A register |
SEL_B |
2 | Select operand B register |
SEL_D |
2 | Select destination register |
OPR |
2 | Choose ALU operation |
RST |
1 | Reset registers |
| Clock | 1 | Update the enabled register |
ZERO |
1 | Zero-result status LED |
OPR |
Function |
|---|---|
00 |
Addition |
01 |
Subtraction |
10 |
Bitwise AND |
11 |
Bitwise OR |
The result is 4 bits wide. The zero flag is computed from the output bits:
ZF = NOT (result[3] OR result[2] OR result[1] OR result[0])
- Open the circuit in Logisim-evolution and select
main. - Choose a register using
SEL_D, enter a value withManual_IN, and select the manual input path usingLOAD. - Pulse the clock to store the value. Repeat to initialize another register.
- Set
SEL_AandSEL_Bto select the two operands. - Set the desired
OPRcode and observe the output. - Switch
LOADto the ALU output path, select a destination register, and pulse the clock to store the result.

