Lab 09: Magnitude Comparator Circuit

Contents

Equipment/Parts Needed

  • PC (Altera Quartus II V9.1 installed)
  • DE-2 board

Objective

  • To build 1-bit and 2-bit Magnitude Comparator circuits using the Quartus II development software with the DE-2 board.
  • To test the design by downloading the file into the DE-2 board, exercising the inputs with toggle switches and observing 3 individual LED’s.

Discussion

  • A Magnitude Comparator compares one and two binary numbers and indicates whether the numbers are equal or which number is larger.
  • The Comparator will take inputs from 4 toggle switches (SW[0]~SW[3]) representing two 2 bit binary numbers and activate LEDG[0]~LEDG[3] in the DE-2 board.
  • The input numbers will be labeled A0, A1 and B0, B1 and the outputs will be labeled AeqB, AltB, and AgtB. The LED’s are activated under the following condition.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/table9-1.png?raw=true

Part 1: 1-bit Magnitude Comparator Circuit

1) Start the Quartus II software. Select File – New Project Wizard. And create a new project name under the directory C:\altera\91sp2\quartus\your last name\Lab9. You need to go through the step from 1 through 8 in the Part 1 of Lab6 manual. Don’t forget to create the folder Lab9 under the subfolder of your last name. Assign the project name Lab9_1, assign Cyclone II for the device family, and select the EP2C35F672C6 chip in the Family & device settings.

2) Open a New Block Diagram/Schematic file and draw the circuit for 1-bit Magnitude Comparator circuit in the Figure 9-1. And compile the circuit and correct all errors if you have any.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/figure9-1.png?raw=true

Figure 9-1 1-bit Magnitude Comparator Circuit.

3) Open a new Vector Waveform file and create waveforms A0 and B0 shown in Figure 8-1. And simulate the waveforms and analyze the output waveforms with respect to the inputs, and then complete the Truth table below.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/truthtable-1.png?raw=true

4) To program files and test it on DE-2 board, choose Assignment > Pins and then assign the pin numbers as shown in the tables below.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/pintable-1.png?raw=true

5) Save and compile the design again before programming. Then connect DE-2 board to computer. (If you’re not sure, refer to the Part 2 of Lab 7 manual.)

6) Now program the design and exercise the toggle switches and verify the proper LED is illuminated by filling in the table below. You need to show and explain it to your Instructor. (Remember that Input switches in the ON position mean a HIGH(1). Also remember that the DE-2 board has active-HIGH LEDs.)

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/LEDtable-1.png?raw=true

Part 2:2-bit Magnitude Comparator Circuit

1) For the part 2, you need create a new project name under the directory C:\altera\91sp2\quartus\your last name\Lab9. Assign the project name Lab9_2, assign Cyclone II for the device family, and select the EP2C35F672C6 chip in the Family & device settings.

2) Open a New Block Diagram/Schematic file and draw the circuit for 2-bit Magnitude Comparator circuit in the Figure 9-2. And compile the circuit and correct all errors if you have any.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/figure9-2.png?raw=true

Figure 9-2 2-bit Magnitude Comparator Circuit.

3) Open a new Vector Waveform file and create waveforms A0, A1, B0, and B1 shown in the circuit. And simulate the waveforms and analyze the output waveforms with respect to the inputs, and then complete the Truth table below.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/truthtable-2.png?raw=true

4) To program files and test it on DE-2 board, choose Assignment > Pins and then assign the pin numbers as shown in the tables below.

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/pintable-2.png?raw=true

5) Save and compile the design again before programming. Then connect DE-2 board to computer.

6) Now program the design and exercise the toggle switches and verify the proper LED is illuminated by filling in the table below. You need to show and explain it to your Instructor. (Remember that Input switches in the ON position mean a HIGH(1). Also remember that the DE-2 board has active-HIGH LEDs.)

https://github.com/jeremyseto/EMT-OER/blob/master/figures/1250L-Lab09/truthtable-3.png?raw=true

 

Questions/Report

  1. Include the schematics, vector waveforms, truth tables, and pin outs in the lab report.