$25
Overview
1.1 Purpose
You have learned about digital logic, including transistors, gates, and combinational logic. Gates (AND, OR, etc.) can be built using transistors, and Combinational Logic circuits (decoder, MUX, etc.) can be built using gates. Note how the concepts build up from transistors to gates to combinational logic. We have provided you with a tool called Circuitsim (available through Docker) that allows you to simulate building circuits, without actually using physical hardware.
The purpose of this assignment is for you to become proficient building gates out of transistors, and combinational logic circuits out of gates, using Circuitsim. You will put these components together to create an ALU (arithmetic logic unit) circuit, which will allow you to perform several specified math and logic operations using digital logic.
1.2 Task
You will complete three Circuitsim files, and build an ALU from the ground up, starting with transistors, and then gates, and then the remainder of your combinational logic. Please read this entire document for detailed instructions, including which digital logic components you are allowed to use or prohibited from using for each part of the assignment.
This document also contains tutorials on using Circuitsim and creating subcircuits, among other topics.
The steps to complete this assignment include:
1. Create the standard logic gates (NAND, NOR, NOT, AND, OR)
2. Create an 8-input multiplexer and an 8-output decoder
3. Create a 1-bit full adder
4. Create an 8-bit full adder using the 1-bit full adder
5. Use your 8-bit full adder and other components to construct an 8-bit ALU
Be sure to avoid using components that are disallowed for each phase of this assignment.
2 Optional Tutorial
Note: This tutorial is optional and to help you get acquainted with CircuitSim before you start this homework. If you’re comfortable with this software, feel free to skip to section 2. CircuitSim is an interactive circuit simulation package. We will be using this program for the next couple of homework assignments. This is a tutorial to help you get acquainted with the software. CircuitSim is a powerful simulation tool designed for educational use. This gives it the advantage of being a little more forgiving than some of the more commercial simulators. However, it still requires some time and effort to be able to use the program efficiently. With this in mind, we present you with the following assignment:
2.1 Part 1 — Read Resources
Read through the following resources
• CircuitSim Wires Documentation https://ra4king.github.io/CircuitSim/docs/wires/
• Tutorial 1: My First Circuit https://ra4king.github.io/CircuitSim/tutorial/tut-1-beginner
2.2 Part 2 — Complete Tutorial 2
Complete Tutorial 2 https://ra4king.github.io/CircuitSim/tutorial/tut-2-xor
Instead of saving your file as xor.sim, save your file as part1.sim. As well, make sure you label your two inputs a and b, and your output as c, as well as rename your subcircuit to xor.
2.3 Part 3 — Complete Tutorial 3
Complete Tutorial 3 https://ra4king.github.io/CircuitSim/tutorial/tut-3-tunnels-splitters Name the subcircuit umbrella, the input in, and the output out. Save your file as part2.sim.
3 Instructions
For this assignment, you will be using CircuitSim. The version is included in the 2110 Docker container. If you are having issues with Docker, it can also be found on canvas under Files -> Tools -> CircuitSim.jar.
3.1 Requirements
For the first part of this assignment (the logic gates), you may use only those components found in the Wiring tab (being the input/output pins, constants, probes, clocks, splitters, tunnels, and transistors), along with any of the sub-circuits that you create or that already exist.
For the second part of this assignment (the multiplexer and decoder), you may use only those components found in the Wiring and Gates tabs along with any of the sub-circuits that you create or that already exist.
For the rest of this assignment, you may use only those components found in the Wiring and Gates tabs (except for the XOR/XNOR gates) as well as any of the sub-circuits that you create or that already exist. The term sub-circuit refers to any circuits that you have constructed in this part of the homework. If you’re unsure on how to utilize a sub-circuit, check out Section 5. For the ALU specifically, you may use the Plexer tab as well.
Use of anything not listed above will result in heavy deductions. Your need to have everything in their correctly named sub-circuit. More information on sub-circuits is given below.
Use tunnels where necessary to make your designs more readable, but do not overdo it! For gates, muxes, adders and decoders you can often get clean circuits just by placing your components well rather than using tunnels everywhere.
3.2 Part 1: 1-Bit Logic Gates
ALLOWED COMPONENTS: Wiring Tab and Circuits Tab
All of the circuits in this file are in the gates.sim file.
For this part of the assignment, you will create a transistor-level implementation of the NAND, NOT, NOR, AND, and OR logic gates.
Remember for this section that you are only allowed to use the components listed in the Wiring section, along with any of the logic gates you are implementing in CircuitSim. For example, once you implement the NOT gate you are free to use that subcircuit in implementing other logic gates. Implementing the gates in the order of the subcircuit tabs can be the easiest option.
As a brief summary of the behavior of each logic gate:
NAND (Inputs: A, B - Output: OUT)
A
B
A NAND B
0
0
1
0
1
1
1
0
1
1
1
0
NOR (Inputs: A, B - Output: OUT)
A
B
A NOR B
0
0
1
0
1
0
1
0
0
1
1
0
AND (Inputs: A, B - Output: OUT)
A
B
A AND B
0
0
0
0
1
0
1
0
0
1
1
1
OR (Inputs: A, B - Output: OUT)
A
B
A OR B
0
0
0
0
1
1
1
0
1
1
1
1
NOT (Input: IN - Output: OUT)
A
NOT A
0
1
1
0
Hint: Start by creating the NAND and NOT gates from transistors. Then use this gate as a subcircuit for implementing the others.
All of the logic gates must be within their named sub-circuits.
3.3 Part 2: Plexers
ALLOWED COMPONENTS: Wiring Tab, Circuits Tab, and Gates Tab
All of the circuits in this file are in the plexers.sim file.
The multiplexer you will be creating has 8 1-bit inputs (labeled appropriately as A, B, C, ..., H), a single 3-bit selection input (SEL), and one 1-bit output (OUT). The multiplexer uses the SEL input to choose a specific input line for forwarding to the output.
For example:
SEL = 000 ==> OUT = A
SEL = 001 ==> OUT = B
SEL = 010 ==> OUT = C
SEL = 011 ==> OUT = D
SEL = 100 ==> OUT = E
SEL = 101 ==> OUT = F
SEL = 110 ==> OUT = G
SEL = 111 ==> OUT = H
The decoder you will be creating has a single 3-bit selection input (SEL), and eight 1-bit outputs (labeled A, B, C, ..., H). The decoder uses the SEL input to raise a specific output line, as seen below.
For example:
SEL = 000 ==> A = 1, BCDEFGH = 0
SEL = 001 ==> B = 1, ACDEFGH = 0
SEL = 010 ==> C = 1, ABDEFGH = 0
SEL = 011 ==> D = 1, ABCEFGH = 0
SEL = 100 ==> E = 1, ABCDFGH = 0
SEL = 101 ==> F = 1, ABCDEGH = 0
SEL = 110 ==> G = 1, ABCDEFH = 0
SEL = 111 ==> H = 1, ABCDEFG = 0
3.4 Part 3: Adders & ALUs
ALLOWED COMPONENTS: Wiring Tab, Circuits Tab, and Gates Tab BANNED COMPONENTS: XOR Gate, XNOR Gate
NOTE: For the ALU specifically, you may use the Plexer tab as well. (Section 2.4.3) All of the circuits in this file are in the alu.sim file.
3.4.1 1-Bit Adder
The full adder has three 1-bit inputs (A, B, and CIN), and two 1-bit outputs (SUM and COUT). The full adder adds A + B + CIN and places the sum in SUM and the carry-out in COUT.
For example:
A = 0, B = 1, CIN = 0 ==> SUM = 1, COUT = 0
A = 1, B = 0, CIN = 1 ==> SUM = 0, COUT = 1
A = 1, B = 1, CIN = 1 ==> SUM = 1, COUT = 1
Hint: Making a truth table of the inputs will help you.
3.4.2 8-Bit Adder
For this part of the assignment, you will daisy-chain 8 of your 1-bit full adders together in order to make an 8-bit full adder.
This circuit should have two 8-bit inputs (A and B) for the numbers you’re adding, and one 1-bit input for CIN. The reason for the CIN has to do with using the adder for purposes other than adding the two inputs.
There should be one 8-bit output for SUM and one 1-bit output for COUT.
3.4.3 8-Bit ALU
ALLOWED COMPONENTS: Wiring Tab, Ciruits Tab, Gates Tab, and Plexer Tab
BANNED COMPONENTS: XOR Gate, XNOR Gate (see note regarding the ExclusiveNOR operation)
You will create an 8-bit ALU with the following operations, using the 8-bit full adder you created in for
2.4.2:
000. Addition
[A + B]
001. Subtraction
[A - B]
010. ExclusiveNOR
[A xnor B]
011. isEqual
[A == B]
100. isMultipleOf8
[A % 8 == 0]
101. MultiplyBy15
[15 * A]
110. DivideBy2
[A // 2]
111. AbsoluteValue
[abs(A)]
Notice that MultiplyBy15, isMultipleOf8, DivideBy2, and AbsoluteValue only operate on the A input. They should NOT rely on B being a particular value.
For this ALU, we will be using a multiplexer. This ALU has two 8-bit inputs for A and B and one 3-bit input for OP, the op-code for the operation in the list above. It has one 8-bit output named OUT.
For the ExclusiveNOR operation, you are NOT allowed to use the exclusive OR or the exclusive NOR gate provided on CircuitSim. NOTE: this rule recursively extends to any component that your ALU uses, so you will need to ensure that no other part of the ALU uses the XOR or XNOR gates. This includes subcircuits like the 1-bit adder.
For the DivideBy2 operation, we ask you to consider this as floor division as shown in the // simply meaning to round down if the division would result in a fraction. For example: if the input is 5, your output should be 2.
For the MultiplyBy15 operation, although there is potential for overflow, we don’t need to worry about it in this homework.
For isMultipleOf8 and isEqual operations, return 00000001 if the condition is true, and 00000000 otherwise.
Hint: ExclusiveNOR Truth Table (Inputs: A, B - Output: OUT)
A
B
A XNOR B
0
0
1
0
1
0
1
0
0
1
1
1
1. gates.sim
NOT, NAND, NOR, AND, OR
2. plexers.sim
Decoder, MUX
3. alu.sim
1-Bit Adder, 8-Bit Adder, 8-Bit ALU
Be sure to check your score to see if you submitted the right files, as well as your email frequently until the due date of the assignment for any potential updates.
No partial credit will be given for incorrect outputs for Part 1, Part 2, and the adder-portion of Part 3. For the ALU, partial credit will be awarded on a per-operation basis, wherein each operation must perform successfully to be awarded credit. Because of this, we urge you to check your score before the due date.
5 Sub-Circuit Tutorial
As you build circuits that are more and more sophisticated, you will want to build smaller circuits that you can use multiple times within larger circuits. Sub-circuits behave like classes in Object-Oriented languages. Any changes made in the design of a sub-circuit are automatically reflected wherever it is used. The direction of the IO pins in the sub-circuit correspond to their locations on the representation of the sub-circuit.
To create a sub-circuit:
1. Go to the “Circuits” menu and choose “New circuit”
2. Name your circuit by right-clicking on the “New circuit” item and selecting “Rename”
To use a sub-circuit:
1. Click the “Circuits” tab next to the “Misc” tab
2. Select the circuit you wish to use and place it in your design.