EE 552 99w 99-1-11
Lab 3: VHDL Synthesis and Extracted-Timing Simulation
In this lab, you will design systems in VHDL, synthesize them, extract
timing information and simulate using the extracted timing information.
You will be using the Altera MAX+PLUS II tools (maxplus2 is available
on the CAD suns, nyquist HPs or sign out CD-1 for installation on
your own PC).
This lab has two parts: an exercise that is not handed in, in which
you will become familiar with the tools, and a lab that will be
submitted for marking, in which you will create your own design.
Labs are to be done individually. Please feel free to consult
the professor, the T.A. or your fellow students for help with tools
and concepts.
Hints
Maxplus2 may start new projects in VHDL-1987 mode. To switch the
maxplus2 compiler to VHDL-1993 mode, open/select the compiler window and
select:
Interfaces -> VHDL netlist reader settings...
In order to set the clock period to any desired value, and not just a multiple
of the simulation grid size, open/select the waveform editor window and
deselect:
To select the device FLEX EPF10K20RC240-4, used in this lab, select:
Assign -> Device ...
select device family: FLEX10K from the first list
deselect show only fastest speed grades
select EPF10K20RC240-4 from the second list
Exercise (do not hand in)
Part 1: Become Familiar with MAX+PLUS II
Create a directory for the lab and start maxplus2.
% mkdir ~/ee552/lab3
% cd ~/ee552/lab3
% maxplus2 &
or possibly
% /opt1/maxplus2/bin/maxplus2 &
Work through the student
application notes on the maxplus2 editor, device selector, compiler,
and simulator.
Part 2: Simulate a Simple Combinational Circuit
Simulate a 4-bit adder compiled for a FLEX EPF10K20RC240-4. Try to
determine the inputs (previous values and new values) that produce the
maximum delay. What is the maximum delay? What is the maximum
number of times the output changes for one change to the input (zoom in
on the simulated waveform)?
--------------------
-- Adder
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity adder is
generic(adder_width
:positive := 4);
port(a,b: in std_logic_vector(adder_width-1
downto 0);
sum: out std_logic_vector(adder_width downto 0)
);
end adder;
architecture behavioural of adder is
begin
sum <= a + b;
end behavioural;
Lab
Run all requested simulations with extracted timing for a FLEX EPF10K20RC240-4.
Part 1: Thoughts on Simulation
-
Exactly how many pairs of previous inputs and new inputs would you have
to test to exhaustively determine the maximum delay between all combinations
of inputs?
-
Making reasonable assumptions about the implementation of the adder, what
sets of inputs might produce the maximum delay?
Part 2: Simulating Synchronous Circuits
Design an 4-bit counter with clock and active-low asynchronous reset, connected
to a binary to hexadecimal 7-segment display decoder. The decoder
should correctly display 0-9,A,b,C,d,E,F. The outputs should be active
low.
Use the following naming for the 7 segments:
----0
| |
|5 |1
----6
| |
|4 |2
----3
-
What is the minimum clock period for which the circuit still performs correctly
through all states (values of counter)?
-
What is the worst-case delay from clock to output?
-
What is the worst-case delay from reset to output?
Part 3: Configuring FPGAs/CPLDs - Bonus
Transfer your VHDL design from part 2 above to a chip. You can do
this in the hardware lab, CEB 342.
Assign the pins according to this
procedure. Use the FLEX pushbuttons (FLEX_PB1 & 2) for input
and FLEX 7-segment LEDs (FLEX_DIGIT) for output as described in the UP1
documentation.
Now download the configuration
to the chip. After resetting, you'll see that pushing the button
used as the clock input causes the counter to increment more than once.
Record how many clock edges are detected for pushing and for releasing
the clock button (reset inbetween).
-
What is the maximum and the average count for pressing the button?
-
What is the maximum and the average count for releasing the button?
-
Show this system to your TA during the lab (if possible).
Part 4: Behavioural VHDL
Design a circuit, which after n+k clock cycles, produces the output
n squared. It should produce the squares of 0 through 15 without
overflow. The constant k will depend on your design.
Don't use a multiplier. You may use the following C code for inspiration.
/* create a table of squares without using multiplication */
#include <stdio.h>
#define UPPER_LIMIT 15
main(){
int n, nsquared, sum, oldsum;
sum = 0;
oldsum = 0;
for( n=0; n<=UPPER_LIMIT; n++) {
oldsum = sum;
sum += n;
nsquared = sum + oldsum;
printf("%d squared is %d\n", n, nsquared);
}
exit(0);
}
Incidentally, this multiplication-free computing trick from the 1930's
was used in differential analyzers.
-
What is the minimum clock period for correct operation?
-
Why would you want to think of clever ways to avoid performing multiplication
in hardware?