当前位置:   article > 正文

xilinx A7 (artix 7)serdes GTP 生成的example例程注释解析_downgradeipidentifiedwarnings

downgradeipidentifiedwarnings

本文首发于hifpga.com

XILINX的 serdes GT IP真的是够复杂的,生成的例子也是复杂,而且为了适配各种情况,代码里很多冗余的东西,发送部分比较简单 ,接收部分有点繁琐,我做了点注释,这里的只做的GTP的,GTX的自己看吧。 

  1. ///
  2. // ____ ____
  3. // / /\/ /
  4. // /___/ \ / Vendor: Xilinx
  5. // \ \ \/ Version : 3.6
  6. // \ \ Application : 7 Series FPGAs Transceivers Wizard
  7. // / / Filename : gtwizard_0_gt_frame_check.v
  8. // /___/ /\
  9. // \ \ / \
  10. // \___\/\___\
  11. //
  12. //
  13. // Module gtwizard_0_GT_FRAME_CHECK
  14. // Generated by Xilinx 7 Series FPGAs Transceivers Wizard
  15. //
  16. //
  17. // (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
  18. //
  19. // This file contains confidential and proprietary information
  20. // of Xilinx, Inc. and is protected under U.S. and
  21. // international copyright and other intellectual property
  22. // laws.
  23. //
  24. // DISCLAIMER
  25. // This disclaimer is not a license and does not grant any
  26. // rights to the materials distributed herewith. Except as
  27. // otherwise provided in a valid license issued to you by
  28. // Xilinx, and to the maximum extent permitted by applicable
  29. // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
  30. // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
  31. // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
  32. // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
  33. // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
  34. // (2) Xilinx shall not be liable (whether in contract or tort,
  35. // including negligence, or under any other theory of
  36. // liability) for any loss or damage of any kind or nature
  37. // related to, arising under or in connection with these
  38. // materials, including for any direct, or any indirect,
  39. // special, incidental, or consequential loss or damage
  40. // (including loss of data, profits, goodwill, or any type of
  41. // loss or damage suffered as a result of any action brought
  42. // by a third party) even if such damage or loss was
  43. // reasonably foreseeable or Xilinx had been advised of the
  44. // possibility of the same.
  45. //
  46. // CRITICAL APPLICATIONS
  47. // Xilinx products are not designed or intended to be fail-
  48. // safe, or for use in any application requiring fail-safe
  49. // performance, such as life-support or safety devices or
  50. // systems, Class III medical devices, nuclear facilities,
  51. // applications related to the deployment of airbags, or any
  52. // other applications that could lead to death, personal
  53. // injury, or severe property or environmental damage
  54. // (individually and collectively, "Critical
  55. // Applications"). Customer assumes the sole risk and
  56. // liability of any use of Xilinx products in Critical
  57. // Applications, subject only to applicable laws and
  58. // regulations governing limitations on product liability.
  59. //
  60. // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
  61. // PART OF THIS FILE AT ALL TIMES.
  62. `timescale 1ns / 1ps
  63. `define DLY #1
  64. //***********************************Entity Declaration************************
  65. (* DowngradeIPIdentifiedWarnings="yes" *)
  66. module gtwizard_0_GT_FRAME_CHECK #
  67. (
  68. // parameter to set the number of words in the BRAM
  69. parameter RX_DATA_WIDTH = 64,
  70. parameter RXCTRL_WIDTH = 2,
  71. parameter WORDS_IN_BRAM = 512,
  72. parameter CHANBOND_SEQ_LEN = 1,
  73. parameter COMMA_DOUBLE = 16'hf628,
  74. parameter START_OF_PACKET_CHAR = 64'h00000000000000fb
  75. )
  76. (
  77. // User Interface
  78. input wire [(RX_DATA_WIDTH-1):0] RX_DATA_IN,
  79. input wire [(RXCTRL_WIDTH-1):0] RXCTRL_IN,
  80. output reg RXENPCOMMADET_OUT, // 未用,高电平有效信号,可实现字节边界对齐检测到plus COMMA模式时进行处理。
  81. output reg RXENMCOMMADET_OUT, // 未用,高电平有效信号,可实现字节边界对齐检测到minus COMMA模式时进行处理。
  82. output reg RX_ENCHAN_SYNC_OUT, // 未用,驱动mgt的enchansync端口进行通道绑定
  83. input wire RX_CHANBOND_SEQ_IN, // 输入通道绑定序列,不绑定时为0
  84. // Control Interface
  85. input wire INC_IN, // 未用
  86. output wire INC_OUT, // 非独立的收发测试时输出已开始进行COMMA检测,指示发送端地址递增
  87. output wire PATTERN_MATCHB_OUT, // COMMA不匹配
  88. input wire RESET_ON_ERROR_IN, // 通过将PATTERN_MATCHB_OUT输出给外部,由此产生出错后的复位
  89. // Error Monitoring
  90. output wire [7:0] ERROR_COUNT_OUT, // 错误数
  91. // Track Data
  92. output wire TRACK_DATA_OUT, // 指示接收到的数据是否符合预期
  93. output wire RX_SLIDE, // 在对齐时要求GT滑动
  94. // System Interface
  95. input wire USER_CLK,
  96. input wire SYSTEM_RESET
  97. );
  98. //***************************Internal Register Declarations********************
  99. reg reset_on_error_in_r;
  100. reg reset_on_error_in_r2;
  101. (* ASYNC_REG = "TRUE" *) (* keep = "true" *)reg system_reset_r;
  102. (* ASYNC_REG = "TRUE" *) (* keep = "true" *)reg system_reset_r2;
  103. reg begin_r;
  104. reg data_error_detected_r;
  105. reg [8:0] error_count_r;
  106. reg error_detected_r;
  107. reg [9:0] read_counter_i;
  108. reg [79:0] rom [0:511];
  109. reg [(RX_DATA_WIDTH-1):0] rx_data_r;
  110. reg [(RX_DATA_WIDTH-1):0] rx_data_r_track;
  111. reg start_of_packet_detected_r;
  112. reg track_data_r;
  113. reg track_data_r2;
  114. reg track_data_r3;
  115. reg [79:0] rx_data_ram_r;
  116. reg [(RX_DATA_WIDTH-1):0] rx_data_r2;
  117. reg [(RX_DATA_WIDTH-1):0] rx_data_r3;
  118. reg [(RX_DATA_WIDTH-1):0] rx_data_r4;
  119. reg [(RX_DATA_WIDTH-1):0] rx_data_r5;
  120. reg [(RX_DATA_WIDTH-1):0] rx_data_r6;
  121. reg [(RXCTRL_WIDTH-1):0] rxctrl_r;
  122. reg [(RXCTRL_WIDTH-1):0] rxctrl_r2;
  123. reg [(RXCTRL_WIDTH-1):0] rxctrl_r3;
  124. reg rx_chanbond_seq_r;
  125. reg rx_chanbond_seq_r2;
  126. reg rx_chanbond_seq_r3;
  127. reg idle_slip_r;
  128. reg slip_assert_r;
  129. reg wait_state_r;
  130. reg bit_align_r;
  131. reg [6:0] wait_before_slip_r;
  132. reg [6:0] wait_before_init_r;
  133. reg [1:0] sel;
  134. //*********************************Wire Declarations***************************
  135. wire [(RX_DATA_WIDTH-1):0] bram_data_r;
  136. wire error_detected_c;
  137. wire next_begin_c;
  138. wire next_data_error_detected_c;
  139. wire next_track_data_c;
  140. wire start_of_packet_detected_c;
  141. wire chanbondseq_in_data;
  142. wire input_to_chanbond_data_i;
  143. wire input_to_chanbond_reg_i;
  144. wire [(CHANBOND_SEQ_LEN-1):0] rx_chanbond_reg;
  145. wire rxdata_or;
  146. wire count_slip_complete_c;
  147. wire next_idle_slip_c;
  148. wire next_slip_assert_c;
  149. wire wait_state_c;
  150. wire [(RX_DATA_WIDTH-1):0] rx_data_aligned;
  151. wire rx_data_has_start_char_c;
  152. wire tied_to_ground_i;
  153. wire [31:0] tied_to_ground_vec_i;
  154. wire tied_to_vcc_i;
  155. //*********************************Main Body of Code***************************
  156. //_______________________ Static signal Assigments _______________________
  157. assign tied_to_ground_i = 1'b0;
  158. assign tied_to_ground_vec_i = 32'h0000;
  159. assign tied_to_vcc_i = 1'b1;
  160. //___________ synchronizing the async reset for ease of timing simulation ________
  161. always@(posedge USER_CLK)
  162. begin
  163. system_reset_r <= `DLY SYSTEM_RESET;
  164. system_reset_r2 <= `DLY system_reset_r;
  165. end
  166. always@(posedge USER_CLK)
  167. begin
  168. reset_on_error_in_r <= `DLY RESET_ON_ERROR_IN;
  169. reset_on_error_in_r2 <= `DLY reset_on_error_in_r;
  170. end
  171. //______________________ Register RXDATA once to ease timing ______________
  172. always @(posedge USER_CLK)
  173. begin
  174. rx_data_r <= `DLY RX_DATA_IN;
  175. rx_data_r2 <= `DLY rx_data_r;
  176. end
  177. always @(posedge USER_CLK)
  178. begin
  179. rxctrl_r <= `DLY RXCTRL_IN;
  180. end
  181. //________________________________ State machine __________________________
  182. // State registers
  183. always @(posedge USER_CLK)
  184. if(system_reset_r2)
  185. {begin_r,track_data_r,data_error_detected_r} <= `DLY 3'b100;
  186. else
  187. begin
  188. begin_r <= `DLY next_begin_c;
  189. track_data_r <= `DLY next_track_data_c;
  190. data_error_detected_r <= `DLY next_data_error_detected_c;
  191. end
  192. // Next state logic
  193. assign next_begin_c = (begin_r && !start_of_packet_detected_r) // 产生启动请求信号,在该信号复位为高后且未收到已开始数据检测的指示时保持为高,或数据出错时
  194. || data_error_detected_r ;
  195. assign next_track_data_c = (begin_r && start_of_packet_detected_r) // 产生检测数据跟踪请求,在启动为高后且收到开始检测到有效数据的指示时保持为高,或者已启动数据跟踪且未出错时
  196. || (track_data_r && !error_detected_r);
  197. assign next_data_error_detected_c = (track_data_r && error_detected_r); // 已启动跟踪,且检测到了错误
  198. assign start_of_packet_detected_c = rx_data_has_start_char_c; // 已开始检测到有效数据
  199. always @(posedge USER_CLK)
  200. start_of_packet_detected_r <= `DLY start_of_packet_detected_c;
  201. // Registering for timing
  202. always @(posedge USER_CLK)
  203. track_data_r2 <= `DLY track_data_r;
  204. always @(posedge USER_CLK)
  205. track_data_r3 <= `DLY track_data_r2;
  206. //______________________________ Capture incoming data ____________________
  207. // 根据COMMA出现的位置将32b重新对齐
  208. always @(posedge USER_CLK)
  209. begin
  210. if(system_reset_r2) rx_data_r3 <= 'h0;
  211. else
  212. begin
  213. if(sel == 2'b01)
  214. begin
  215. rx_data_r3 <= `DLY {rx_data_r[(RX_DATA_WIDTH/4-1):0],rx_data_r2[(RX_DATA_WIDTH - 1):RX_DATA_WIDTH/4]};
  216. end
  217. else if(sel == 2'b10)
  218. begin
  219. rx_data_r3 <= `DLY {rx_data_r[(2*RX_DATA_WIDTH/4-1):0],rx_data_r2[(RX_DATA_WIDTH - 1):2*RX_DATA_WIDTH/4]};
  220. end
  221. else if(sel == 2'b11)
  222. begin
  223. rx_data_r3 <= `DLY {rx_data_r[(3*RX_DATA_WIDTH/4 - 1):0],rx_data_r2[(RX_DATA_WIDTH-1):3*RX_DATA_WIDTH/4]};
  224. end
  225. else rx_data_r3 <= `DLY rx_data_r2;
  226. end
  227. end
  228. always @(posedge USER_CLK)
  229. begin
  230. if(system_reset_r2)
  231. begin
  232. rx_data_r4 <= `DLY 'h0;
  233. rx_data_r5 <= `DLY 'h0;
  234. rx_data_r6 <= `DLY 'h0;
  235. rx_data_r_track <= `DLY 'h0;
  236. end
  237. else
  238. begin
  239. rx_data_r4 <= `DLY rx_data_r3;
  240. rx_data_r5 <= `DLY rx_data_r4;
  241. rx_data_r6 <= `DLY rx_data_r5;
  242. rx_data_r_track <= `DLY rx_data_r6;
  243. end
  244. end
  245. always @(posedge USER_CLK)
  246. begin
  247. if(system_reset_r2)
  248. begin
  249. rxctrl_r2 <= `DLY 'h0;
  250. rxctrl_r3 <= `DLY 'h0;
  251. end
  252. else
  253. begin
  254. rxctrl_r2 <= `DLY rxctrl_r;
  255. rxctrl_r3 <= `DLY rxctrl_r2;
  256. end
  257. end
  258. assign rx_data_aligned = rx_data_r3;
  259. //___________________________ Code for Channel bonding ____________________
  260. // code to prevent checking of clock correction sequences for the start of packet char
  261. always @(posedge USER_CLK)
  262. begin
  263. rx_chanbond_seq_r <= `DLY RX_CHANBOND_SEQ_IN;
  264. rx_chanbond_seq_r2 <= `DLY rx_chanbond_seq_r;
  265. rx_chanbond_seq_r3 <= `DLY rx_chanbond_seq_r2;
  266. end
  267. assign input_to_chanbond_reg_i = rx_chanbond_seq_r2; //一直为0
  268. assign input_to_chanbond_data_i = tied_to_ground_i;
  269. //______________ Code for Bit Slipping Logic______________
  270. assign rxdata_or = |(rx_data_r|rx_data_r2|rx_data_r3); // 通道有收到数据
  271. // State registers
  272. always @(posedge USER_CLK)
  273. if( (system_reset_r2 == 1'b1) | (wait_before_init_r[6] == 1'b0) | (rxdata_or == 1'b0) )
  274. {idle_slip_r,slip_assert_r,wait_state_r} <= `DLY 3'b100;
  275. else
  276. begin
  277. idle_slip_r <= `DLY next_idle_slip_c;
  278. slip_assert_r <= `DLY next_slip_assert_c;
  279. wait_state_r <= `DLY wait_state_c;
  280. end
  281. // Next state logic
  282. assign next_idle_slip_c = (idle_slip_r & bit_align_r) | (wait_state_r & count_slip_complete_c); // slip操作空闲信号,当复为后且bit已对齐时,或者已完成执行滑窗后的等待
  283. assign next_slip_assert_c = (idle_slip_r & !bit_align_r); // 继续执行slip,上一slip操作已完成,但bit仍未对齐
  284. assign wait_state_c = (slip_assert_r) | (wait_state_r & !count_slip_complete_c); // slip请求已产生,但是等待操作还未完成,则持续等待
  285. //_______ Counter for waiting clock cycles after RXSLIDE________
  286. always @(posedge USER_CLK)
  287. begin
  288. if (!wait_state_r)
  289. wait_before_slip_r <= `DLY 7'b000000;
  290. else
  291. wait_before_slip_r <= `DLY wait_before_slip_r + 1'b1; // slip操作等待计时器
  292. end
  293. //_______ Counter for waiting clock cycles before starting RXSLIDE operation________
  294. //_______ Wait for 64 clock cycles to see if the RXDATA is already byte aligned. If not, start RXSLIDE operation
  295. always @(posedge USER_CLK)
  296. begin
  297. if( (system_reset_r2 == 1'b1) | (rxdata_or == 1'b0) )
  298. wait_before_init_r <= `DLY 7'b0000000;
  299. else if (wait_before_init_r[6] == 1'b0) // 在启动接收前等待64clk
  300. wait_before_init_r <= `DLY wait_before_init_r + 1'b1;
  301. end
  302. assign count_slip_complete_c = wait_before_slip_r[6];
  303. always @(posedge USER_CLK)
  304. begin
  305. if( (system_reset_r2 == 1'b1) | (rxdata_or == 1'b0) ) begin
  306. bit_align_r <= 1'b0;
  307. end else begin
  308. if( ({rx_data_r[23:0],rx_data_r2[31:24]} == START_OF_PACKET_CHAR) || ({rx_data_r[15:0],rx_data_r2[31:16]} == START_OF_PACKET_CHAR)
  309. || ({rx_data_r[7:0],rx_data_r2[31:8]} == START_OF_PACKET_CHAR) || (rx_data_r[31:0]== START_OF_PACKET_CHAR) )
  310. begin
  311. bit_align_r <= 1'b1; // 比较COMMA所有可能存在的4种情况以确定bit对齐
  312. end
  313. end
  314. end
  315. // Comma realignment logic might be needed. 4 levels of registering for RXDATA to meet timing
  316. // In 4 Byte scenario, when align_comma_word=1, Comma can appear on any of the four bytes.
  317. // { BYTE3 | BYTE2 | BYTE1 | BYTE0 } - Comma can appear on BYTE0/1/2/3
  318. // If Comma appears on BYTE1/2/3, RX_DATA is realigned so that Comma appears on BYTE0 in rx_data_r_track
  319. always @(posedge USER_CLK)
  320. begin
  321. if(reset_on_error_in_r2 || system_reset_r2) sel <= 2'b00;
  322. else if (begin_r && !rx_chanbond_seq_r)
  323. begin
  324. // if Comma appears on BYTE3 ..
  325. if((rx_data_r[(RX_DATA_WIDTH - 1) : 3*RX_DATA_WIDTH/4] == START_OF_PACKET_CHAR[7:0]) && rxctrl_r[3]) // rxctrl_r 指示COMMA出现的位置,并比较收的包头是否匹配
  326. sel <= 2'b11;
  327. // if Comma appears on BYTE2 ..
  328. else if((rx_data_r[(3*RX_DATA_WIDTH/4 - 1):2*RX_DATA_WIDTH/4] == START_OF_PACKET_CHAR[7:0]) && rxctrl_r[2])
  329. begin
  330. sel <= 2'b10;
  331. end
  332. // if Comma appears on BYTE1 ..
  333. else if((rx_data_r[(2*RX_DATA_WIDTH/4 - 1):RX_DATA_WIDTH/4] == START_OF_PACKET_CHAR[7:0]) && rxctrl_r[1])
  334. begin
  335. sel <= 2'b01;
  336. end
  337. // if Comma appears on BYTE0 ..
  338. else if((rx_data_r[(RX_DATA_WIDTH/4 - 1):0] == START_OF_PACKET_CHAR[7:0]) && rxctrl_r[0])
  339. begin
  340. sel <= 2'b00;
  341. end
  342. end
  343. end
  344. //___________________________ Code for Channel bonding ____________________
  345. // code to prevent checking of clock correction sequences for the start of packet char
  346. genvar i;
  347. generate
  348. for (i=0;i<CHANBOND_SEQ_LEN ;i=i+1)
  349. begin:register_chan_seq
  350. if(i==0)
  351. FD rx_chanbond_reg_0 ( .Q (rx_chanbond_reg[i]), .D (input_to_chanbond_reg_i), .C(USER_CLK));
  352. else
  353. FD rx_chanbond_reg_i ( .Q (rx_chanbond_reg[i]), .D (rx_chanbond_reg[i-1]), .C(USER_CLK));
  354. end
  355. endgenerate
  356. assign chanbondseq_in_data = |rx_chanbond_reg || input_to_chanbond_data_i; // 未绑定始终为0
  357. assign rx_data_has_start_char_c = (rx_data_aligned[7:0] == START_OF_PACKET_CHAR[7:0]) && !chanbondseq_in_data && (|rxctrl_r3); // 只要对齐后的数据有一byte匹配
  358. //_____________________________ Assign output ports _______________________
  359. //assign TRACK_DATA_OUT = track_data_r;
  360. assign RX_SLIDE = slip_assert_r; // 输出slip信号
  361. // Drive the enpcommaalign port of the gt for alignment
  362. // Active-High signal that enables the byte boundary alignment process when the plus comma pattern is detected.
  363. always @(posedge USER_CLK)
  364. if(system_reset_r2) RXENPCOMMADET_OUT <= `DLY 1'b0;
  365. else RXENPCOMMADET_OUT <= `DLY 1'b1;
  366. // Drive the enmcommaalign port of the gt for alignment
  367. // Active-High signal that enables the byte boundary alignment process when the minus comma pattern is detected.
  368. always @(posedge USER_CLK)
  369. if(system_reset_r2) RXENMCOMMADET_OUT <= `DLY 1'b0;
  370. else RXENMCOMMADET_OUT <= `DLY 1'b1;
  371. assign INC_OUT = start_of_packet_detected_c;
  372. assign PATTERN_MATCHB_OUT = data_error_detected_r;
  373. // Drive the enchansync port of the mgt for channel bonding
  374. always @(posedge USER_CLK)
  375. if(system_reset_r2) RX_ENCHAN_SYNC_OUT <= `DLY 1'b0;
  376. else RX_ENCHAN_SYNC_OUT <= `DLY 1'b1;
  377. //___________________________ Check incoming data for errors ______________
  378. //An error is detected when data read for the BRAM does not match the incoming data
  379. assign error_detected_c = track_data_r3 && (rx_data_r_track != bram_data_r); // 数据与ROM中不匹配
  380. //We register the error_detected signal for use with the error counter logic
  381. always @(posedge USER_CLK)
  382. if(!track_data_r)
  383. error_detected_r <= `DLY 1'b0;
  384. else
  385. error_detected_r <= `DLY error_detected_c;
  386. //We count the total number of errors we detect. By keeping a count we make it less likely that we will miss
  387. //errors we did not directly observe.
  388. always @(posedge USER_CLK)
  389. if(system_reset_r2)
  390. error_count_r <= `DLY 9'd0;
  391. else if(error_detected_r)
  392. error_count_r <= `DLY error_count_r + 1;
  393. //Here we connect the lower 8 bits of the count (the MSbit is used only to check when the counter reaches
  394. //max value) to the module output
  395. assign ERROR_COUNT_OUT = error_count_r[7:0];
  396. localparam ST_LINK_DOWN = 1'b0;
  397. localparam ST_LINK_UP = 1'b1;
  398. reg sm_link = ST_LINK_DOWN;
  399. reg [6:0] link_ctr = 7'd0;
  400. always @(posedge USER_CLK) begin
  401. if(!track_data_r)
  402. sm_link <= ST_LINK_DOWN;
  403. else
  404. case (sm_link)
  405. // The link is considered to be down when the link counter initially has a value less than 67. When the link is
  406. // down, the counter is incremented on each cycle where all PRBS bits match, but reset whenever any PRBS mismatch
  407. // occurs. When the link counter reaches 67, transition to the link up state.
  408. ST_LINK_DOWN: begin
  409. if (error_detected_r !== 1'b0) begin
  410. link_ctr <= 7'd0;
  411. end
  412. else begin
  413. if (link_ctr < 7'd67)
  414. link_ctr <= link_ctr + 7'd1;
  415. else
  416. sm_link <= ST_LINK_UP;
  417. end
  418. end
  419. // When the link is up, the link counter is decreased by 34 whenever any PRBS mismatch occurs, but is increased by
  420. // only 1 on each cycle where all PRBS bits match, up to its saturation point of 67. If the link counter reaches
  421. // 0 (including rollover protection), transition to the link down state.
  422. ST_LINK_UP: begin
  423. if (error_detected_r !== 1'b0) begin
  424. if (link_ctr > 7'd33) begin
  425. link_ctr <= link_ctr - 7'd34;
  426. if (link_ctr == 7'd34)
  427. sm_link <= ST_LINK_DOWN;
  428. end
  429. else begin
  430. link_ctr <= 7'd0;
  431. sm_link <= ST_LINK_DOWN;
  432. end
  433. end
  434. else begin
  435. if (link_ctr < 7'd67)
  436. link_ctr <= link_ctr + 7'd1;
  437. end
  438. end
  439. endcase
  440. end
  441. assign TRACK_DATA_OUT = sm_link;
  442. //____________________________ Counter to read from BRAM __________________________
  443. always @(posedge USER_CLK)
  444. if(system_reset_r2 || (read_counter_i == (WORDS_IN_BRAM-1)))
  445. begin
  446. read_counter_i <= `DLY 10'd0;
  447. end
  448. else if (start_of_packet_detected_r && !track_data_r)
  449. begin
  450. read_counter_i <= `DLY 10'd0;
  451. end
  452. else
  453. begin
  454. read_counter_i <= `DLY read_counter_i + 10'd1;
  455. end
  456. //________________________________ BRAM Inference Logic _____________________________
  457. //Array slice from dat file to compare against receive data
  458. generate
  459. if(RX_DATA_WIDTH==80)
  460. begin : datapath_80
  461. assign bram_data_r = rx_data_ram_r[(RX_DATA_WIDTH-1):0];
  462. end
  463. else
  464. begin : datapath_16_20_32_40_64
  465. assign bram_data_r = rx_data_ram_r[(16+RX_DATA_WIDTH-1):16];
  466. end
  467. endgenerate
  468. `ifdef SIM
  469. initial
  470. begin
  471. $readmemh("gt_rom_init_rx.dat",rom,0,511);
  472. end
  473. always @(posedge USER_CLK)
  474. rx_data_ram_r <= `DLY rom[read_counter_i];
  475. `else
  476. always @(posedge USER_CLK)
  477. rx_data_ram_r <= 'haa5555aa;//`DLY rom[read_counter_i];
  478. `endif
  479. endmodule

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/993431
推荐阅读
相关标签
  

闽ICP备14008679号