CSE467: Advanced Logic Design
Carl Ebeling, Winter 1999
Introduction Xilinx Foundation: Schematic Capture and Simulation
Distributed: Jan. 8 - Due: Jan. 15
When you have completed this lab, you will know how to:
For this lab assignment, you should work on your own so that you all
get to know the tools well. You can do this lab anytime, but doing it
during the regular lab time is a good idea because we'll be around to help.
Create a new project or open an old project in Foundation.
Draw schematics for a simple circuit using hierarchy.
Simulate a combinational circuit using the Foundation simulator.
View and print the simulation results.
Print schematics and programs.
You should already have an account on the NT workstations. This will
allow you to login from any workstation, including those in the
hardware lab (Sieg 327). Make sure you are using a good password, and
to protect your work, remember to logout when leaving the lab.
I will assume that you are familiar with using NT from your 370
experience. If you have any problems or need a refresher, please let
The CAD tool that we'll be using this quarter is from Xilinx and is called
Foundation. The main tool from which all the other tools are called is
called Foundation Project Manager. From here you can fire up the schematic
editor, simulator, state machine editor, and the tool that maps the design
to the Xilinx FPGA. The Foundation software should be loaded in the
hardware lab (Sieg 327), and in the PC labs (Sieg 232 and 329). In this
lab, you will run through a tutorial from Xilinx, and then use the tools
to create a small design of your own.
The Xilinx Tutorial
The first step is to start up the Xilinx Project Manager. You can find a
link on the Windows Start menu, under Programs -> Xilinx Foundation Series
-> Xilinx Foundation Project Manager.
The Quick Start tutorial that we are handing out describes how to
build a project using schematics. This tutorial will introduce you to
the Foundation software by walking you through the design of a simple
project to drive seven-segment displays on a Xilinx evaluation
board. It includes a counter that drives a bar of lights back and
forth, and a hex to seven-segment driver that drives the seven segment
display on the evaluation board. It turns out that our Xilinx boards
are not the evaluation boards that are targeted in this tutorial, but
it will still give you a good introduction to the tools even if we
can't map it directly to hardware. (Our Xilinx boards are slightly
different and I'll hand out a lot more details of this board a little
later in the quarter)
Start working through the Quick Start guide you received. This tutorial
will help familiarize you with the various components of the Xilinx
Here are some notes you'll want to keep in mind when running through the
When you get to 4-29, skip the parts on designing the state machine
and the HEX2LED macro. S ince we are not going to be designing the
state machine or using VHDL as in the tutorial, we will just steal
these macros from another project. Here's how:
- Ignore the first part of the tutorial that talks about
installation. Read it, but start working at the bottom of page 4-3.
- There's an error early in the tutorial --- the example projects are
located in a different directory than the one given in the tutorial. It
should say D:\Xilinx\Active\Projects\.
- Make sure you use the Copy Project command instead of just copying all
the files to another directory -- otherwise it probably won't work!
And make sure you copy to your own directory.
- In the menu at the top of the SC Symbols window, click on the rightmost
button, which brings up the Project Libraries window. Now click on the
Libraries button, which brings up the Library Manager. This lists the
libraries "attached" to your project. We will attach the complete project
as a library which allows us to use the macros for the state machine and the
HEX2LED macro, instead of using the state machine editor and VHDL. Later on
we will be learning how to use Verilog to implement components.
- Attach a library by using the Library->Attach menu selection. This will
bring up a browsing window. Go to the Active\Projects\Watch_sc\Lib folder.
The watch_sc entry should appear highlighted in the Libraries window. Now
click OK, and this library should now appear in the list under Attached
Libraries. Now select watch_sc and Add it to the Project Libraries. This
should close the windows and your SC Symbols window should have this new
library with the macros we need.
- You can now select the STMACH_V and HEX2LED symbols and place them as it
says in the tutorial.
There is one very useful feature of the simulation tools that
really isn't covered well in the tutorial, and that is the use of
simulation scripts. When using a simulation script, you write a set of
test cases, and then the simulation tools can automatically check that
your design is correct (at least in terms of your simulation script),
saving you a lot of work. This can be much easier than the "traditional"
method of providing stimuli and checking waveforms by hand each time you
change your design! For this reason, we'd like you to use simulation
scripts for the majority of your testing this quarter (or at least for
what you turn-in).
The easiest way to learn how to write script files is to look at some
examples. A couple of example you should find useful are
this template script and
this well-commented example script. Skim
through both scripts, and more than anything read the comments.
The template script contains sections for most of the important script
commands you'll be using, while the second script contains a lot more
When you're (eventually) ready to create your own script file, you need to
select Tools -> Script Editor from the simulator. To execute a script
file, you need to choose File -> Run Script File (again from the
After you've finished looking over the example scripts, go into the Script
Editor, and select Help -> SIM Macros Help ; then click on the Help Topics
button. This is the reference guide for all the commands you can use in
your script. If you ever need more detailed information about a command,
this is the place to look. Take a moment to look-up some of the commands
that were used in the template file, such as the check,
assign, and cycle commands.
Design and Test a Simple Circuit
The design project for this first lab assignment is to implement the
"counting" circuit we covered in lecture. This circuit will take 8
inputs and generate two outputs, TWO and THREE which are asserted if
exactly two or three inputs are on.
First design a full-adder using gates (AND, OR, NAND, NOR, XOR) from
the Xilinx library. Do this by creating a macro (P. 4-13) and using a
schematic to describe its implementation.
Now, in the top-level schematic, combine a set of full-adders together
to implement the circuit. You will need to add some gates, or better
yet, another macro, to generate the TWO and THREE outputs.
Simulate you design to verify that it works.
The test script.
A signed simulation log or waveform which shows that your circuit
works. You must demo your simulation to one of the TAs who will sign the