$29
Introduction
This project is designed to strengthen your knowledge of basic hardware elements and circuitry. The as-signment is designed to build on each other, so work down the document linearly, otherwise you may not understand what is going on.
Please read through the entire document before starting. Often times things are elaborated on below where they are introduced, so reading the entire document can give you a better grasp on things. Start early and if you get stuck, there’s always Piazza or come visit us in office hours.
2 Setup
The software you will be using for this project and all future circuit based assignments is called CircuitSim - an interactive circuit simulation package.
In order to use CircuitSim, you must have Docker up and running. If you do not have Docker, follow the instructions laid out in the installation guide found under Canvas ! F iles ! Docker:
CircuitSim comes pre-installed on the Docker image, and should be accessible via the desktop. Please only use the CircuitSim through Docker to build your circuits as it is the correct version. CircuitSim downloaded elsewhere may not be compatible with our grader. You have been warned.
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.
3 Part 1 — Introduction to CircuitSim
The first part of this project is designed to get you up to speed with CircuitSim. If you do not have CircuitSim running through Docker, see the setup section of this document to get there.
3.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
3.2 Complete Tutorial 2
Complete Tutorial 2 https://ra4king.github.io/CircuitSim/tutorial/tut-2-xor
Instead of saving your file xor.sim as mentioned in the tutorial, save it as tutorial1.sim. Be sure you label your two inputs a and b, and your output as c.
3.3 Complete Tutorial 3
Complete Tutorial 3 https://ra4king.github.io/CircuitSim/tutorial/tut-3-tunnels-splitters
Name the subcircuit Tutorial 2, the input in, and the output out. Save your file as tutorial2.sim.
3
4 Part 2 — ALU
Now that we have the basics down, we can move on to more complex circuits and logic. All computer processors have a very important component known as the Arithmetic Logic Unit (ALU). This component allows the computer to do, as the name suggests, arithmetic and logical operations. For this part, you’re going to build an ALU of your own, along with creating some of the gates.
For this part of the project you will:
Create the standard logic gates (NAND, NOR, NOT, AND, OR)
Create an 8-input multiplexer and an 8-output decoder
Create a 1-bit full adder
Create an 8-bit full adder using your 1-bit full adder
Use your 8-bit full adder and other components to construct an 8-bit ALU
When building these circuits, restrictions have been placed on what you can use. These restrictions are listed at the beginning of each section. Using anything not listed will result in heavy deductions. You also need to have everything in its correctly named sub-circuit. More information on the sub-circuits is given below.
Use tunnels where necessary to make your designs more readable, but do not overdo it! For gates, multi-plexers, decoders, and adders you can often make clean circuits by placing your components strategically rather than using tunnels everywhere.
4.1 1-Bit Logic Gates
Allowed Components: Wiring Tab and Circuits Tab All of the circuits are found in the gates.sim file.
For this part, 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.
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.
4.2 Muxes
Allowed Components: Wiring Tab, Gates Tab, and Circuits Tab All of the circuits are found in the muxes.sim file.
4.2.1 Multiplexer, commonly abbreviated as ”mux”
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.
4
4.2.2 Decoder
The decoder you will be creating has a single 3-bit selection input (SEL), and eight 1-bit output (labeled A, B, C, ..., H). The decoder uses the SEL input to raise a specific output line, as seen below.
4.3 Adders
Allowed Components: Wiring Tab, Gates Tab, and Circuits Tab All of the circuits are found in the alu.sim file.
4.3.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
Hint: Making a truth table of the inputs will help you.
4.3.2 8-Bit Adder
You should 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.
4.4 8-Bit ALU
Allowed Components: Wiring Tab, Gates Tab, Plexer Tab, and Circuits Tab
You will create an 8-bit ALU with the following operations, using the 8-bit full adder you created in 4.3.2.
000
add
[A+B]
001
sub
[A-B]
010
isClear
[A == 0]
011
getBit
See below
100
isEven
[A%2==0]
101
multiplyBy15
[A * 15]
110
isMultipleOf16
[A%16==0]
111
isPowerOf2
[A == 2n for some n 2 N ]
5
getBit: For this operation, the least three significant bits (three right most bits) of B represent what bit of A needs to be returned. Note that bits are indexed from the least significant bit (LSB) starting at 0. So when we say the “bit at index 2” it really means this one, 00000100.
Examples:
= 01010101, B = 00000011 = 00000000, since the bit at index 3 in A is a 0, return 0
= 11110000, B = 00000101 = 00000001, since the bit at index 5 in A is a 1, return 1
= 01010101, B = 11110010 = 00000001, since the least three significant digits of B is 010 and the bit at index 2 in A is a 1, return 1
Notice that isClear, isEven, isMultipleOf16, multiplyBy15, and isPowerOf2 only operate on the A input. They should NOT rely on B being a particular value.
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.
The provided autograder will check the op-codes according to the order listed above (add (000), sub (001), etc.) and thus it is important that the operations are in this exact order.
No partial credit will be given for incorrect outputs for logic gates, plexers, or adders. However, 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 Part 3 — Finite State Machine
Great, so now we have built some combinational logic down, but how can we work with sequential logic? For this part of the assignment, we’ll be working with Flip Flops, registers, and a one hot state machine. The goal for this part of the project is to understand how information is stored in a computer, as well as, learn how to make a basic state machine.
As always, do not change/delete any of the input/output pins.
5.1 Storage Elements
For this part you will build your own register from the ground up. For more information about each component, refer to the Patt & Patel textbook. Implement your circuits in the storage.sim file.
5.1.1 RS Latch
As described in section 3.4.1 of Patt & Patel, we will be building a RS latch using NAND gates.
• Build your circuit in the RS Latch subcircuit in the storage.sim file
5.1.2 Gated D Latch
Using your RS latch subcircuit, implement a Gated D Latch as described in section 3.4.2 of the Patt & Patel textbook. Notice that the Gated D Latch only needs one output, so you should disregard the inverse output of your RS Latch.
Implement this circuit in the Gated D Latch subcircuit in the storage.sim file
You are not allowed to use the built-in SR Flip-Flop in CircuitSim to build this circuit
6
5.1.3 D Flip-Flop
Using the Gated D Latch, create a D Flip-Flop, as described at the end of section 3.6.6 of the Patt & Patel textbook. Your D Flip-Flop output should be able to change on the rising edge, which means that the state of the register should only be able to change at the exact instant the clock goes from 0 to 1.
• Implement this circuit in the D Flip-Flop subcircuit in the storage.sim file
5.1.4 Register
Using the D Flip-Flop you just created, build a 4-bit Register. Your register should also use edge-triggered logic.
• This circuit will be implemented in the Register subcircuit in the storage.sim file
5.2 State Machine
Given a simple state diagram, you will build a state machine in CircuitSim using the “one-hot“ style of building state machines.
• The circuit will be implemented in the One-Hot State Machine subcircuit of the fsm.sim file
The state machine we are going to be building is a safe. The safe has three keys and requires a certain combination to unlock the safe. Once unlocked, the safe remains unlocked indefinitely until reset. The three keys are A, B, and C. The combination to unlocked the safe is a three step process. You must press A and B at the same time, then press B by itself, then press A and C at the same time. If a user enters the wrong combination for the given step they are on, then the safe resets back to the the first step, Locked 0 state. The outputs of the state machine is Status where 0 is locked and 1 is unlocked. See the diagram below for a visual example of this safe translated into a state machine works.
You will be implementing this state transition diagram as a circuit using the one-hot style. Remember for one-hot you will have a register with the number of bits being the number of states you have. Each
7
bit corresponds to a state, and you are in that state if the corresponding bit is a 1. Only one of these bits will be on at a time (the only exception being when the state machine starts up). At most, one of the inputs will be turned on.
You must use exactly one register. These are found under the Memory tab in CircuitSim. Failure to do so may result in large point deductions.
You will need to implement a reset input for this circuit, which will return your state machine to its Start state. You may design this so that the reset happens either immediately when the reset button is pressed (asynchronously) or when it is on during the rising edge of the next clock cycle.
You must implement this using one-hot. A template file fsm.sim has been given to you. Implement the state machine in the provided One-Hot State Machine subcircuit.
Note that there are five inputs to the subcircuit: A, B, C, Clock, and Reset. The inputs A, B, C corresponds to whether or not those keys are pressed, as in the diagram above. Clock turning off and on repeatedly will be used to represent clock ticks in your circuit. Reset corresponds to an attempt to reset your circuit.
6 Autograder
To run the autograder, run
java -jar project1-tester.jar
at a command prompt in the same directory as all your .sim files. This is the same autograder that Gradescope uses, but is much easier and faster to use.
7 Deliverables
Please submit the follow files:
tutorial1.sim
2.
tutorial2.sim
umbrella
3.
gates.sim
NOT, NAND, NOR, AND, OR
4.
muxes.sim
Decoder, MUX
5.
alu.sim
1-Bit Adder, 8-Bit Adder, 8-Bit ALU
storage.sim
fsm.sim
to Gradescope under the assignment “Project 1”.
Note: The autograder may not reflect your final grade on this assignment. We reserve the right to update the autograder as we see fit when grading.
8
8 Demos
This project will be demoed. The demos will be ten minutes long and will occur in the CS2110 TA lab
COC 104b.
Sign up for a demo time slot via Canvas before the beginning of the first demo slot. This is the only way you can ensure you will have a slot.
If you cannot attend any of the predetermined demo time slots, e-mail the Head TA before the beginning of the first demo slot.
If you know you are going to miss your demo, you can cancel your slot on Canvas with no penalty. However, you are not guaranteed another time slot. You cannot cancel your demo within 24 hours or else it will be counted as a missed demo.
Your overall project score will be ((project_score * 0.5) + (demo_score * 0.5)), meaning if you received a 90% on your project, but a 30% on the demo you would receive an overall score of 60%. If you miss your demo you will not receive any of these points and the maximum you can receive on the project is 50%.
You will be able to makeup one of your demos at the end of the semester for half credit.
This grading policy is harsh, but it ensures you understand your own project.
9 Rules and Regulations
9.1 General Rules
Although you may ask TAs for clarification, you are ultimately responsible for what you submit. This means that (in the case of demos) you should come prepared to explain to the TA how any piece of code you submitted works, even if you copied it from the book or read about it on the internet.
Please read the assignment in its entirety before asking questions.
Please start assignments early, and ask for help early. Do not email us the night the assignment is due with questions.
If you find any problems with the assignment it would be greatly appreciated if you reported them to the author (which can be found at the top of the assignment). Announcements will be posted if the assignment changes.
9.2 Submission Conventions
When preparing your submission you may either submit the files individually to Canvas/Gradescope or you may submit an archive (zip or tar.gz only please) of the files. Both ways (uploading raw files or an archive) are exactly equivalent, so choose whichever is most convenient for you.
Do not submit links to files. The autograder does not understand it, and we will not manually grade assignments submitted this way as it is easy to change the files after the submission period ends.
9
9.3 Submission Guidelines
You are responsible for turning in assignments on time. This includes allowing for unforeseen cir-cumstances. If you have an emergency let us know IN ADVANCE of the due time supplying documentation (i.e. note from the dean, doctor’s note, etc). Extensions will only be granted to those who contact us in advance of the deadline and no extensions will be made after the due date.
You are also responsible for ensuring that what you turned in is what you meant to turn in. After submitting you should be sure to download your submission into a brand new folder and test if it works. No excuses if you submit the wrong files, what you turn in is what we grade. In addition, your assignment must be turned in via Canvas/Gradescope. Under no circumstances whatsoever we will accept any email submission of an assignment. Note: if you were granted an extension you will still turn in the assignment over Canvas/Gradescope.
Projects turned in late receive zero credit. You alone are responsible for submitting your project before the assignment is due; neither Canvas/Gradescope, nor your flaky internet are to blame if you are unable to submit because you banked on your computer working up until 11:54PM. The penalty for submitting after the assignment is due is non-negotiable.
9.4 Syllabus Excerpt on Academic Misconduct
Academic misconduct is taken very seriously in this class.
Students are expected to have read and agreed to the Georgia Tech Honor Code, see http://osi.gatech.edu/content/honor-code.
Suspected plagiarism will be reported to the Division of Student Life office. It will be prosecuted to the full extent of Institute policies.
A student must submit an assignment or project as his/her own work (this is what is expected of the students).
Using code from GitHub, via Googling, from Stack Overflow, etc., is plagiarism and is not permitted. Do not publish your assignments on public repositories (i.e., accessible to other students). This is also a punishable offense.
Although discussion among the students through piazza and other means are encouraged, the sharing of work is plagiarism. If you are not sure about it, please ask a TA or stop by the instructor’s office during the office hours.
TAs and Instructor determine whether the project is plagiarized. Trust us, it is really easy to determine this....
9.5 Is collaboration allowed?
Collaboration is allowed on a high level, meaning that you may discuss design points and concepts relevant to the homework with your peers, share algorithms and pseudo-code, as well as help each other debug code. What you should not be doing, however, is pair programming where you collaborate with each other on a single instance of the code. Furthermore, sending an electronic copy of your homework to another student for them to look at and figure out what is wrong with their code is not an acceptable way to help them, because it is frequently the case that the recipient will simply modify the code and submit it as their own. Consider instead using a screen-sharing collaboration app, such as http://webex.gatech.edu, to help someone with debugging if you’re not in the same room.
10
11