This project uses the Cornell University ECE2300 (SP24 taught by Zhiru Zhang) ISA to implement a 4-bit ALU. This ALU uses a top-level controller module to pipe the correct inputs and select the correct outputs (src/alu.v). The logical functions are implemented using the following instructions.
FS | Function | Logical Equivalent |
---|---|---|
000 | ADD | A + B |
001 | SUB | A - B |
010 | SRA (Shift Right Arithmetic) | A>>> |
011 | SRL (Shift Right Logical) | A >> |
100 | SLL (Shift Left Logical) | A << |
101 | AND | A & B |
110 | OR | A + B |
111 | INVALID | INVALID |
Input your first value, A to UI[7:4], and B to UI[3:0]. You then put your function select (FS) input into UIO[2:0], and you can read your Y output at UO[7:4], your carry out at UO[3], overflow at UO[2], negative at UO[1], and zero at UO[0].
None! Just a way to input your desired values and read the outputs.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | B[0] | Z | FS[0] |
1 | B[1] | N | FS[1] |
2 | B[2] | V | FS[2] |
3 | B[3] | C | |
4 | A[0] | Y[0] | |
5 | A[1] | Y[1] | |
6 | A[2] | Y[2] | |
7 | A[3] | Y[3] |