CSE 171 Lab 4. October 6-8, 2003.Rev. A

EXPERIMENT 4: 2’s Complement 4-Bit Saturator


PRE-LAB

1.Study Sec. 6.2 Multiplexers and Demultiplexers and Sec. 6.5, Code Converters, pages 7-15 of the new Chapter 6.

2.Figure 1 shows a circuit that was described in the November 2001 issue of NASA Tech Briefs. Study the circuit to understand how it works. The circuit will take a 6-bit two’s complement number with a signed value between –32 and +31 and convert it to a 4-bit two’s complement number with a signed value between –8 and +7. Negative input values less than –8 will be saturated at –8. Positive input values greater than +7 will be saturated at +7.

3.Write an ABEL program called Sat4bit.abl. Use the declaration section shown in Figure 2 for your program. Complete the definitions in the declaration section as follows. Write equations for the fields A and B in terms of the input signals [X5..X0]. Write equations for the intermediate terms c1 and c0,then use these terms to derive an equation for the select terms.

4.In the equations section, write a multiplexer equation for the output Yin terms of A,B,and s. Display the value of Y on the units digit of the 7segment display (DS1) on the PLDT-3 board by using Y as the input to the 7segment decoder d7R declared above and equating the vector UnitsSegs to the output of d7R using the method described in the lecture module L6.7.

5.Complete the test vectors shown in Figure 3 and add them to your program. Save your ABEL program to your lab disk and print out a copy of the file.

6.Download the 7segment display decoder module, hex7seg.abl, from the class website to your lab disk and print out a copy of the file. Do not change the TITLE line of this file.

LAB

1.Create a folder called <your name>under C:\CSE171 on the computer you are using in the lab. Create a new project, Lab4, and add a copy of your ABEL source and a copy of the 7segment display decoder module, hex7seg.abl, using the Xilinx ISE Project Navigator as described in Labs 1 and 2. Syntax check, simulate, and compile your ABLE program and print out the BLIF Simulation Report and the Compiled Equations file. Note that there is no need to compile the hex7seg.abl module.

2.Connect the PC printer port cable to the PLDT-3 board, then connect the 9V DC power module. Double-click Configure Device (iMPACT) under the Generate Programming File process and download your program to the Xilinx chip. The PLDT-3 board should now function as a four-bit Saturator.

3.The right-most 6 toggle switches represent X5..X0 and the right-most 4 LEDs represent Y3..Y0. Set the toggle switches to each of the values for X5..X0 in the test vectors given in Figure 3 and observe the Y3..Y0 values displayed in the four red LEDs and on the 7-segment display. Record your observations in Table 1 below.

Table 1 – Experimental Observations

Test Values
(Decimal) / Toggle Switch
Settings (Binary) / Red LED Display Values / 7-Seg. Display
Values (Hex)
(Binary) / (Decimal)
-32
-24
-16
-9
-8
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
8
-15
-23
-31

4.Collect the following together with your name(s) on the front, demonstrate your design to your lab instructor and obtain his/her signature for your work.:

a.Sat4bit.abl listing.

b.BLIF Simulation Report listing.

c.Compiled Equations file listing.

d.Table 1 from Lab step 3.

5.For the lab report, explain how the circuit works for the inputs 001101, 000110, 111011, and 110110. What are the output values in each case in binary, hex, and decimal? How do the equations in the Compiled Equations file listing compare with the equations in your Sat4bit.abl listing? What does the equation for Y3 tell about the necessity to multiplex this bit? Explain.

6.Delete the directory C:\CSE171\<your name> that you created at the beginning of this lab.