For this project you will implement a data path which fetches 8-bit instructions from memory and executes them. Details on what components your datapath must have as well as the instructions you must implement can be found below. The project will be due Friday, August 12th at 11:59 PM. (Subject to change, and maybe not in your favor. Try to start early.)
You will be using Logisim 2 for this project. You can run it on the instructional machines by typing java -jar ~cs61c/bin/logisim.jar and you can download it to your home machine from the Logisim Website.
Logisim 2 is more stable than it used to be, but is still in development. This means a few things for you:
1. Save early, save often, make backups. This software will crash on you. Be prepared for this to happen. In addition, make sure you make fairly frequent backups of your files, as you may hit a bug that corrupts your file.
2. The course staff and the software developer are very interested in getting your feedback and suggestions for the new version and bug reports. Please, if you have thoughts on the software or hit a bug, do us a favor and provide the information to us via the Feedback Form or Bug Report.
3. A lot of the features of the new version are not yet well-documented. The beginnings of a tutorial/user guide are now available from the Logisim developer.
4. As suggestions and bug reports come in during the project it is possible (though unlikely) that we may change to new versions of Logisim. Watch here for software updates.
You must submit your CPU (named cpu.circ) and your sample program (named sum.code) online. Do this by creating a directory called proj4, creating your files, and typing submit proj4.
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
op | rd | rs1 | rs2 | func |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
op | rd | imm |
Instruction | Opcode | Function code | meaning |
---|---|---|---|
or $rd,$rs1,$rs2 | 0 | 0 | R[rd] = R[rs1] | R[rs2]; PC = PC + 1 | add $rd,$rs1,$rs2 | 0 | 1 | R[rd] = R[rs1] + R[rs2]; PC = PC + 1 | and $rd,$rs1,$rs2 | 0 | 2 | R[rd] = R[rs1] & R[rs2]; PC = PC + 1 | sub $rd,$rs1,$rs2 | 0 | 3 | R[rd] = R[rs1] - R[rs2]; PC = PC + 1 |
Instruction | Opcode | Meaning | .
---|---|---|
load $rd,imm | 1 | R[rd] = MEM[imm]; PC = PC + 1 |
store $rd,imm | 2 | MEM[imm] = R[rd]; PC = PC + 1 |
lui $rd,imm | 3 | R[rd] = {imm, 0000}; PC = PC + 1 |
ori $rd,imm | 4 | R[rd] = R[rd] | zero_extended(imm); PC = PC + 1 |
jeq imm | 5 | if R[0] == R[1] then PC = {upper_four_bits(PC), imm} else PC = PC + 1 |
j imm | 6 | PC = {upper_four_bits(PC), imm} |
halt | 7 | nothing happens; PC = PC |