DOC PREVIEW
Princeton COS 116 - Lab 7

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

COS 116 – Lab 7 1COS 116 The Computational UniverseLaboratory 7: Digital Logic IIIn this lab you’ll learn that, using only AND, OR, and NOT gates, you can build a circuitthat can add two numbers.If you get stuck at any point, feel free to discuss the problem with another student or aTA. However, you are not allowed to copy another student’s answers.Hand in your lab report at the beginning of lecture on Tuesday, April 8. Includeresponses to questions printed in bold. (Number them by Part and Step.)This lab will be done entirely in Logisim. You can install Logisim by clicking thislink: http://www.cs.princeton.edu/courses/archive/spring08/cos116/lab7_files/logisim.exeWhen prompted, save the file to the Desktop. After the download completes, double-clicklogisim.exe. (If you are warned that this program may be unsafe, click “Run” and “Ok”as needed.)Part 1: Odd-Parity CircuitThe first step in creating an adder is building a three-input odd-parity circuit. The outputof an odd-parity circuit is TRUE if and only if an odd number of its inputs are TRUE.The truth table for a three-input odd-parity circuit is:ABCOutput00000011010101101001101011001111COS 116 – Lab 7 2To be able to build a circuit from a truth table, you must first convert the truth table to aBoolean formula using a technique called sum-of-products. Sum-of-products is bestexplained by example. Suppose you had the following truth table:ABOutput000011101110The steps of the sum-of-products technique are: i. Identify the combinations of input values (rows of the truth table) that make theoutput TRUE.ABOutput000011101110 ii. For each combination of input values, create a Boolean formula that is TRUE ifand only if the inputs have those particular values. In this case, there are twocombinations of input values that make the output TRUE yielding two formulas:€ A • B ; € A • B iii. Take the formulas that you created in step 2 and OR them together to form asingle formula representing the truth table:€ A • B + A • BIn English, this formula means that the output of the function is TRUE if either Ais FALSE and B is TRUE or if A is TRUE and B is FALSE.1. Now that you know how to convert truth tables to Boolean formulas, derive aBoolean formula for the three-input odd-parity circuit.2. Construct the three-input odd-parity circuit in Logisim. There should bethree inputs and one output. For this lab, you may use AND and OR gateswith more than two inputs.3. Label the inputs ‘A’, ‘B’, and ‘C’ and the output ‘Out’. To label an input oroutput, switch to the arrow tool and then click on the input or output. A listCOS 116 – Lab 7 3of attributes for the object will appear in the lower left corner of the window.Edit the ‘Label’ attribute and press return when done.4. Name the circuit. Since you’ll be using it later, you need to give the circuit aname. In the list on the left, right-click on the item labeled ‘main’ and select‘Rename Circuit…’ Give the circuit the name ‘odd-parity’.5. Verify that the circuit you built matches the truth table for a three-inputodd-parity circuit.6. Save the file by going to File > Save. Name the file ‘odd-parity.circ’.7. Save a picture of your circuit to hand in with your lab report. There are afew ways to do this. Here is a simple method:a. Click anywhere in the window of the Logisim program, and pressAlt+PrintScreen. This takes a “snapshot” of the active window.b. Open a new Word document, and press Ctrl+V. This copies your snapshotinto the document.COS 116 – Lab 7 4Part 2: 1-bit AdderComputers perform addition using the same method that you learned in grade school –adding the two input numbers one column at a time starting on the right and carrying aone as needed. For example, to compute 7+6=13, a computer does:1100Carries0111Input A (7)+0110Input B (6)1101Sum (13)Consider one column of this addition:1100Carries0111Input A (7)+0110Input B (6)1101Sum (13)You can view it as a circuit with three inputs• A – one bit from the first input number• B – one bit from the second input number• CarryIn – a bit which is 1 if the we are carrying a one over from the previouscolumnand two outputs• Sum – one bit of the sum• CarryOut – a bit which is 1 if we are carrying a one over to the next columnABCarryInSumCarryOutCOS 116 – Lab 7 5A circuit to compute a single column of an addition is called a 1-bit adder.1. Fill in the truth table for a 1-bit adder and include it in your lab report:ABCarryInSumCarryOut000001010011100101110111It turns out that the circuits that you’ve built so far in this lab and the previous one –majority and odd-parity – are enough to implement a 1-bit adder. Examine the truth tablefor a 1-bit adder.2. Which of the circuits that you’ve already built (majority or odd-parity) canbe used to compute the ‘Sum’ output of the adder and which can be used tocompute the ‘CarryOut’ output?For reference, the truth table of the three-input majority circuit is:ABCOutput000000100100011110001011110111113. Now you’ll build a 1-bit adder. Download our pre-built majority circuit byclicking this link:http://www.cs.princeton.edu/courses/archive/spring08/cos116/lab7_files/majority.circWhen prompted, save the file to a location that you can remember. If you are notprompted to save the file and instead see text in the Web browser window, selectFile > Save As… in the Web browser.COS 116 – Lab 7 64. Create a new circuit file in Logisim by going to File > New.5. Import our majority subcircuit and your odd-parity subcircuit into the newcircuit file. To import a circuit into the file, go to Project > Load Library >Logisim Library… and then navigate to file containing the subcircuit thatyou want to import. The files that you’ll need to import should be named‘majority.circ’ and ‘odd-parity.circ’.6. Once the two subcircuits have been imported, you should see two new foldersnamed ‘majority’ and ‘odd-parity’ in the column on the left. Click on the ‘+’signs next to them to see the circuits themselves. You can click on thesesubcircuits to select them and then click anywhere in the dotted field to placethem in your new circuit.Unfortunately, when you place one of the subcircuits in the dotted field, it justshows up as an unlabeled box. However, there are little blue dots on the boxindicating the locations of the subcircuit’s input and output connectors. The inputconnectors are


View Full Document

Princeton COS 116 - Lab 7

Documents in this Course
Lecture 5

Lecture 5

15 pages

lecture 7

lecture 7

22 pages

Lecture

Lecture

32 pages

Lecture

Lecture

16 pages

Midterm

Midterm

2 pages

Lecture

Lecture

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

24 pages

Lecture

Lecture

22 pages

Lecture

Lecture

28 pages

Lecture

Lecture

21 pages

Lecture

Lecture

50 pages

Lecture

Lecture

19 pages

Lecture

Lecture

28 pages

Lecture

Lecture

32 pages

Lecture

Lecture

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

19 pages

Lecture

Lecture

22 pages

Lecture

Lecture

21 pages

Logic

Logic

20 pages

Lecture

Lecture

25 pages

Lecture 2

Lecture 2

25 pages

lecture 8

lecture 8

19 pages

Midterm

Midterm

5 pages

Lecture

Lecture

26 pages

Lecture

Lecture

29 pages

Lecture

Lecture

40 pages

Lecture 3

Lecture 3

37 pages

lecture 3

lecture 3

23 pages

lecture 3

lecture 3

20 pages

Lecture

Lecture

21 pages

Lecture

Lecture

24 pages

Lecture

Lecture

19 pages

Load more
Download Lab 7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?