Download UG638 - Xilinx
Transcript
Chapter 5: Programmatic Access
Example 2
This M-code uses an alternative form of syntax to perform the simulation described in the
previous example. This form uses the exec instruction and provides better simulation
performance by reducing the number of name-based lookups required to identify ports on
a block, and also by folding the execution of code in an M-code for-loop into a single
instruction, which reduces the over-head associated with interpreting the M-code.
% Configure the co-simulation interface. Note: This needs only to be
% done once, since the configuration is stored back into the hwc file
% This will launch a configuration GUI.
xlHwcosimConfig('mydesign.hwc');
% Define the number of simulation cycles.
nCycles = 1000;
% Creates a hardware co-simulation instance from the project
% 'mydesign.hwc'.
h = Hwcosim('mydesign.hwc');
% Opens and configures the hardware co-simulation interface.
open(h);
% Initializes the 'op' input port with a constant value zero.
write(h, 'op', 0);
% Initializes an execution definition that covers the input ports,
% x1 and x2, and the output ports y. It returns an execution
% identifier for use in subsequent exec instructions.
execId = initExec(h, {'x1', 'x2'}, {'y'});
% Simulate the design using the exec instruction.
% The input data are given as a 2-D matrix. Each row of the matrix
% gives the simulation data of an input port for all the cycles.
% For example, row i column j stores the data for the i-th port at
% (j-1)th cycle.
result = exec(h, execId, nCycles, rand(2, nCycles));
% Releases the hardware co-simulation instance.
% The hardware co-simulation interface is closed implicitly.
release(h);
482
www.xilinx.com
System Generator for DSP Reference Guide
UG638 (v11.4) December 2, 2009
Related documents
EDK Processor
Block Parameters
Vivado Design Suite Reference Guide: Model-Based DSP
Block Parameters
MATLAB FIXED-POINT TOOLBOX - RELEASE NOTES User guide
MATLAB SIMULINK HDL CODER - RELEASE NOTES User guide
BugHunter Pro and the VeriLogger Simulators
Xilinx DS215 LogiCORE IP Binary Counter, Data Sheet
FPGADEVS6 FPGA Development Kit User`s Manual
Xilinx System Generator for DSP User Guide (UG640)
Simulation
Wireless survival gu..