Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile.
This article demonstrates how to create post-simulation status flags for PCIe transaction/error messages on the PIPE interface. This will be helpful for those who would like to debug the TLP and any issues associated with it. The user can simply look at the status flags and know the type of transaction done by the TLP without actually having to decode it. The current files are known to be compatible with the Modelsim simulator and Synopsys VCS (with limitations) and support all Gen1 and Gen2 PCIe HIP configurations from Altera.
Overview
The current version supports creating and viewing flags for the following transactions and error messages for both Gen1 and Gen2 HIP.
Note: VCS does not support flags for the error messages.
Signal name (TLP Type) | Transaction/Error type |
MRd_tx / MRd_rx | Memory Read Request |
MRd_Lk_tx / MRd_Lk_rx | Memory Read Request-Locked |
MWr_tx / MWr_rx | Memory Write Request |
IORd_tx / IORd_rx | I/O Read Request |
IOWr_tx / IOWr_rx | I/O Write Request |
CfgRd0_tx / CfgRd0_rx | Configuration Read Type 0 |
CfgWr0_tx / CfgWr0_rx | Configuration Write Type 0 |
CfgRd1_tx / CfgRd1_rx | Configuration Read Type 1 |
CfgWr1_tx / CfgWr1_rx | Configuration Write Type 1 |
Cpl_tx / Cpl_rx | Completion without Data |
CplD_tx / CplD_rx | Completion with Data |
CplLk_tx / CplLk_rx | Completion for Locked Memory Read without Data |
CplDLk_tx / CplDLk_rx | Completion for Locked Memory Read with Data |
ERR_COR_tx / ERR_COR_rx | Error message when a correctable error is detected on the PCIe interface |
ERR_NONFATAL_tx / ERR_NONFATAL_rx | Error message when a nonfatal, uncorrectable error is detected on the PCIe interface |
ERR_FATAL_tx / ERR_FATAL_rx | Error message when a fatal uncorrectable error is detected on the PCIe interface |
ASRT_INT_tx / ASRT_INT_rx | Assert Interrupt virtual wire for all INT lumped together |
DSRT_INT_tx / DSRT_INT_rx | De-assert Interrupt virtual wire for all INT lumped together |
PMM_tx / PMM_rx | Power management messages lumped into one signal |
This section provides a step by step guide on how to create and view the transaction/error status flags in the Modelsim simulator. The configuration of the files are similar for both Gen1 and Gen2 HIP. There is slight difference in configuration based on whether it is a x1, x4 or x8 lane HIP.
STEP 1:
The first step is to create a PCIe HIP using Altera Quatus II software and Qsys. Here is brief instruction on ow to creae a PCIe HIP using Qsys.
Once the IP is generated there should be two subfolders (/testbench and /synthesis) under your <project_directory>/<pcie_de_gen1_x1_ast64>/ (The name depends on the type of IP that has been generated).
STEP 2:
To interpret the TLPs at the PIPE interface it is neccessary to make sure that the data scrambling has been disabled while compiling the design files which is enabled otherwise by default. To disable scrambling make the following modifications:
STEP 3:
Open modelsim and in the transcript window navigate to directory <project_directory>/<pcie_de_....>/testbench/mentor and do the following steps:
STEP 4:
Depending on the number of lanes in your design (x1, x4, x8) copy one of the below mentioned files to the directory named <project_directory>/<pcie_de_....>/testbench/mentor.
x1 lane: virtual_x1.do
x4 lane: virtual_x4.do
x8 lane: virtual_x8.do
The above mentioned files can be found in Virtual.zip (http://virtualvcs.zip/ ) file.
STEP 5:
In this step we modify the .do files as per our design. There are only two small modifications needed per design.
Note: The period of the signal hip_pipe_sim_pipe_pclk_in can be seen from the modelsim waveform. This is the reason we execute run -all command before we actually add the virtual signals.
x1 lane: virtual_x1.do:
In this example we consider the clock period of signal hip_pipe_sim_pipe_pclk_in to be 4 ns.
The delay for txd_d1 is given by 3* (period:hip_pipe_sim_pipe_pclk_in) = 3* 4 ns = 12 ns.
Therefore we set the delay of signal driving txd_d1 to 12 ns : virtual signal -env $path {hip_pipe_txdata0'delayed(12 ns)} txd_d1.
Similarly, the delay for txd_d2 is given by 10* (period:hip_pipe_sim_pipe_pclk_in) = 10* 4 ns = 40 ns.
Therefore we set the delay of signal driving txd_d1 to 12 ns : virtual signal -env $path {hip_pipe_txdata0'delayed(40 ns)} txd_d2.
The delays for rxd_d1 and rxd_d2 are same as txd_d1 and txd_d2 respectively.
x4 lane: virtual_x4.do:
For 4 lane HIP, txd_d1 does not have any delayed parameter hence no change is required.
The delay for txd_d2 is given by 2* (period:hip_pipe_sim_pipe_pclk_in) = 2* 4 ns = 8 ns.
virtual signal -env $path {hip_pipe_txdata2'delayed(8 ns)} txd_d2
The delays for rxd_d1 and rxd_d2 are same as txd_d1 and txd_d2 respectively.
x8 lane: virtual_x8.do:
txd_d1 is given by1* (period:hip_pipe_sim_pipe_pclk_in) = 1* 4 ns = 4 ns.
virtual signal -env $path {hip_pipe_txdata2'delayed(4 ns)} txd_d1.
txd_d2 is given by 1* (period:hip_pipe_sim_pipe_pclk_in) = 1* 4 ns = 4 ns.
virtual signal -env $path {hip_pipe_rxdata6'delayed(4 ns)} txd_d2.
The delays for rxd_d1 and rxd_d2 are same as txd_d1 and txd_d2 respectively.
STEP 6:
Once the changes have been made to the .do file save the file and close. On the transcript window of the Modelsim simulator type the command do <filename>.do to create these waves and add it to your simulation wave window.
Note: A virtual_xx.do file can only be run once in an active simulation if any modifications are made to the signals in the file the simulation has to be run again before runing the .do file or else the simulator would ingnore the changes.
STEP 7 (Optional):
Group the following signals along with the status flags for efficient interpretation of the data.
hip_pipe_txdata
hip_pipe_txdatak
hip_pipe_rxdata
hip_pipe_rxdatak
After correctly following these steps one can view the PCIe transaction/error message status flags on the Modelsim simulator wave window. Below is the screenshot of a 4 lane memory read TLP.
Figure 1. Memory Read TLP on a 4 lane PCIe HIP- Wave1.jpg
The PCIe debug status flags for the PCIe PIPE simulation can also be created on the VCS simulator (with limitations). Status flags for 1 lane PCIe HIP is not supported in VCS. Also error flags are not supported.
To create and view TLP transaction status flags for VCS follow the below steps.
STEP1 and STEP2 are same as that mentioned in the Modelsim howto.
STEP 3:
Add the below piece of code to the file pcie_de_gen?_x?_ast??_tb.v (the file can be found at <project directory>/pcie_de.../testbench/pcie_de..._tb/simulation). Add the code inside the module declaration.
initial begin
$dumpfile("dumpfile.vpd");
$dumpvars;
$dumpon;
end
save and close the file.
STEP 4:
Run the simulation using VCS
1. Go to the directory <project directory>/pcie_de.../testbench/synopsys/vcs and run the command sh vcs_setup.sh
2. Once done run the command ./simv
3. Once the simulation is done type the command dve -vpd dumpfile.vpd .This command opens the DVE gui to view the waveforms
4. In the hierarchy window of the DVE gui select pcie_de_gen?_x?_ast??_inst module under pcie_de_gen?_x?_ast??_tb. Right click on it and select Add to wave> New wave view.
STEP 5:
Depending on the number of lanes in the design (x4, x8) copy one of the files (virtual_x4.tcl, virtual_x8.tcl) to the directory <project directory>/pcie_de.../testbench/synopsys/vcs. The files can be found in VirtualVCS.zip file. To set the path for your design open the virtual_x?.tcl file and set the below two options appropriately.
gui_load_child_values {pcie_de_gen?_x?_ast??_tb.pcie_de_gen?_x?_ast??_inst}
set pcie_de_gen?_x?_ast??_inst pcie_de_gen?_x?_ast??_inst
STEP 6:
In the transcript window of the DVE gui (at the very bottom of the DVE gui where dve> is mentioned) type the command source virtual_x?.tcl . This adds the virtual signals to the waveform window.
Follow STEP7 as mentioned in the modelsim howto for better intertpretation.
Below is a screenshot of a 4 lane PCIe HIP Memory Read TLP on VCS simulator.
Figure 2. Memory Read TLP for 4 lane PCIe HIP- Vcs.jpg
users.ece.cmu.edu/~kbiswas/modelsim/se_man.pdf
© 2010 Altera Corporation. The material in this wiki page or document is provided AS-IS and is not supported by Altera Corporation. Use the material in this document at your own risk; it might be, for example, objectionable, misleading or inaccurate.
Community support is provided Monday to Friday. Other contact methods are available here.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our Optimization Notice.