Docsity

Combinational Logic Circuits - Digital Logic Lab | EE 2731, Lab Reports of Electrical and Electronics Engineering

Partial preview of the text

Download Combinational Logic Circuits - Digital Logic Lab | EE 2731 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Rev. 01/

Digital Logic Design Laboratory

EE

Gabriel Augusto Marques Tarquinio de Souza

Department of Electrical and Computer Engineering Louisiana State University and Agricultural and Mechanical College Baton Rouge, LA 70803

ii

Administrative Policy of the Laboratory ....................................................................... iii Experiment 1 - Introduction to the Lab Equipment and the Programming of the Digilent XCR Plus Board Using Xilinx ISE Design Suite ............................................. 1 Experiment 2 - Combinational Logic Circuits ............................................................. 24 Experiment 3 – Creating Project Sources for Combinational Logic Circuit with Xilinx ISE 9.2 ................................................................................................................... 26 Experiment 4 - Flip-flops ................................................................................................ 34 Experiment 5 – Flip-Flops and Counters ...................................................................... 36 Experiment 6 – Shift Registers ...................................................................................... 46 Experiment 7 - Arithmetic Logic Unit .......................................................................... 48 Experiment 8 - Sequence Detector ................................................................................ 49 Experiment 9 - Traffic Light Controller ....................................................................... 50 Appendix A - Format of the Laboratory Report ......................................................... 52 Appendix B - Example of a Laboratory Report ........................................................... 53 Appendix C – List of available ICs in the laboratory .................................................. 56

iv

  1. There will be a one-hour final practical examination, consisting of a circuit you are expected to build, test, and demonstrate that it works. Every student will work alone on the final exam.
  2. You may choose to request partial credit for a laboratory project you may be having difficulty in completing. Note that after a grade is assigned to a laboratory project that grade will not be changed, in other words, you forfeit being able to make that project up.

Experiment 1 - Introduction to the Lab Equipment and

the Programming of the Digilent XCR Plus Board Using

Xilinx ISE Design Suite

The purpose of this experiment is to:

  • Introduce you to the lab equipment available for your use.
  • Show you how to program the Digilent XCR board using the Xilinx ISE Design Suite.

Each station has the following equipment:

  • C.A.D.E.T. II, Complete Analog/Digital Electronic Trainer, hereafter referred to as the trainer kit.
  • Multimeter.
  • Logic probe.
  • Chip extractor.
  • Wire cutter.
  • Plier.
  • Digilent XCR and Spartan 3E boards.

You will start with the trainer kit. Its front panel is divided into several sections that you will need to become familiar with. Read the instructions given below, carry them out, and answer all questions in the spaces provided below. Give your answers to the instructor before you leave the lab. Only one answer sheet per group is needed.

  1. Locate the power switch at the back of the trainer kit, and turn it on. The seven segments LED display at the bottom right corner of the trainer should be lit now.

  2. Locate the DC power supplies at the top right corner of the trainer kit, and use a multimeter, set to measure DC voltages, to check the output of the +5V supply. Write the value read in the space below.

5V DC supply: __________

  1. Locate the adjustment knobs for the variable DC supplies at the top end of the trainer kit. Use them to adjust the variable power supplies’ outputs and measure their minimum and maximum voltages. For each supply, write all values read below. Finally, adjust the output of both variable supplies, +V and –V, to output +5V and – 5V respectively.

Minimum +V: __________ Maximum +V: __________

Minimum -V: __________ Maximum -V: __________

  1. The logic switches, eight in all, are used to provide both a logic 0 output and logic 1 output to drive the circuits you will design and build. They provide a voltage of zero

Logic monitor No. Working (Y/N) Logic monitor No. Working (Y/N)





  1. Right below the logic indicators pane you will find the built in logic probe provided with the trainer kit. The probe contains an input socket labeled INPUT and VCC, three indicator LEDs, labeled PULSE, HI and LOW, and two switches, labeled MEM/PULSE, and TTL/CMOS. The MEM/PULSE switch is usually set in the PULSE position, and the MEM position is used when a pulse is too short to be seen with the PULSE indicator LED. The TTL/CMOS switch should be set to TTL, due to the fact we use TTL devices on all experiments. Make the following connections to test the logic probe:
  • To power the logic probe connect a wire from the +5V to the VCC input.
  • To provide a logic value for testing the logic probe, connect a wire from a logic switch to the INPUT of the logic probe. After the connections are made you should flip the logic switch between logic 0 and logic 1 and observe the logic indicator LEDs. Next you are going to test the other logic probe included with your toolbox. Connect the logic probe’s alligator clips to the terminals of the +5V power supply. The power connector of the logic probe are color coded, red (+) and black (-), to help identify the correct polarity. The probe has 3 indicators LEDs, and two switches that should be set the same way as the logic probe provided with the trainer kit. Indicate in your answer sheet, if the logic probes are working properly or not.

Trainer kit logic probe: ____________________

Other logic probe: ____________________

  1. Locate the functions generator pane at the upper left corner of the front panel. This generator provides sine, triangular, and square waves that can be used to drive clock inputs of the circuit you will design. In this lab you will only make use of square waves and they are continuously available from the TTL output, which is located on the leftmost two columns of the output socket. This output provides a square wave with a 50% duty cycle and can drive up to 10 TTL loads. From the remaining 6 columns you may get any waveform the function generator generates. The output frequency of the generator may be adjusted from 0.1Hz to 100KHz. Connect the input of the logic probes to the function generator’s TTL output, and then change the settings of the frequency knobs. Observe then describe the behavior of the logic probe’s LEDs below.
  1. Now you are going to check the two debounced pushbuttons switches, which are called pulsers, located below the Function Generator pane. Whenever you operate a mechanical switch, that switch will open and close several times before it stays in the intended position, open or close. This is called bouncing and it is a characteristic of that mechanical device. So using a mechanical switch, as is, to generate a pulse in a digital circuit, will in reality, generate a train of pulses, which is not the intended result. To correct this situation a debounce circuit is connected to the switches, thus removing the series of pulses generated by the mechanical action of the switch. The debounced switch generates a glitch free single pulse that can be used to clock sequential circuits, which will be needed when you single step through sequential circuits, either to demonstrate its functionality or to troubleshoot it. The debounce circuitry has an open collector outputs that can sink up to 250mA each. A pull up resistor with a value between 10 – 100K should be connected as shown in the diagram below. Each pushbutton can be used as a normally open or normally closed switch. Connect the circuits shown in the diagrams below, using a 10K resistor on both of them, then connect the Z output to the input of a logic probe. Perform the following steps: 1 – Observe the logic probe indicators 2 – Press and hold the pulser 3 - Observe the logic probe indicators 4 –Release the pulser 5 - Observe the logic probe indicators.

Discuss your observations and draw a timing diagram of the output waveform for both circuits in your answer sheet.

Output for binary value 1111: __________

  1. You will find the breadboard in the central part of the front panel. It consists of several socket connectors, some connected horizontally and some connected vertically. The figures on the next page show you how the sockets are connected internally.

  2. In this step you are going to learn to use the chip tester. First read all instructions given below then proceed to test the chip:

  • Get a 74LS11 from the parts bin.
  • Find the chip tester and turn it on.
  • Wait for the tester to go through its initialization procedure.
  • Set the socket’s lever vertical so that you may insert the chip on the socket.
  • Insert the chip in the ZIF - zero insertion force socket at lower end of the tester, making sure the chip is aligned with the bottom end of the socket and that pin one of the chip is set towards the top end.
  • Clamp the chip down by moving the lever to the horizontal position.
  • Press the search button, and verify that the display correctly indicates the chip’s number, in your case 74:011.
  • Press the test button, and a message indicating the if the chip is good or bad is shown.
  1. Now you will wire and test an IC. Any time you are wiring a circuit or modifying it in any way, make sure the circuit is not energized. Turn the trainer’s power switch off. Use the 74LS11 (triple 3-input AND gates) IC you tested in step 11, and connect the gate’s inputs to the logic switches, the outputs to the logic monitors, and the supply pins to the 5V power supply. You can obtain the correct pin diagram for the 74LS11 from the EE2731 website or you can Google it. Power the trainer up and then verify if all the gates in the 74LS11 are working properly. Practice how to use the chip extractor to remove the chip from the breadboard without bending or breaking their pins. Confirm your observations by using the chip tester to re-verify if the chip is working properly. Return all parts and tools to their proper places, and then clean your station.

Programming the XCR Plus Board

This tutorial will introduce you to the programming of CPLDs – Complex Programmable Logic Devices and FPGAs - Field programmable Gate arrays, using the ISE software from Xilinx.

CPLDs and FPGAs are different than traditional ICs, due to the fact they are reconfigurable devices, i.e. their internal interconnections between gates are reprogrammable. You will learn how to use the ISE Suite to reprogram these internal connections so as to create a circuit that will behave in a way your design intends it to behave. Xilinx ISE 9.1 is the design tool you will be using for this purpose, but Xilinx also makes a free version of this tool, called Webpack, which you should download and install on your computer so that you may practice creating and simulating your own design at home. This experiment will require the XCR Plus board available for your use in the laboratory. If you desire to purchase a board of your own there are many versions available, some starting as low as $17.00.

Some of the ICs on the boards you will be using are very sensitive to electrostatic discharge, so please avoid putting your fingers on the chips, as not to damage them. Your cooperation on this matter is very appreciated.

Designing a circuit to be programmed onto a CPLD or FPGA will involve 4 steps:

  1. Design – The description of the circuit created by using schematic capture or HDL – Hardware Descriptor Language code, or other means. This step also involves the simulation of your design, to check its correctness.

Creating a New Project

Select File Menu → New Project from project navigator, then, name the project “Exp_1”. When naming your own projects, avoid using spaces in the project name as they are not allowed. Place the project at Z:\Exp_1. Do not save the experiment to the hard drive of the computer you are using, save it instead to the network drive available to you or to a removable drive. Make sure you abide by what was requested above, otherwise someone will be able to read the experiment files you created. Placing the project at a different location is as easy as typing the file path into Project Location or by searching for the location through the use of the Three-dotted Browse button. The location of the project can always be seen on the top of the Project Navigator screen.

Select HDL for top-level source type.

Note: The address shown in the picture above is not the one you will save your project to.

Click Next and the device properties window will be shown. Make sure the contents of your device property window is exactly the same as the one shown in the picture below.

Click Next → Next → Next → Finish , and a blank project will be created.

Adding Sources to the Project

The three source files you will need for this experiment have already been created for you, and they have been made available to you in file created Moodle. They are:

Exp_1.v – the Verilog description of the circuit. Exp_1.ucf – the pin assignments. Exp_1_tb.vhd – the test bench (this one is written in VHDL, but it can also be created by using the new source wizard and selecting Test Bench Waveform ).

It is common practice, when naming test benches, to append “_tb” to the file name.

Copy these files to the directory you created above, then add the sources to the project by right clicking into the Sources pane and selecting Add Source from the menu that will open.

  1. The green check marks identify that the program knows what type of files they are and have accepted them. The Exp_1.v file can be used for Synthesis, Implementation and Simulation. The Exp_1.ucf constraint file is used to assign circuit signals to the CPLD’s pins during implementation. The Exp_1_tb.vhd test bench file can only be used for simulation. Click Okay to finish adding the sources to the project.

Design Simulation

The Sources and Processes panes are the sections of the screen where most work you will be doing will take place. They are identifies on the picture shown below.

In the Sources tab, a tree structure is displayed. If you click on the “+” symbol the ucf file will be shown.

  1. In the Sources window, the tree structure is again seen. Select Behavioral Simulation from the drop down menu and this time, the source file is shown as a child to the testbench file, Exp_1_tb.vhd. Double click the Exp_1_tb.vhd file to see its contents. Highlight the testbench file and double-click on the “Simulate Behavioral Model” icon in the processes box.

Viewing Testbench

  1. The ISE simulator will launch. Change the time for each simulation run to 10 ns. Once this is done, click once on the run button

Changing Sim Time

  1. One may zoom in or out by using the zoom in and zoom out icons. They look like magnifying glasses with a + and – inside of them. Expand the waveforms. By scrolling back and forth, you can see what combinations of inputs cause a high on the output.

Simulation Waveform

  1. Close simulation In the drop down section of the sources pane, choose Implementation. The source file is used to describe the behavior of the hardware.