board.v 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. //-----------------------------------------------------------------------------
  2. //
  3. // (c) Copyright 2020-2024 Advanced Micro Devices, Inc. All rights reserved.
  4. //
  5. // This file contains confidential and proprietary information
  6. // of AMD and is protected under U.S. and
  7. // international copyright and other intellectual property
  8. // laws.
  9. //
  10. // DISCLAIMER
  11. // This disclaimer is not a license and does not grant any
  12. // rights to the materials distributed herewith. Except as
  13. // otherwise provided in a valid license issued to you by
  14. // AMD, and to the maximum extent permitted by applicable
  15. // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
  16. // WITH ALL FAULTS, AND AMD HEREBY DISCLAIMS ALL WARRANTIES
  17. // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
  18. // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
  19. // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
  20. // (2) AMD shall not be liable (whether in contract or tort,
  21. // including negligence, or under any other theory of
  22. // liability) for any loss or damage of any kind or nature
  23. // related to, arising under or in connection with these
  24. // materials, including for any direct, or any indirect,
  25. // special, incidental, or consequential loss or damage
  26. // (including loss of data, profits, goodwill, or any type of
  27. // loss or damage suffered as a result of any action brought
  28. // by a third party) even if such damage or loss was
  29. // reasonably foreseeable or AMD had been advised of the
  30. // possibility of the same.
  31. //
  32. // CRITICAL APPLICATIONS
  33. // AMD products are not designed or intended to be fail-
  34. // safe, or for use in any application requiring fail-safe
  35. // performance, such as life-support or safety devices or
  36. // systems, Class III medical devices, nuclear facilities,
  37. // applications related to the deployment of airbags, or any
  38. // other applications that could lead to death, personal
  39. // injury, or severe property or environmental damage
  40. // (individually and collectively, "Critical
  41. // Applications"). Customer assumes the sole risk and
  42. // liability of any use of AMD products in Critical
  43. // Applications, subject only to applicable laws and
  44. // regulations governing limitations on product liability.
  45. //
  46. // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
  47. // PART OF THIS FILE AT ALL TIMES.
  48. //
  49. //-----------------------------------------------------------------------------
  50. // Project : Series-7 Integrated Block for PCI Express
  51. // File : board.v
  52. // Version : 3.3
  53. // Description: Top level testbench
  54. //
  55. //------------------------------------------------------------------------------
  56. `timescale 1ns/1ns
  57. `include "board_common.vh"
  58. `define SIMULATION
  59. module board;
  60. parameter REF_CLK_FREQ = 0; // 0 - 100 MHz, 1 - 125 MHz, 2 - 250 MHz
  61. localparam REF_CLK_HALF_CYCLE = (REF_CLK_FREQ == 0) ? 5000 :
  62. (REF_CLK_FREQ == 1) ? 4000 :
  63. (REF_CLK_FREQ == 2) ? 2000 : 0;
  64. integer i;
  65. // System-level clock and reset
  66. reg sys_rst_n;
  67. wire ep_sys_clk_p;
  68. wire ep_sys_clk_n;
  69. wire ep_sys_clk;
  70. wire rp_sys_clk;
  71. localparam EXT_PIPE_SIM = "FALSE";
  72. //
  73. // PCI-Express Serial Interconnect
  74. //
  75. wire [1:0] ep_pci_exp_txn;
  76. wire [1:0] ep_pci_exp_txp;
  77. wire [1:0] rp_pci_exp_txn;
  78. wire [1:0] rp_pci_exp_txp;
  79. //
  80. // PCI-Express Endpoint Instance
  81. //
  82. PciVnaEmulTop PciVnaEmulTop (
  83. // SYS Inteface
  84. .sys_clk_n(ep_sys_clk_n),
  85. .sys_clk_p(ep_sys_clk_p),
  86. .sys_rst_n(sys_rst_n),
  87. // PCI-Express Interface
  88. .pci_exp_txn(ep_pci_exp_txn),
  89. .pci_exp_txp(ep_pci_exp_txp),
  90. .pci_exp_rxn(rp_pci_exp_txn),
  91. .pci_exp_rxp(rp_pci_exp_txp)
  92. );
  93. //EP (
  94. // // SYS Inteface
  95. // .sys_clk_n(ep_sys_clk_n),
  96. // .sys_clk_p(ep_sys_clk_p),
  97. // .sys_rst_n(sys_rst_n),
  98. // // PCI-Express Interface
  99. // .pci_exp_txn(ep_pci_exp_txn),
  100. // .pci_exp_txp(ep_pci_exp_txp),
  101. // .pci_exp_rxn(rp_pci_exp_txn),
  102. // .pci_exp_rxp(rp_pci_exp_txp)
  103. //);
  104. //
  105. // PCI-Express Model Root Port Instance
  106. //
  107. xilinx_pcie_2_1_rport_7x # (
  108. .REF_CLK_FREQ(0),
  109. .PL_FAST_TRAIN("TRUE"),
  110. .ALLOW_X8_GEN2("FALSE"),
  111. .C_DATA_WIDTH(64),
  112. .LINK_CAP_MAX_LINK_WIDTH(6'h2),
  113. .DEVICE_ID(16'h7100),
  114. .LINK_CAP_MAX_LINK_SPEED(4'h1),
  115. .LINK_CTRL2_TARGET_LINK_SPEED(4'h1),
  116. .DEV_CAP_MAX_PAYLOAD_SUPPORTED(2),
  117. .TRN_DW("FALSE"),
  118. .VC0_TX_LASTPACKET(29),
  119. .VC0_RX_RAM_LIMIT(13'h7FF),
  120. .VC0_CPL_INFINITE("TRUE"),
  121. .VC0_TOTAL_CREDITS_PD(437),
  122. .VC0_TOTAL_CREDITS_CD(461),
  123. .USER_CLK_FREQ(1),
  124. .USER_CLK2_DIV2("FALSE")
  125. )
  126. RP (
  127. // SYS Inteface
  128. .sys_clk(rp_sys_clk),
  129. .sys_rst_n(sys_rst_n),
  130. // PCI-Express Interface
  131. .pci_exp_txn(rp_pci_exp_txn),
  132. .pci_exp_txp(rp_pci_exp_txp),
  133. .pci_exp_rxn(ep_pci_exp_txn),
  134. .pci_exp_rxp(ep_pci_exp_txp)
  135. );
  136. sys_clk_gen # (
  137. .halfcycle(REF_CLK_HALF_CYCLE),
  138. .offset(0)
  139. )
  140. CLK_GEN_RP (
  141. .sys_clk(rp_sys_clk)
  142. );
  143. sys_clk_gen_ds # (
  144. .halfcycle(REF_CLK_HALF_CYCLE),
  145. .offset(0)
  146. )
  147. CLK_GEN_EP (
  148. .sys_clk_p(ep_sys_clk_p),
  149. .sys_clk_n(ep_sys_clk_n)
  150. );
  151. initial begin
  152. $display("[%t] : System Reset Asserted...", $realtime);
  153. sys_rst_n = 1'b0;
  154. for (i = 0; i < 500; i = i + 1) begin
  155. @(posedge ep_sys_clk_p);
  156. end
  157. $display("[%t] : System Reset De-asserted...", $realtime);
  158. sys_rst_n = 1'b1;
  159. end
  160. initial begin
  161. if ($test$plusargs ("dump_all")) begin
  162. `ifdef NCV // Cadence TRN dump
  163. $recordsetup("design=board",
  164. "compress",
  165. "wrapsize=100M",
  166. "version=1",
  167. "run=1");
  168. $recordvars();
  169. `elsif VCS //Synopsys VPD dump
  170. $vcdplusfile("board.vpd");
  171. $vcdpluson;
  172. $vcdplusglitchon;
  173. $vcdplusflush;
  174. `else
  175. // Verilog VC dump
  176. $dumpfile("board.vcd");
  177. $dumpvars(0, board);
  178. `endif
  179. end
  180. end
  181. endmodule // BOARD