# CS代写 assembler algorithm Hive CPU – cscodehelp代写

CPU
COMP 273 Assignment 7 – Fall 2021 Due: December 6, 2021, at 4 PM on myCourses
Submission instructions
All work must be your own and must be submitted to myCourses. Include your name and student number in a comment at the top of your documents / Logisim circuits. Submit only one file: a7.circ. Do not use a zip archive. Check your submission by downloading it from myCourses and checking that it was correctly submitted. You will not receive marks for work that is incorrectly submitted.
Purpose
• Learning about the basic circuitry in the CPU
• To get used to wiring the execution of macro code as micro instructions
• To understand how the CU coordinates the different machines that make the CPU
• A5 and A6 should be completed before you start this assignment
• The lecture recordings on CU.
• This assignment should take about three days to complete.
• You will need to merge the A5 and A6 circuit into this assignment. You may use your own
solutions, or you can use the solutions provided by the instructor.
Vybihal
Assignment 7 – COMP 273 Page 1 of 4

Implementation
Using Logisim Evolution create the following basic classical CPU:
Figure 1: High-level view of CPU
– Task: Build the circuit of figure 1 reusing A5 and A6 circuits.
– Inputs: RAM and PC. You will write your algorithm in binary and PC points to 1st instruction.
– Outputs: RAM. Solution will be stored at a location in RAM.
– Circuits: The CU, MAR, MBR, PC, IR, ADDR, R1, R2, CPU Bus, System Bus, one common clock
NOTE: Your final circuit does not need to look exactly like figure 1. You may want to add additional registers, like: L, R, A-OUT, and STATUS.
NOTE 2: The TA must be able to change and see the bits of RAM and registers before and after execution.
NOTE 3: Your final circuit must use designs we covered during class. You cannot use any outside (other sourced) circuit designs.
NOTE 4: You must build the circuit from the following components ONLY: wires, clock, AND, OR, NOT, pins, flip-flops, and XOR. You CANNOT use: any prebuilt circuits, or any other prebuild items from Logisim. You can also use tunneling and “adding a circuit” from the project menu. You can use the official solution or your own solution from A5 and A6 for the ClassicalRAM and ClassicalALU portions of figure 1.
Vybihal Assignment 7 – COMP 273 Page 2 of 4

Steps
• Important: everything in this CPU is a nibble. All registers are nibble sized. The IR is a nibble.
• Begin by deciding the location of the two U-Buses and the A5 and A6 circuits. I suggest you use
the “adding a circuit” project option to import your A5 and A6 circuits, but this is optional.
• Decide where the CPU registers will be placed and where the CU will be located.
• Decide if you will need extra registers, like L, R, STATUS, A-OUT, others.
• RAM from A5 has 8 nibbles. These nibbles will be used to store assembler instructions and data.
Our assembler instructions are nibble sized:
▪ 1st 2 bits : LOAD = 00
▪ 3rd bit : REGISTER = 0 for R1, 1 for R2
▪ 4th bit : OFFSET = 0 for address 0 in RAM, 1 for address 1 in RAM
o SAVE REGISTER, OFFSET
▪ 1st 2 bits : SAVE = 01
▪ 3rd bit : REGISTER = as in LOAD
▪ 4th bit : OFFSET = as in LOAD
▪ Example: SAVE R1, 1→0101
▪ 1st 2 bits : ADD = 10
▪ 3rd bit : REGISTER = as in LOAD
▪ 4th bit : is zero (unused)
▪ The solution to the addition is saved in R1 automatically.
▪ Example: ADD R2→R1 = R1 + R2→1010
▪ Example: ADD R1→R1 = R1 + R1→1000
o SUB REGISTER
▪ 1st 2 bits : SUB = 11
▪ 3rd bit : REGISTER = as in LOAD
▪ 4th bit : is zero (unused)
▪ The solution to the subtraction is saved in R1 automatically
▪ Example: SUB R2→R1 = R1 – R2→1110
▪ Example: SUB R1→R1 = R1 – R1→1100
o HALT
▪ All four bits are 1
▪ Example: HALT→1111
▪ This marks the end of the algorithm. The clock’s ticking does not affect the
circuit anymore. The PC no longer increments.
• Your circuit must be able to execute any program set in the RAM with the PC pointing to the first
instruction of that algorithm (which can be represented by the above instructions). You may set the PC’s starting address anywhere you like.
Vybihal
Assignment 7 – COMP 273 Page 3 of 4

Execution
Your CPU circuit must be able to do at least the following algorithms:
1. Execute a program that loads two numbers, performs and ALU operation, and then saves the solution.
2. Execute a program that has only the HALT instruction.
Note: Your CPU does not need to be optimized, therefore it does not matter the number of micro steps required to execute your instructions.
Marking
• Maximum 20 points
o +1ReusingA5circuit
o +1ReusingA6circuit
o +1UsingonecommonclockforbothCPUandSystem o +1SystemU-Bus
o +2 CPU U-Bus and control gates
o +2CPURegister