System Generator Tutorial
System Generator Tutorial
System Generator Tutorial
Simulink
System Generator
Source1
Xilinx blocks
Source 2
precedence over the enable signal. The enable signal has to run at a
multiple of the block 's sample rate. The signal driving the enable port
must be Boolean.
Sample Period: Data streams are processed at a specific sample rate as
they flow through Simulink. Typically, each block detects the input
sample rate and produces the correct sample rate on its output. If you
select Specify explicit sample periodrather than the default, you may set
the sample period required for all the block outputs. This is useful when
implementing features such as feedback loops in your design. In a
feedback loop, it is not possible for System Generator to determine a
default sample rate, because the loop makes an input sample rate
depend on a yet-to-be-determined output sample rate. System
Generator under these circumstances requires you to supply a hint to
establish sample periods throughout a loop.
Things to be noted:
Every model needs a System Generator token.
Completed model
Step 6: Double Click on the Sine Wave block and change the parameters:
Amplitude : 1
Frequency : 2*pi*1/150
Step 7: Change the GateWay In parameters as:
GateWay In parameters
Step 8:The only parameter to be changed in the Delay element is the latency.
Set the latency value to 1.
Step 9:Now, to view both the source and output from the system generator
block together in scope, Double click on the scope icon and set the Number of
axes to 2.
From the Configuration Parameters dialog box, enter 150 in the Stop
time field, and set thefollowing Solver options:
o Type: Fixed-step
o Solver: Discrete (no continuous states)
o Tasking mode: SingleTasking
Setting these parameters allows your simulation to run for 150 time units.
Scope Output
Observe that the output from the Xilinx blocks (first plot) is delayed by one
sample.
1)Vary the Latency of the Delay element and observe the output.
2)Vary the Stop time parameter and observe the output.
Scope Output
The waveform gets clipped.
Explain what has happened?
Answer :
GateWay In:
Change the Overflow Parameter to Wrap and observe the waveform.
Now Set the Overflow parameter to Flag as Error and Run the
Simulation.
Hardware cosimulation
Step 6:Run the simulation and verify that the result matches with the previous
ones.
Note:All GateWay In and GateWay Out blocks will be mapped to the input and
output ports in hardware cosimulation. If a GateWay Out block need not to be
mapped to the output uncheck the Translate to Output port option.
Timing analyzer
This window provides various options for identifying slow paths, charts
showing details of various paths, operating frequency and period, Trace and
ISE reports and Power analysis reports.
Since there are no registers within the design, slow paths and charts are not
displayed.
Step 8: Click on the Power Analysis tab. It launches XPower Analyzer which
provides detailed power analysis.
Step 1:Double Click on the System Generator Token. A dialog box appears. Set
the parameters for Compilation as shown in the figure below.
Compilation Parameters
Note that the proper target device is chosen. This tutorial is based on Virtex 5
(XC5VLX110T Evaluation Platform).
Step 2:Click on Generate. A new directory named netlist appears in the
current folder in which you are working. The HDL code (here, the Verilog code)
and an ISE project together with many other files would be created in the
netlist folder.
delay4_cw.v : This is the top level module which forms the HDL wrapper
for the design. Depending on the type of multi-rate implementation
selected it drives clock enables in the design or the clocks.
delay4.v : This contains most of the HDL for the design.
In addition to the signals in the system generator model, various other signals
are also present in the generated code.
Clock (clk) : Clock signal for the design. All operations of the core are
synchronised with the rising edge of the clock.
Clock Enable (ce) : It is attached to the clock enable pins of the flip-flops.
A valid clock signal occurs only when the ce signal attached to the CE
pin of the flip-flop is high on a rising edge of the clock. (Mainly of use in
multirate systems).
Step 3: These files can be taken to the Xilinx ISE in order to begin the stages of
taking the design to FPGA.
Step 4:OpenXilinx Project Navigator. Open the generated project from
FileOpen Project and browse to your current folder (where the files are
generated).
Step 5:Observe that various files are added automatically into the project.
Step 6:Synthesize the design. Expand the Synthesize-XST option and Click on
View RTL Schematic.
Double click on the RTL Schematic to see inside the block. Observe that there
are blocks other than that of the main block (delay4_cw). The extra added
blocks are used for generating the clk and clock enable for the system
generator model.
Step 7:In the model, there are 4 delay elements (since the delay is set to 4).
Synthesis and mapping options can be set which would control how the design
is implemented on the FPGA.
Either the implementation can be carried out utilizing the IOBs
(Input/Output blocks) or use only the flip-flops within the logic slices.
Implement a delay using flip-flops for each clock cycle or by using a shift
register.
Step 8:In order to make use of flip-flops rather than the shift registers, modify
the Synthesis options. Right click on Synthesize- XSTProcess PropertiesHDL
options Uncheck the Shift Register Extraction.
Step 9:To make use of the IOBs, Right click on Synthesize- XSTProcess
PropertiesXilinx Specific Options Pack IO registers into IOBs Yes.
Step 10: Click on Generate Programming file. This will go through a series of
steps including SynthesisTranslateMapPlace and Route. Finally the bit
stream is generated.
Step 11:Tabulate various results for resource utilization, operating frequency
and minimum time period (Post-PAR Static Timing Report).
Step 6:To verify the output in hardware, the reset signal has to be mapped
from outside. Hence, change the GateWay In paramatersImplementation
IOB pad locations {AC24}. This is the pin location for GPIO DIP switch 8. This
switch can be used to reset the counter.
Step 7:Generate HDL code using the System Generator Token. Open the
generated project in Xilinx ISE.
Step 8: Modify the UCF file generated to map the clock signal.
# LOC constraints
NET gateway_in*0+ LOC = AC24;
NET clk LOC = AH15;
Click on Generate BitStream. The generated bit stream includes the ChipScope
core as well as the design under test.
Step 8:Click on Analyze using ChipScope.Click on Open Cable/JTAG connection.
Ensure that the board is connected and powered on.
Step 9:ChipScope Pro Analyzer window appears. Click on OK. Click on
DeviceDEV4(XC5VLX110T)Configure. Click on OK.
Step 10: Next, we need to import the file containing the bus information,
which was originally defined in the ChipScope block in System Generator. Goto
FileImportSelect new filecounter_delay.cdc. Click OK.
Step 11:In the project panel Click on Trigger setup and Bus Plot. Check the
boxes for data0 and data1.
Step 12:In the trigger setup window, set the match unit value to 0. This
corresponds to the reset signal of the counter connected to the trigger port of
the chipscope.
Step 13:Before arming the trigger, ensure that the GPIO switch has been
switched On. Now, arm the trigger. ChipScope now waits for the trigger signal.
Step 14:Switch the DIP switch position to OFF. This will trigger the capture of
data and reset the counter.
Step 15:View the signal in Busplot. The captured data will be plotted and it
should match with the results obtained from System Generator.
Units : Normalized to [0 1]
wpass : 0.1
wstop : 0.25
Click on Design Filter.
In the design, these values will be stored in memory. During the filtering
operation, these would be read and used.
Step 3: The inputs to the filter are passed through delay line (as in the block
diagram shown above). The delay line is implemented using an Addressable
Step 4:The filter coefficients generated are stored within a ROM (Xilinx
BlockSetMemoryROM). Double Click on the ROM block and set the
parameters.
Step 5: The addresses to the delay line and the memory are generated using a
counter (Xilinx BlocksetBasic elementsCounter)
The sample period of the counter is set to 1/7000 because, for every new input
which comes, the filter has to process 7 samples (since a 7 tap filter). So, the
memory and the delay line should operate at 7 times faster rate than rest of
the elements.
Step 6:All blocks in the model operate according to the simulink clock. Hence,
the Simulink Clock should be set to the maximum of frequency value at which
each block operate. Set the Simulink time period to 1/7000.
Step 7:Add a multiplier block (Xilinx BlockSetMathMult). Set the
parameters as shown below:
The delay element used after the Delay line is to compensate for the latency of
the ROM (filter coefficients).
Step 8: Add an accumulator block (Xilinx BlocksetMathAccumulator) to
the end of the multiplier. For every input, the accumulator needs to operate 7
times. Whenever a new input comes, the output of the accumulator is reset.
The reset signal is generated using control logic.
Control Logic
Accumulator Parameters
Step 9:For each input signal, the accumulator generates 7 outputs (depending
on the number of filter taps). Only the last value of these 7 outputs is the valid
result. This value is captured using a register (Xilinx BlocksetBasic Elements)
which is enabled only when a valid output comes.
Step 10:The MAC unit performs at a faster rate compared to the input
sampling time. In order for the output sample time to match with that of the
input ones, the value obtained from the capture register is downsampled by an
amount equal to the number of filter taps. This is done using a DownSample
block (Xilinx BlocksetBasic ElementsDownsample).
Step 11:Finally, the output is send to a GateWay Out block and the results are
viewed using Scope.
8.963 ns
111.570 MHz
101
85
33
1.061 W
Run the simulation and verify that the results are same as that from the
software model.