PIO_EP.v 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. //-----------------------------------------------------------------------------
  2. //
  3. // (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
  4. //
  5. // This file contains confidential and proprietary information
  6. // of Xilinx, Inc. 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. // Xilinx, and to the maximum extent permitted by applicable
  15. // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
  16. // WITH ALL FAULTS, AND XILINX 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) Xilinx 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 Xilinx had been advised of the
  30. // possibility of the same.
  31. //
  32. // CRITICAL APPLICATIONS
  33. // Xilinx 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 Xilinx 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 : PIO_EP.v
  52. // Version : 3.3
  53. //
  54. // Description: Endpoint Programmed I/O module.
  55. // Consists of Receive and Transmit modules and a Memory Aperture
  56. //
  57. //------------------------------------------------------------------------------
  58. `timescale 1ps/1ps
  59. (* DowngradeIPIdentifiedWarnings = "yes" *)
  60. module PIO_EP #(
  61. parameter C_DATA_WIDTH = 64, // RX/TX interface data width
  62. // Do not override parameters below this line
  63. parameter KEEP_WIDTH = C_DATA_WIDTH / 8, // TSTRB width
  64. parameter TCQ = 1
  65. ) (
  66. input clk,
  67. input clk_50,
  68. input rst_n,
  69. // AXIS TX
  70. input s_axis_tx_tready,
  71. output [C_DATA_WIDTH-1:0] s_axis_tx_tdata,
  72. output [KEEP_WIDTH-1:0] s_axis_tx_tkeep,
  73. output s_axis_tx_tlast,
  74. output s_axis_tx_tvalid,
  75. output tx_src_dsc,
  76. //AXIS RX
  77. input [C_DATA_WIDTH-1:0] m_axis_rx_tdata,
  78. input [KEEP_WIDTH-1:0] m_axis_rx_tkeep,
  79. input m_axis_rx_tlast,
  80. input m_axis_rx_tvalid,
  81. output m_axis_rx_tready,
  82. input [21:0] m_axis_rx_tuser,
  83. output req_compl,
  84. output compl_done,
  85. input [15:0] cfg_completer_id,
  86. input [31:0] Data_i,
  87. output [31:0] Cmd_o,
  88. output [7:0] Addr_o,
  89. output ReadReq_o,
  90. output WrReq_o
  91. );
  92. // Local wires
  93. wire [10:0] rd_addr;
  94. wire [3:0] rd_be;
  95. wire [31:0] rd_data;
  96. wire [10:0] wr_addr;
  97. wire [7:0] wr_be;
  98. (* DONT_TOUCH = "yes" *) wire [31:0] wr_data;
  99. wire wr_en;
  100. wire wr_busy;
  101. wire req_compl_int;
  102. wire req_compl_wd;
  103. wire compl_done_int;
  104. wire [2:0] req_tc;
  105. wire req_td;
  106. wire req_ep;
  107. wire [1:0] req_attr;
  108. wire [9:0] req_len;
  109. wire [15:0] req_rid;
  110. wire [7:0] req_tag;
  111. wire [7:0] req_be;
  112. wire [12:0] req_addr;
  113. //
  114. // ENDPOINT MEMORY : 8KB memory aperture implemented in FPGA BlockRAM(*)
  115. //
  116. PIO_EP_MEM_ACCESS #(
  117. .TCQ( TCQ )
  118. ) EP_MEM_inst (
  119. .clk(clk), // I
  120. .rst_n(rst_n), // I
  121. // Read Port
  122. .rd_addr(rd_addr), // I [10:0]
  123. .rd_be(rd_be), // I [3:0]
  124. .rd_data(), // O [31:0]
  125. // Write Port
  126. .wr_addr(wr_addr), // I [10:0]
  127. .wr_be(wr_be), // I [7:0]
  128. .wr_data(wr_data), // I [31:0]
  129. .wr_en(wr_en), // I
  130. .wr_busy(wr_busy) // O
  131. );
  132. //
  133. // Local-Link Receive Controller
  134. //
  135. PIO_RX_ENGINE #(
  136. .C_DATA_WIDTH( C_DATA_WIDTH ),
  137. .KEEP_WIDTH( KEEP_WIDTH ),
  138. .TCQ( TCQ )
  139. ) EP_RX_inst (
  140. .clk(clk), // I
  141. .rst_n(rst_n), // I
  142. // AXIS RX
  143. .m_axis_rx_tdata( m_axis_rx_tdata ), // I
  144. .m_axis_rx_tkeep( m_axis_rx_tkeep ), // I
  145. .m_axis_rx_tlast( m_axis_rx_tlast ), // I
  146. .m_axis_rx_tvalid( m_axis_rx_tvalid ), // I
  147. .m_axis_rx_tready( m_axis_rx_tready ), // O
  148. .m_axis_rx_tuser ( m_axis_rx_tuser ), // I
  149. // Handshake with Tx engine
  150. .req_compl(req_compl_int), // O
  151. .req_compl_wd(req_compl_wd), // O
  152. .compl_done(compl_done_int), // I
  153. .req_tc(req_tc), // O [2:0]
  154. .req_td(req_td), // O
  155. .req_ep(req_ep), // O
  156. .req_attr(req_attr), // O [1:0]
  157. .req_len(req_len), // O [9:0]
  158. .req_rid(req_rid), // O [15:0]
  159. .req_tag(req_tag), // O [7:0]
  160. .req_be(req_be), // O [7:0]
  161. .req_addr(req_addr), // O [12:0]
  162. // Memory Write Port
  163. .wr_addr(wr_addr), // O [10:0]
  164. .wr_be(wr_be),
  165. .wr_data_msb(wr_data), // O [31:0]
  166. .wr_en(wr_en), // O
  167. .wr_busy(wr_busy) // I
  168. );
  169. // IntermediateLogic IntermediateLogic
  170. // (
  171. // .Clk100_i(clk),
  172. // .Clk50_i(clk_50),
  173. // .Rst_i(~rst_n),
  174. // .MeasEnd_i(MeasEnd_i),
  175. // .ReadReq_i(req_compl_int),
  176. // .ValToCfgReg_i(valToCfgReg),
  177. // .CfgData_i(wr_data),
  178. // .ValToMeasData_i(valToMeasData),
  179. // .MeasData_i(MeasData_i),
  180. // .StartMeasCmd_o(StartMeasCmd_o),
  181. // .Data_o(rd_data)
  182. // );
  183. //
  184. // Local-Link Transmit Controller
  185. //
  186. PIO_TX_ENGINE #(
  187. .C_DATA_WIDTH( C_DATA_WIDTH ),
  188. .KEEP_WIDTH( KEEP_WIDTH ),
  189. .TCQ( TCQ )
  190. )EP_TX_inst(
  191. .clk(clk), // I
  192. .rst_n(rst_n), // I
  193. // AXIS Tx
  194. .s_axis_tx_tready( s_axis_tx_tready ), // I
  195. .s_axis_tx_tdata( s_axis_tx_tdata ), // O
  196. .s_axis_tx_tkeep( s_axis_tx_tkeep ), // O
  197. .s_axis_tx_tlast( s_axis_tx_tlast ), // O
  198. .s_axis_tx_tvalid( s_axis_tx_tvalid ), // O
  199. .tx_src_dsc( tx_src_dsc ), // O
  200. // Handshake with Rx engine
  201. .req_compl(req_compl_int), // I
  202. .req_compl_wd(req_compl_wd), // I
  203. .compl_done(compl_done_int), // 0
  204. .req_tc(req_tc), // I [2:0]
  205. .req_td(req_td), // I
  206. .req_ep(req_ep), // I
  207. .req_attr(req_attr), // I [1:0]
  208. .req_len(req_len), // I [9:0]
  209. .req_rid(req_rid), // I [15:0]
  210. .req_tag(req_tag), // I [7:0]
  211. .req_be(req_be), // I [7:0]
  212. .req_addr(req_addr), // I [12:0]
  213. // Read Port
  214. .rd_addr(), // O [10:0]
  215. .rd_be(), // O [3:0]
  216. .rd_data(Data_i), // I [31:0]
  217. .completer_id(cfg_completer_id) // I [15:0]
  218. );
  219. assign req_compl = req_compl_int;
  220. assign compl_done = compl_done_int;
  221. assign Cmd_o = wr_data;
  222. assign Addr_o = wr_addr[10:2];
  223. assign ReadReq_o = req_compl_int;
  224. assign WrReq_o = wr_en;
  225. endmodule // PIO_EP