Introduction to VHDL in Xilinx ISE 10.1
From the previous labs, we have already know that VHDL stands for VHSIC
Hardware Description Language. VHSIC means Very High Speed Integrated Circuits.
VHDL is an industry-standard language for modeling and synthesizing digital
hardware, particularly for programmerable logic or Application Specific
Integrated Circuits. The VHDL simulation serves as a basis for testing
complex designs and validating the design prior to fabrication. As a result,
the redesign is reduced, the design cycle is shortened, and the product is
brought to market sooner.
A VHDL program can be considered as a description of a digital system;
the associated simulator will use this description to produce behavior
that will mimic that of the physical system.
Xilinx ISE means Xilinx® Integrated Software Environment (ISE).
This Xilinx® design software suite allows you to take your design from
design entry through Xilinx device programming. The ISE Project
Navigator manages and processes your design through several steps in the
ISE design flow. These steps are Design Entry, Synthesis, Implementation,
Simulation/Verification, and Device Configuration.
In this lab, you are going to see how to create a counter in the Xilinx
ISE and how to simulate it with ISE Simulator. You will create
a test bench waveform containing input stimulus you can use to simulate
the counter module. This test bench waveform is a graphical view of a
test bench.
Open Xilinx ISE 10.1
To open the Xilinx ISE 10.1, click on the Xilinx icon
on the desk top
or go to the Start -> Programs ->
Xilinx ISE Design Suit 10.1 -> ISE -> Project Navigator.
You can close the window for the "Tip of the Day".
Create a project
In this section, you will create a new ISE project.
A project is a collection of all files nesessary to create
and to download a design to a selected FPGA or CPLD device.
- Select File > New Project. The New Project Wizard appears.
- First, enter a location (directory path) for the new project,
then give a name for the project. For example, we name it Counter01.
Here is a picture to illustrate the idea.
- Select HDL from the Top-Level Module Type list, indicating that
the top-level file in your project will be HDL, rather than Schemetic or
other stuffs.
- Click on Next to move to the project properties page.
- Fill in the properties in the table as shown below:
Device Family: Virtex2P
Device: XC2VP30
Package: ff1152
Speed: -6
Synthesis Tool: XST [VHDL/Verilog]
Simulator: ISE Simulator [VHDL/Verilog]
Preferred Language: VHDL
all the rest should be default
When the table is complete, your project properties should look like
the following:
- Click Next to proceed to the Create New Source window in the
New Project Wizard. At the end of the next section, your new project will be
created.
Create VHDL Source
In this section, you will create a top-level HDL file for your design.
You are going to design an up-down counter which is the same as what you
did in the previous lab.
This simple counter design has two inputs: CLOCK and DIRECTION.
The direction of the up-down counter is indicatingd by the DIRECTION input.
The design has one 4-bit bus output called COUNT_OUT.
- Click New Source in the New Project Wizard to add to one new source
to your project.
- Type in the file name counter.
- Select VHDL Module as the source type in the New Source Dialog box.
- Verify that the Add to Project checkbox is selected.
- Click Next.
- Define the ports for your VHDL source.
- In the Port Name column, type the port names on three separate rows:
CLOCK, DIRECTION, and COUNT_OUT.
- In the Direction column, indicate whether each port is an input,
output, or inout. For CLOCK and DIRECTION, select in from
the list. For the COUNT_OUT, select out from the list.
- To indicate that COUNT_OUT is a 4-bit bus, use the arraws to select
3 in the MSB (Most Significant Bit) field, and select
0 in the LSB (Least Significant Bit) field.
- Click Next in the Define Module dialog box.
- Click Finish in the New Project Wizard - Summary dialog box
to complete the new source file template.
- If the following window appears, click on "yes".
- Click Next in the New Project Wizard.
- Click Next again.
- Click Finish in the New Project Wizard - Project Summary dialog box.
ISE creates and displays the new project in the Source in Project window
and adds the counter.vhd file to the project.
The counter.vhd file contains:
- Header information
- Library information
- Entity declaration for counter and an empty architecture statement
- In the header section, fill in the following fields:
- Engineer: Your Name
- Design Name: counter.vhd
- Project Name: Counter01
- Target Devices: xc2vp30-6ff1152
- Description: This is the top level HDL file for an up/down counter.
- Dependencies: None
Here is how it looks like:
Enter and Edit VHDL Code
- In VHDL, the output port cannot be read from within the design,
therefore a new temporary signal must be made. Type the following line below
the architecture declaration and above the first begin statement:
signal count_int: std_logic_vector(0 to 3) := "0000";
- You need a process statement with the following information:
if DIRECTION = '1' then
count_int <= count_int + 1;
else
count_int <= count_int - 1;
end if;
- Below the end process statement, enter the following line:
COUNT_OUT <= count_int;
- Save the file by selecting File -> Save.
When you are finished, the code for the counter should look like the following:
architecture Behavioral of counter is
signal count_int: std_logic_vector(0 to 3) := "0000";
begin
process (CLOCK)
begin
if CLOCK'event and CLOCK = '1' then
if DIRECTION = '1' then
count_int <= count_int + 1;
else
count_int <= count_int - 1;
end if;
end if;
end process;
COUNT_OUT <= count_int;
end Behavioral;
You have created the VHDL source for the Counter01 project.
Here is how it looks like:
Now, proceed to Checking the Syntax of the New Counter.
Check the Syntax of your VHDL source - Synthesize Your Code
When source files are complete, the next step is to check the syntax of
the design. Syntax errors and typos can be found using this step.
- Select the counter design source in the ISE Sources window to
display the related processes in the Processes for Source window.
- Click + next to the Synthesize-XST process to expand the hierarchy.
- Double-click on the Synthesize -XST process.
When an ISE process completes, you will see a status indicator next
to the process name.
- If the process completed successfully, a green check mark appears.
- If there were errors and the process failed, a red X appears.
- A yellow exclaimation point means that the process completed
successfully, but some warnings occurred.
- An orange question marks means the process is out of date and
should be run again.
- Look in the Console tab of the Transcript window and
read the output and status messages produced by any process you run.
- You must correct any errors found in your source files.
If you continue without valid syntax, you will not be able to simulate
or synthesize your design.
- You would like to see "Process 'synthesis' completed successfully".
or "Process 'Check Syntax' completed successfully".
Design Simulation - Simulate the Module Using the ISE Simulator
Create a Test Bench for Simulation
In this section, you will create a test bench waveform containing input
stimulus you can use to simulate the counter module.
This test bench waveform is a graphical view of a test bench.
It is used with simulator to verify that the counter design meets both
behavioral and timing design requirements.
You will use the waveform editor to create a test bench waveform (TBW) file.
- Select the counter HDL file in the Sources in Project window.
- Create a new source by slecting project -> New Source.
- In the New Source window, select Test Bench Waveform as the
source type, and type countertestbench in the File Name field.
- Make sure the box for Add to Project is checked.
- Click Next.
- The Cource File dialog box shows that you are associating the test bench
with the source file: counter. Click Next.
- Click Finish.
You need to set the initial values for test bench waveform in the Initialize Timing dialog box before the test bench waveform editing window opens.
- Fill in the fields in the Initialize Timing dialog box using
the information below:
- Clock Time High: 20 ns.
- Clock Time Low: 20 ns.
- Input Setup Time: 10 ns.
- Output Valid Delay: 10 ns.
- Initial Offset: 100 ns.
- Global Signals:GSR (FPGA). Note: The GSR value of 100 is added
to the Initial Offset value automatically.
- initial Length of Test Bench: 1000 ns.
- Leave the remaining fields with their default values.
- Click Finish to open the waveform editor.
The blue shaded areas are associated with each input signal and
corresponding to the Input Setup Time in the Initialize Timing dialog box.
In this design, the input transitions occur at the edge of the blue cells
located under each rising edge of the CLOCK input.
- Look at the following picture for the setup of the DIRECTION port.
- Selct File -> Save to save the waveform.
- Select the Behavioral Simulation in the Source window.
- On the Sources in Project Window, the TBW file countertestbench.tbw
is automatically added to your project.
Simulating Behavioral Model (ISE Simulator)
To run the integrated simulation process in ISE:
- Select the countertestbench waveform in the Sources in
Project window.
You can see Xilinx ISE Simulator processes in the Processes for Source window.
- Double-click on the Simulate Behavioral Model process
in the Project window.
The ISE Simulator opens and run the simulation to the end of the test bench.
Here is the ISE window showing the simulation results.