Answer:
The part I called command in the first diagram has been renamed to opcode, or operation code. This is a set of bits (a number) that will tell the ALU which action to perform. I can get the LC-3 opcodes for ADD and NOT and ADD from the book, so I'm not too worried.
Note the #? comment by the switch above opcode. This means I'm not sure how many switches I will need. How many bits do I need to perform all the operations I want? The textbook will tell me.
Materials
Now I make a list of all the materials you have accumulated so far. This list is just an example; yours may be different.
Two 4-bit inputs
One 4-bit output
Two keypads for 4-bit input
Three 7-segment displays (2 for input, 1 for output)
A bunch of switches for opcode (could use a keypad, I guess, but switches are so much more geeky)
A bunch of lights too
The "is zero" LED
One button for clock
One button for reset
One switch for carry-in
Include logic to perform a SUB instruction. That is, subtract the second operand from the first (out = in1 - in2). All three values -- both inputs and the output -- must be two's complement numbers (negative numbers must be represented). Your design may work in one (8 points) or two (4 points) clock cycles.
Explanation:
You are allowed to use the Logisim built-in registers.
The clear input of the register should not be used (do not connect anything to
them).
Custom ALU
Use the provided subcircuit in the template to implement your ALU. You do not have to create additional subcircuits to do this. The ALU has a total of three inputs: First number, second number and select operation input. And one output: Result. The first and second number are used as input for the operations the ALU performs. The select input decides which operation result will be on the single output of the ALU. The ALU is supposed to calculate: NumberA OPERATION NumberB. Register 1 of the storage contains NumberA and Register 2 contains NumberB. The ALU must be able to compute signals with a 4-bit width. Make sure to add labels to all inputs and outputs.
The following operations should be performed for each select input combination (s1s0): • 00: Logic Bitwise XOR
• 01: Multiplication
• 10: Division
• 11: Addition Notes:
You can change the inputs bit width / data bits of any gate to more that 1-bit.
The Logic Bitwise XOR operation can be done with a single XOR gate.
You are also allowed to use the built-in arithmetic logic components and multi- plexer provided by Logisim.
If the result is larger than 4 bits, it will be truncated (only 4 LSB will be shown). This behavior is intended for this assignment. Also, negative results do not have to be considered.
Once you have implemented the ALU circuit, connect the wires in the main circuit properly and test all four operations of your ALU in combination with the storage component.