CS 252 Lab 6, Fall 2011 • • LogicWorks due Wed. 12 October at 4:00 pm Writeup due Wed. 12 October at 4:00 PM Topics • Combinational logic building blocks LogicWorks Information For parts of this lab, we will be using the LogicWorks program, which can be found on the "CS Majors" Windows partition of the lab computers. See the LogicWorks information sheet for instructions Zip all of your LogicWorks answers into a single file named yourlastnameL6.zip, and email it to tia.watts@sonoma.edu with the subject line "CS252 Lab 6 submission". Please use this exact subject line. Writeup Do the following problems. You must show your work and explain your answers to get full credit. 1. [On Paper] Complete the following table (you may use a calculator.) All hex values should represent a 12 bit twos compliment binary value. A B 248 -248 248 -248 1980 -1980 1980 -1980 126 126 -126 -126 1626 1626 -1626 -1626 A+B A (hex) B (hex) A+B (hex) Final carry Overflow [LogicWorks (L6-1.cct)] Build an adder for signed 12-bit inputs that uses overflow detection. You should use only the components specified below, plus 6 hex keyboards for the input (3 for each of the two 12-bit inputs), and 3 hex displays for the 12 bits of output. Use only the following chips to build the adder (from the LogicWorks 7400devs.clf library): a. 7483 -- 4-bit binary full adder b. 7486 -- four 2-input XOR gates c. One AND gate You may want to follow these steps: a. Chain together three 7483 adders to make a 12-bit adder. b. Come up with test cases that exercise all of the possible input combinations (e.g. positive + positive, negative + negative, positive + negative, negative + positive, overflow, no overflow...). c. Attach probes to the outputs and check the results. Include an output (with a probe) that indicates signed overflow. 2. [LogicWorks (L6-2.cct)] Build a 1-bit signed full subtractor. That is, build a circuit that takes two 1-bit inputs X and Y and a borrow input bit and produces their1-bit signed difference D and a 1-bit signed overflow (borrow output) indicator. You may use AND, OR, NOT, XOR, NAND, and/or NOR gates, but you may not use any complex building blocks. 3. [LogicWorks (L6-3.cct)] Using 4 copies of the subtractor you implemented for problem 2, implement a four bit ripple subtractor. Use 2 hex keyboards for input (call one A and the other B), and 1 hex display and 1 binary probe for output. The hex display should be used to display the difference (A – B) and the binary probe should display the final borrow. 4. [LogicWorks(L6-4.cct)] Build a circuit that implements the following function (expressed in pseudocode). Assume that A is a 4-bit unsigned binary input (Use a hex keyboard), that B and C are 1-bit binary inputs, and that F is a 1-bit binary output. if (A equals 5) then F = BC else F = B'C' Suggestion: Use any of the methods we have discussed in class (Boolean Equations, Truth Tables, Karnaugh Maps, etc) to analyze the problem before building the circuit. Turn in your “on-paper analysis” for full credit. 5. Use Figure 5.20 from your book for this exercise. a. [On paper] Write Boolean equations for the outputs Q and Q’. b. [On paper] Analyze this latch by completing the following truth table. Ctrl D S R Q0 Q0’ Q1 Q1’ Q2 Q2’ c. [On paper] Summarize the actions of this latch by completing the following table: Ctrl D Q Q’ d. [LogicWorks (L6-5.cct)] Build and test this D latch. Use binary switches for D and Control. Use binary probes for R, S, Q, and Q’. Make sure that each of your inputs and outputs are visible on the timing panel. Test your latch using the following values for D and Control in the sequence illustrated in this table. D Control S R Q Q’ Initial 0 Initial 0 1 Initial 0 1 1 0 1 0 0 1 0 0 0 0 1 1 1