HW 4 Question
HW 4 Question
Instruction:
• The submission deadline is 2024 Dec. 11 23:59. Late submissions will not be accepted.
• The solutions should be submitted to Canvas. Email submissions (or other form of
submissions) will not be accepted.
• Your submission should contain the following files:
o A “*.circ” file that contains the processor design.
o Four memory image file that contains the binary machine codes of the four testing
programs, named as “Mem-1”, “Mem-2”, “Mem-3” and “Mem-4”, respectively.
o The completed answer sheet (either WORD or PDF file).
• If you choose to answer the bonus question, you should submit two extra files (i.e., they
should be separated files besides your solutions to Question 1-4).
o A “*.circ” file that contains the circuit for the bonus question.
o The completed answer sheet of the bonus question (either WORD or PDF file).
• You can use all build-in components provided in Logisim.
• The weight of this HW 8% in the total grade (excluding the bonus question). The bonus
question contributes at most 4% to the total grade (but the total CA grade is capped by 30%
and the extra marks of the bonus question cannot be carried into the final exam grade).
Question:
Build a processor in Logisim. The processor should meet the following requirements:
• This is a 16-bit processor. In particular, all registers are 16-bit, and each instruction is also
16-bit.
• The processor has 8 general-purpose registers $r1 – $r8.
• The data and instruction are stored in two separated memory, each having its own address
space. Both the data and instruction memory are addressed by 16-bits, i.e., the size of the
memory block at each address is 16-bits. (Notice, this is different from the examples in our
lecture, where each memory block is 8-bit.)
• The processor supports the following instructions.
You should design the instruction set for the processor to fulfill the following requirements:
Write the binary machine code of the following testing assembly programs, store the binaries in
memory images, and execute the testing programs with your processor built in Logisim. You are
encouraged to test your programs with more testing programs designed by yourself to assure the
correctness of your design.
Test Program 1:
.text
li $r1, 1
li $r2, 2
li $r3, 10
ble $r2, $r3, -1 #jump to the previous instruction if the condition is satisfied
halt
Test Program 2:
.text
li $r1, 6
li $r2, 5
halt
Test Program 3:
.text
li $r1, 6
li $r2, 5
li $r8, 0
li $r8, 1
li $r8, 1
halt
Test Program 4:
.text
li $r1, 6
li $r2, 4
call 7
li $r1, 7
li $r2, 8
call 3
jump 3
rtn
halt
Bonus Question:
Build a processor that fulfills all the requirements above, while using a five-stage pipeline and
resolving the control hazards and data hazards properly:
Your pipelined processor should use the same instruction set as in the above question, and be able
to execute the above testing programs using the same memory images.