Assignment 6 – COMP 273 Page 1 of 3
ALU
COMP 273 Assignment 6 – Fall 2021
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: a6.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 ALU
• To get used to 2’s complement
• To get used to using flags
Helpful
• A5 should be completed before you start this assignment
• The lecture recordings on CPU.
• Assuming you have completed A5, this assignment should take about two days to complete.
• There will be an extra tutorial for using Logisim this week (Logisim Help Desk).
Assignment 6 – COMP 273 Page 2 of 3
Implementation
Using Logisim Evolution create the circuit for the following problem:
Figure 1: High-level view of ALU
– Task: Build the circuit (blue boxes) of figure 1.
– Inputs: L and R (nibble sized, 4 pins each), plus Add/Subtract command pin.
– Outputs: A-out (nibble sized, 4 pins) and Status (3 pins)
– Circuits: 2’s complement circuit, adder circuit, and status output circuits. Plus, a CLOCK.
NOTE: Your final circuit does not need to look exactly like figure 1. However, the input and output pins
must look like figure 1.
NOTE 2: Your final circuit must use designs we covered during class. You cannot use any outside (other
sourced) circuit designs.
NOTE 3: You must build the circuit from the following components ONLY: wires, clock, AND, OR, NOT,
pins, and XOR. You CANNOT use: any prebuilt adder circuits, or any other prebuild items from Logisim.
Optionally you can use: tunneling and “adding a circuit” from the project menu.
Steps
• Begin by placing the input and output pins onto the circuit. These pins will be used to enter and
see values.
• Do not use registers for: L, R, A-out, Status, and the command pin.
• The Adder circuit assumes two 2’s compliment inputs in L and R. The L input goes directly into
the Adder without modification. The R input goes through the 2’s complement circuit and may
modify R’s value (for example, R may be 5, but the 2’s complement circuit changes it to -5). The
solution to the addition is outputted to the A-out pins.
• The 2’s complement circuit is controlled by the command pin and will negate the 2’s
complement R input value when commanded to do so during subtraction. Otherwise, during
Adder
2’s
complement
Status
determi-
nation
Assignment 6 – COMP 273 Page 3 of 3
addition it simply lets the R value pass through without change. When the command pin is 0 the
ALU is performing an addition. When the command pin is 1 the ALU is performing a subtraction.
• The Status register’s flag bits are updated by the result stored in A-out. Bit 0 = negative, Bit 1 is
zero, and bit 3 is overflow.
• Add a clock to control the execution of this circuit.
Execution
Your ALU circuit must be able to do the following:
1. 0 – 0
2. 1 – 1
3. 1 – (-1)
4. 2 – 1
5. 1 – 2
6. Overflow
7. And the other numbers that fit within the 2’s compliment nibble.
Note: The TA will input the numbers into the L and R pins in 2’s complement form by hand.
Marking
• Maximum 20 points
o +7 Adder circuit
o +7 2’s complement circuit
o +6 Status determination circuits
• -10% per day late with max 2 late days
• -3 points for not following instructions
• -5 points for not using the clock
• Assignment must execute to be graded