1、在pcie_blk_plus_ll_rx.v文件中增加:
`ifndef TCQ
`define TCQ 1
`endif
2、仿真入口在pci_exp_usrapp_tx.v
initial begin
if ($value$plusargs("TESTNAME=%s", testname))
$display("Running test {%0s}......", testname);
else
begin
// $display("[%t] %m: No TESTNAME specified!", $realtime);
// $finish(2);
testname = "sample_smoke_test0";
$display("Running default test {%0s}......", testname);
end
expect_status = 0;
expect_finish_check = 0;
// Tx transaction interface signal initialization.
trn_td = 0;
trn_tsof_n = 1;
trn_teof_n = 1;
trn_trem_n = 0;
trn_terrfwd_n = 1;
trn_tsrc_rdy_n = 1 ;
trn_tsrc_dsc_n = 1;
// Payload data initialization.
TSK_USR_DATA_SETUP_SEQ;
//Test starts here
if (testname == "dummy_test")
begin
$display("[%t] %m: Invalid TESTNAME: %0s", $realtime,testname);
$finish(2);
end
`include "tests.v"
else begin
$display("[%t] %m: Error: Unrecognized TESTNAME: %0s",$realtime, testname);
$finish(2);
end
end
3、一定要单独生成核,再包含各个文件
否则,会产生不需要的vhdl文件,仿真也会出问题。
4、独立选项
4.1 vsim的选项
vsim 中有以下参数:
(1)+TESTNAME=sample_smoke_test0:用于指定仿真名称
vsim有两个相近的option:
# -g<Name>=<Value> Specify generic/parameter default Valuefor Name
# -G<Name>=<Value> Override generic/parameter withspecified Value
虽然没有明确的证据表明+xxx=xxx等价于上面的-Gxxx=xxx,大概理解其意思就可以。
找到真正的原因了,是在pci_exp_usr_tx.v文件中有$value$plusargs这个函数,这个函数就是来寻找vsim这种附加参数的。
(2)后仿的时候注意:-L xilinxcorelib_ver -L unisims_ver -L unimacro_ver
4.2 vlog的选项
仿真的时候:+define+BOARDx01 +define+SIM_USERTB +define+SIMULATION
5、“Unsupported target”
(1)报错:Unsupported target.
cfg_to_turnoff_n是out,它给写成了In,导致例化的时候我把它例化了一个常数。例化的时候把这个端口选口就可以了,如果不用的话。
6、Completer ID的问题
Identifies the completer being accessedwith this configuration cycle. The Bus and Device numbers in this field are"captured" by the device on each configuration Type 0 write.
也即,在配置的时候并不直接对三个号()进行配置,靠PCIE协议的一个机制:不是自己的包不会收到。所以,每次Configuration Write中的这三个号都会被接收方用来更新自己的这三个号!!!!
Byte 8, 7:0 = Bus Number
Byte 9, 7:3 = Device Number
Byte 9, 2:0 = Function Number
在pci_exp_usrapp_tx.v中,
在一开始添加(不用添加,本来就有):
reg[15:0] REQUESTER_ID;
在initial中,将REQUESTER_ID改值为0;
initial
begin
//…
REQUESTER_ID = 16’b0;
end
ConfigurationWrite和Read这4个task是错误的。
TSK_TX_SYNCHRONIZE(0, 0);
trn_td <=#(Tcq) {
1'b0,
2'b10,
5'b00101,
1'b0,
3'b000,
4'b0000,
1'b0,
1'b0,