Functional simulation is used to debug your logic before fitting your design into a CPLD. The Xilinx CPLD Synopsys Interface fully supports functional simulation using the Synopsys VSS simulator, including all instantiated cells from the XC9000 library.
To prepare a test bench configuration for simulation, you must analyze each of the design and test bench source files in the proper bottom-up sequence.
The following procedure uses the stand-alone VHDL Analyzer (vhdlan) and the VHDL Debugger Simulator (vhdldbx).
You are then prompted for a configuration name. Select the name of the configuration declared in the test_bench_name.vhd file. For example, for the scan design, select the following:
CFG_SCAN_TB
The vhdldbx selector window appears.
After you click OK, the vhdldbx user interface window appears.
To run your simulation, typically you first declare the signals you want to display in a trace window. For example, to display all signals appearing on the CPLD pins, you can enter the following vhdldbx command:
trace *'signal.
To run all the simulation vectors in your test bench, select the RUN command. A trace window will be displayed.
After functional simulation is successful, you are ready to implement your design and create the physical layout information required for timing simulation.
After you have debugged your design using functional simulation, you can compile it using synthesis and implement it in a CPLD using the Xilinx fitter. Design implementation is a prerequisite for performing timing simulation.
You can use DC Shell or you can use the Synopsys graphic interface (Design Analyzer) to create the EDIF netlist file required by the Xilinx fitter. This gate-level netlist file consists of cells from the XC9000 library but does not contain timing information. The Xilinx fitter processes the netlist file and places the logical design into the physical architecture of a target CPLD.
After the design is implemented by the Xilinx fitter, the actual target device timing information is available for timing simulation.
The following steps show you an overview of the CPLD implementation procedure.
Usually, simulation is not repeated until after fitting when all actual timing results have been applied.
Examine the appropriate fitter report files to verify that the fitter completed successfully. You may wish to target a smaller device or add more functions to your design if there are remaining unused resources.
After design implementation, you are ready to prepare the timing model for timing simulation.
The ngd2vhdl command translates the timing simulation database file (design_name.nga) produced by the cpld command into the required VHDL simulation output file(s).
If you prefer to create a PRLD input port and control it using your testbench, create your timing simulation model as follows:
ngd2vhdl design_name -w -gp design_name_time
If you prefer to use the automatic ROC cell to pulse the PRLD net, create your timing simulation model as follows:
ngd2vhdl design_name -w design_name_time
Invoking the ngd2vhdl command with no parameters produces a listing of all available command-line options.
The design_name is the name of the design as specified when running the cpld command, without path qualifiers and without extension.
The ngd2vhdl command produces a structural VHDL file (design_name_time.vhd) and an SDF-formatted timing back-annotation file (design_name_time.sdf), for use with the Synopsys VSS simulator or other VITAL-compatible simulator. A procedure for using the VSS simulator is described below.
Similarly, the ngd2ver command produces a structural Verilog HDL file (design_name_time.v) and an SDF-formatted timing back-annotation file (design_name_time.sdf).
The -gp option forces ngd2vhdl or ngd2ver to add a PRLD input port to the output VHDL or Verilog HDL file for CPLD designs. This allows the PRLD initialization signal to be stimulated as a top-level port by your test bench.
When the fitter processes your design, some of your original nodes may be removed or replaced due to logic optimization. Such nodes cannot be viewed or stimulated during timing simulation. All of the device I/O port signals and register output signals are always maintained.
You can now use these files to simulate the design with a supported third party simulation tool.
If you prepared your test bench as described earlier you can use the same test bench for timing simulation as used for functional simulation. By using the same test bench you can easily verify that the functionality of the device after mapping matches the functionality of your source design. You also eliminate any risk of errors from accidental differences between separate test bench files.
All back-annotated timing in the .sdf file is applied to various instances within the design_name_time.vhd file. However, if you are simulating with a test bench, you must specify (to the simulator) the CPLD design instance to which you want to apply the back-annotated timing. It can then find all the referenced instances.
If you are using vhdldbx you need to specify two parameters:
You can specify these parameters either in the dialog box which appears after invoking vhdldbx, or on the UNIX command line as you invoke vhdldbx.
The command line invocation format is:
vhdldbx -sdf_top chip_instance_name -sdf \ design_name_time.sdf configuration_name
For the scan design example, you should enter the following:
vhdldbx -sdf_top /scan_tb/UUT \
-sdf scan_time.sdf CFG_SCAN_TB
If you use the -tb option of the ngd2vhdl command to create a testbench template file (.tvhd), all the instance names in the .sdf timing back-annotation file will be prefixed with UUT/. In this case, you would omit the instance name /UUT from your vhdldbx -sdf_top parameter. For example, if you prepared the scan design using the command:
ngd2vhdl -w -tb scan scan_time
then you would invoke the VSS simulator using the command:
vhdldbx -sdf_top /scan_tb -sdf scan_time.sdf \ CFG_SCAN_TB
Now you can run the same simulation vectors for timing simulation as you ran for functional simulation. However, in timing simulation, the registers are set to their initial states in response to the active-high pulse on PRLD.