CSE 352 Laboratory Assignment 1
Logistics / Constructing Simple Logic Circuits
Apr. 5, 2013
Due: Beginning of Lab Section next week
Read the whole lab first before
starting on any work. This lab starts with the preliminaries; signing out your lab kits and
making sure you can log in to the lab computers and start the software you’ll
be using this quarter. We then introduce
you to Altera’s Terasic DE1 prototyping board and our primary design tool this
quarter - both for schematic entry (drawing circuits) and simulating them
(verifying that they will operate correctly when we wire them up) - Aldec's
Active- HDL. 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.
In this assignment you will learn
how to do both schematic entry and simulation for some basic circuits. As you
gain more practice with Active-HDL, we will expect you to use this tool to do a
large part of your written assignments throughout the quarter. This means, you
will see Active-HDL assignments incorporated into your homework, so don’t skimp
on these labs, they’re important!
By the end of this lab you should feel comfortable entering a schematic for a design, setting up simulation stimuli, and verifying that your circuit is correct. The overall goal for this lab will be to construct a circuit which performs the Boolean logic function you derive. Of course, the circuit will be able to use only the chips provided for you. By the end of this lab you should know how to construct and verify the operation of a small circuit (3-6 logic gates) in both Active-HDL and on your prototyping board using switches and LEDs as I/O devices.
If you have any questions at any point in the lab, make sure you have read the entire lab thoroughly, and ask a TA if you still cannot find the answer. There are no dumb questions: please ask your TAs if you have any doubt, especially before you try something that might damage any of the expensive hardware that is provided for you!
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 that should inserted and removed from the solder-less bread-board – the white rectangle will all the holes – with extra care.
Your Design Kit contains:
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 a very large current that can quickly destroy 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 and not your fingers.
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.
FPGA is short for Field Programmable Gate Array. Essentially it is a large array of logical elements that have been connected together. What makes the FPGA unique is that the connections between these logical elements can be programmed, which means the FPGA can be used to build many different kinds of hardware all on the same chip. If you look at the HEX display on the bottom left hand corner of your DE1 board you will see that it has a scrolling message that says CSE 370. This is a program that the TAs have written and programmed into your FPGA’s non-volatile memory. By programming into the non-volatile memory, each time the board is turned on the CSE 370 program will be loaded, regardless of what you did previously.
The image is a zoomed-in picture of the connector strip, which gives access to signals on the board. As you can see, each little hole has a corresponding pin mapping (more on this in later labs) and a pre-wired connection to a switch, key or LED on the board. Remember the program that the TA’s put in the non-volatile memory mentioned above? Well in addition to having the HEX display scroll CSE 370, the program also wires these holes to the indicated switches, keys, or LEDs. So for example, if you connect the hole labeled "A13 SW9" to the hole labeled "D21 LEDR9" with a wire, you would control the red led labeled LEDR9 on the DE1 board with the switch labeled SW9.
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) – we will always use this convention with all our circuits. 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 43 columns of holes both above and below an indented divider. All 5 holes in one column are connected; however, the column of 5 holes above the divider is not connected to the column of 5 holes below the divider. All of these connections are internal to 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 (+5v) running across them.
Attaching your Solder-Less Bread Board to the Prototyping Board
You will now need to plug the solder-less breadboard into the prototyping board. Turn off the power first! As depicted above, you should plug the bread board connector which is on the bottom of the right-hand side of the bread board circuit into Expansion Header 1(JP1) (the left one) on the Altera Terasic DE1 Prototyping Board. Make certain that this is properly aligned before you press it in. Note: It is very easy to mis-align the connectors by one pin from front to back. To make sure that everything is properly aligned, take a look from the side at how the pins from the bread board meet the Expansion Header. They should be entirely within the outer edge of the Expansion Header. If everything is correctly aligned the green LED on the breadboard should light up.
Wiring your Solder-Less Bread Board
Make sure that ends of your wires
have the right amount of bare wire (3/8 – 1/2 inch) and that it is straight and
without any nicks. If in doubt, cut off
the end and re-strip the wire end, making sure to use the right hole of the
wire stripper so you don’t nick the wire, which can lead to the wire breaking
off in the breadboard. 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 breadboard (at great cost). If you need more wire help yourself to the provided spools of uncut wire at the front of the lab.
Before doing any work on the breadboard 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 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.
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.
Read This, this can simplify later labs. 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? Consider 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 prototyping board you can use them instead for a NOT gate instead of digging out your other NOT chip.
Just click “Next”.
Spash screen, no action required.
If you get this screen, click cancel. This setting gets reset when you log out.
Just click “OK”.
Type in “lab0” for the “workspace name” and then click “OK”.
Just click “Next” again.
Make sure the “Default HDL Language” is set to “Verilog” (it may start up with “VHDL”). Click “Next”.
Type in “lab0test” (make sure not to use any punctuation in the name) for the “design name” and then click “Next”.
Just click “Finish”.
You’ve successfully started up the Aldec tool if you’ve reached this point. You can now quit Active-HDL.
that we ask you to store your files on your own space on the Z: drive because
the lab machines are returned to a pristine state after every user logs
out. Make sure to not store any files
you care about locally – they will be lost, and always log out when you leave
Once Active-HDL is open and you have created your first workspace/design, click on the library button, then click the "Attach Library" button. Finally, go to where you extracted lib370.lib and select it.
There is a fuse and an indicator light on your prototyping board. If you do accidentally wire up GND to VDD, you will mostly likely blow the fuse "F1" and the light "L1" will go off.
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 wire you plugged into VDD, and the black clip to the black wire you plugged into Ground. Make sure the Logic Probe is set to use TTL.
Connect a wire from the hole that corresponds with a switch to a 5-hole column on your breadboard. Now that 5-hole column is connected to the switch, plug another wire into the same 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 you’re connected VDD and Ground properly on the logic probe and you didn’t 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’re unsuccessful, call over a TA.
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.
your very first chip. We refer to the chip packages by the last two or three
numbers in the long string of characters printed on the top of the chip. Find the '04 inverter packaged chip and
insert it into the empty region straddling the divider on the breadboard. 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 to determine the orientation of inputs and outputs for any of the chips we have provided for you is to look at the chip maps. 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 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 should be 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. Make sure to have a TA do a check-off for this stage.
Lab Demonstration/Turn-In Requirements
A TA needs to "Check You Off" for each of the tasks listed below.