CSE 370 Introductory Laboratory Assignment

Constructing Simple Logic Circuits


Assigned: Monday, October 1, 2007
Due: End of Lab Section


Objectives

The first lab for CSE 370 will introduce you to the Altera’s Terasic DE1 prototyping board and our primary design tool this quarter, Aldec's Active- HDL 7.2. Both of these components are very important for all future labs so please pay attention and do not rush through this first lab. Though we typically encourage you to work together, it is recommended you do this lab individually to gain the full benefits of the lab.

If you have any questions at any point in the lab, please do not hesitate to call over one of us, your TAs to assist you. And as always, there are no dumb questions, please ask them, you don’t want to damage any of the expensive hardware that is provided for you.

Tasks

  1. Complete the introductory tutorial to Aldec’s Active-HDL 6.2. The version is slightly older, but the software has remained very much the same. Ask your TAs if you have any questions about any of the steps in the tutorial. At the end of the tutorial you should have a "Block Diagram Schematic" with an AND and OR gate from the "lib370" part library and simulated the circuit for all possible values. Your TA will need to check this waveform, so leave it open or save it somewhere.

  2. Construct and verify the operation of a small circuit (1-2 logic gates) using switches and LEDs as I/O (Input/Output) devices. The gates to use will be described for you in detail later on in the lab.

Laboratory Design Kits

The design kits contain everything you need to construct most of the circuits assigned to you over the course of the quarter. You are responsible for your lab kit and we expect that you will return the kit in good working order with all pieces intact. This especially applies to the chips, which have very delicate pins. Use care when extracting them from the solder-less breadboard. Please make sure all of the above are provided for you in your kit. We will provide additional materials later on in the quarter if they are necessary to complete a lab.

We are aware that accidents can happen and the pins on chips may already been weakened from years of use. Typically if you break a pin the chip will be replaced and the damage will be forgiven; however in cases of gross negligence you will have to pay for a replacement. Take care not to Short out your board by connecting Ground to Power. This results in infinite current which can quickly burn all the components of the board including the board itself. Finally be careful not to snap off wires inside the I/O connectors or the holes in the solder-less breadboard. Wires are best extracted with the needle-nosed pliers.

Altera Terasic DE1 Prototyping Board


The picture above is a diagram of the prototyping board with most of the major components highlighted. For the first few labs you will be using the various input/output devices located directly on the board such as the switches and LEDs. Further details will be provided in each lab. Take note of the large FPGA (Field Programmable Gate Array) that is highlighted on the board. Later on in the quarter you will be programming this and directly interfacing with all the devices on the board. Think of it like a CPU that all the devices can talk to. For now there is a program loaded into the FPGA to allow you to use the Input/Output connectors on the board to make the earlier labs easier.

The Solder-Less Bread Board

The solder-less breadboard attached to your prototyping board is where you will be building all of your circuits. Notice the red and black wires going to each of the rows at the top and bottom of the board. The red wire denotes VDD (+5 Volts) and the black wire denotes Ground (0 Volts) Never directly connect these two rows together in any way. You should have both a VDD and Ground at the top of your board and a set at the bottom. Even though there are spaces between the rows all of the holes are directly connected to each other. This means you have rails of VDD and Ground both at the top and bottom of your board.

In addition to the rails of VDD and Ground provided for you on the board there are two 43 column holes separated by an indented divider. All 5 holes in one column are connected to each other, however the column on the top of the divider is not connected to the column below the divider. All of these connections are underneath the board so you cannot see them. So remember, if you connect VDD into one of the five holes in a column, all five holes now have VDD running across them.


The red line marks where VDD runs across the board, and the black line marks were GND runs across the board. The holes on the board are interconnected as the blue line shows, up-and-down for each 5 hole segment. Make sure you understand this picture! Red Line = VDD, Black Line = GND, Blue Line = 5 hole column.

Wiring your Solder-Less Bread Board

Wires should be inserted as perpendicular as possible to the breadboard and should slide in and out with just a little force. If you find that there is a lot of resistance in either direction, first review the wiring guidelines below, and if that doesn't work, then please call over the TA or one of the lab staff.

Do not try to force anything larger than stripped wires into the holes, because this could damage the protoboard (at great cost). If you need more wire help yourself to the provided spools of uncut wire in the back of lab.

Before doing any work on the protoboard such as wiring and inserting/removing chips, be sure the power is OFF. That is, unplug the power connector while you are constructing the circuit. After you have finished wiring up your design and before you turn on the power, double check the power and ground connections.

Wiring Guidelines

Wiring your circuit together can often feel tedious, especially in the beginning. However, if you are patient and wire your circuit nicely, you will find that you will spend a lot less time tracking down wiring errors. To aid you in this, here are a few tips to consider while wiring up your circuit. If anything is unclear, ask your TA for an example. For those of you that learn better by seeing, here is a good wiring example and a bad wiring example.

Using the Logic Probe

The logic probe provides a very convenient way to check the value of any signal in your circuit. The probe has two lights, HI and LO, which indicate the value of the signal. The logic probe responds to the input voltage in two ways depending on whether CMOS or TTL is selected. We will use the TTL setting which lights the LO (Logical 0) light for voltages <0.8v. and lights the HI (Logical 1) light for voltages >2.3v. If neither light is lit, then the signal is floating (i.e. not being driven by any active output) or has some value between 0.8 and 2.3v.

Assigned Tasks

  1. Use your logic probe to determine in which position the switches provide a 0 or 1. The output of the switches can be found on the I/O connector on your protoyping board below your breadboard. Check the I/O Mapping to see which outputs are the switches.

    To use your Logic Probe, first your logic probe needs power. Make sure your DE1 Prototyping board is off and plug in a red wire into one of the VDD rails. Then plug a black wire into one of the Ground rails. Remember, these rails are located at the top and bottom of your board, you can tell which rail is which by looking at the color of the wire connected to the rail. Red being VDD and Black being Ground. Be Careful that you never let a wire connected to VDD touch a wire connected to Ground or you will short out your board. If that ever happens, or you smell odor/see smoke, turn off your DE1 board immediately and pull the power.

    There is a fuse (F1) and an indicator light (L1) on your prototyping board. This light should be ON at all times when the board is on. If it ever goes off, you have accidentally done something wrong, call over a TA!

    We will now use the logic probe to determine the value of a switch. Power up your Logic Probe by connecting the red clip to the red VDD wire you plugged in, and the black clip to the black Ground wire you plugged in. Make sure the Logic Probe is set to use TTL.

    Finally use the I/O Mapping to figure out which connector is connected to a switch. Connect a wire to that connector and a 5-hole column on your breadboard. Now that 5-hole column is connected to the switch. Plug another wire into the 5-hole column, this will be your test wire. Usually you can just press the logic probe gently against the holes to read a value, but it is often more accurate to use a test wire.

    Turn on the power now and check the value on your test wire by pressing the tip of the logic probe to the exposed wire. The plastic insulation on the outside won't give you a value, you need to touch metal to metal. If your logic probe doesn't respond, make sure your connected VDD and Ground properly on the logic probe and you did not make any wiring mistakes. Your Logic Probe should either light up "HI" or "LO". Flip the switch a few times to check the responsiveness and to make sure you are getting an accurate reading. If you do not have any success, call over a TA.

  2. Connect a switch to an LED
    Once again, turn off the power before making any connections. We won't repeat this again, but you should always remove power before making any wiring changes and only reconnect it after you've double-checked that you've wired things correctly.
    You can connect a switch and LED directly by placing a wire between Switch 1 and LED 1 on the I/O Connector. Be sure to check the I/O Mapping to see which hole corresponds to Switch 1 and which hole corresponds to LED 1. At this point it doesn't matter if you want to use a different LED. Reconnect the power after everything is wired and make sure the LED responds to the switch correctly.

  3. Place an inverter (NOT gate) between the switch and LED.
    This is your very first chip, insert the '04 inverter packaged chip into the empty region straddling the divider on the breadboard. To find the chip you should squint and try to see the little numbers and letters etched onto the chip. Typically you will see a long sequence of letters and numbers such as "C74######04#", where the # stands for random letters and numbers. These random letters and numbers usually denotes what manufacturer made the chip so you shouldn't worry about it. When looking for the chip you want to look toward the end of the sequence of numbers and letters for the '04 or the '20, or any other chip you are looking for. Each pin of the chip is now connected to a 5-hole column on the breadboard. Be sure to wire up VDD and Ground, chips need power in order to function, and if you don't provide them with a ground, they won't function correctly. Make sure you connect the right pins, Ground is pin 7 and VDD is pin 14 on the '04 chip.

    The best way is to look at the chip maps to determine the orientation and chip inputs and outputs for any of the chips we have provided for you. The best way to double check your orientation is to look at the little half circle notch in the chip that is both on the chip map and on your chip. As long as you orienate that little half circle notch the right direction (left or right) to match the chip map, you will be fine. This '04 Chip has 6 inverters in one package, pick one of them to use and hook up the switch's wire to one of the inputs and hook up the output of the chip for that particular input to the LED. Now turn on the the power and flip the switch a few times. Does it behave correctly? Does the LED turn on when the switch is "Off" and turn off when the switch is "on"?

    Finally, to make sure that inverter is really doing what it is doing, turn off the power to the board. Now take the wire that used to go to the LED and wire it to the input of another inverter located on the chip. Now wire the output of that input to the LED. Turn on the board and check to make sure that the inverter is behaving as expected. Is the LED now following the switch? Turning on when the switch is "On" and turning off when the switch is "Off?" It should do that because two NOTs would logically cancel.

  4. Connect a two-input NOR gate to two switches and one LED. We won't give you detailed explanations on how to do this final task, however you should be able to apply your knowledge from the pervious tasks to complete this one. Think about how a NOR gate works and see if you can find all four combinations. The TAs will need to check you off for this. Finally if you aren’t sure which chip is the NOR chip, look at your chip map.

Duplicating NOT Gate Behavior

Now that you have begun to use NOT and NOR gates did, you know there are ways to duplicate the behavior of a NOT gate with a NOR or NAND gate? Conside the two logic tables below: Notice what happens when drive both the inputs of a NOR Gate with the same output, it acts like a NOT gate. The same applies for an NAND gate, when you drive both of the inputs of a NAND gate with the same signal it acts like a NOT gate as well. Now if you are short an inverter, but you have NANDs and NORs on your protoyping board you can use them instead for a NOT Gate instead of digging out your other NOT chip.
NOT GATENOR GATENAND GATE
ABResult
0N/A1
1N/A0
ABResult
001
010
100
110
ABResult
001
011
101
110

Lab Demonstration/Turn-In Requirements

A TA needs to "Check You Off" for each of the tasks listed below.
  1. Show your simulation ouput (Waveform) of the AND and OR gates from Active-HDL.
  2. Demonstrate your working NOT or Double NOT gate and NOR gate to your TA.

Comments to:cse370- webmaster@cs.washington.edu