jesd204_tb: Update testbench to support dynamic multi-link on RX side

main
Istvan Csomortani 2018-03-27 15:50:05 +01:00 committed by István Csomortáni
parent 0e099b6f08
commit 36a3335093
2 changed files with 20 additions and 7 deletions

View File

@ -45,6 +45,7 @@
module axi_jesd204_rx_tb;
parameter VCD_FILE = "axi_jesd204_rx_regmap_tb.vcd";
parameter NUM_LANES = 2;
parameter NUM_LINKS = 1;
`define TIMEOUT 1000000
`include "tb_base.v"
@ -272,6 +273,10 @@ module axi_jesd204_rx_tb;
write_reg_and_update('h200, {NUM_LANES{1'b1}});
check_all_registers();
/* Check links enable */
write_reg_and_update('h204, {NUM_LINKS{1'b1}});
check_all_registers();
/* Check JESD common config */
write_reg_and_update('h210, 32'hff03ff);
check_all_registers();
@ -287,10 +292,10 @@ module axi_jesd204_rx_tb;
check_all_registers();
/* Should be read-only when core is out of reset */
invert_register('h200);
invert_register('h204);
invert_register('h210);
invert_register('h240);
invert_register('h200); /* lanes enable */
invert_register('h204); /* links enable */
invert_register('h210); /* octets per frame, beats per multiframe */
invert_register('h240); /* char replacement, scrambler */
check_all_registers();
@ -308,7 +313,8 @@ module axi_jesd204_rx_tb;
end
axi_jesd204_rx #(
.NUM_LANES(NUM_LANES)
.NUM_LANES(NUM_LANES),
.NUM_LINKS(NUM_LINKS)
) i_axi (
.s_axi_aclk(s_axi_aclk),
.s_axi_aresetn(s_axi_aresetn),

View File

@ -45,6 +45,7 @@
module rx_tb;
parameter VCD_FILE = "rx_tb.vcd";
parameter NUM_LANES = 1;
parameter NUM_LINKS = 1;
parameter OCTETS_PER_FRAME = 8;
parameter FRAMES_PER_MULTIFRAME = 32;
@ -96,12 +97,13 @@ module rx_tb;
reg [3:0] charisk = 4'b1111;
reg [3:0] disperr = 4'b0000;
reg [3:0] notintable = 4'b0000;
wire [NUM_LINKS-1:0] sync;
integer counter = 'h00;
wire [31:0] counter2 = (counter - 'h10) * 4;
always @(posedge clk) begin
if (sync == 1'b0) begin
if ( &sync == 1'b0 ) begin
counter <= 'h00;
charisk <= 4'b1111;
data <= {KCHAR_CGS,KCHAR_CGS,KCHAR_CGS,KCHAR_CGS};
@ -134,6 +136,7 @@ module rx_tb;
end
wire [NUM_LANES-1:0] cfg_lanes_disable;
wire [NUM_LINKS-1:0] cfg_links_disable;
wire [7:0] cfg_beats_per_multiframe;
wire [7:0] cfg_octets_per_frame;
wire [7:0] cfg_lmfc_offset;
@ -144,12 +147,14 @@ module rx_tb;
jesd204_rx_static_config #(
.NUM_LANES(NUM_LANES),
.NUM_LINKS(NUM_LINKS),
.OCTETS_PER_FRAME(OCTETS_PER_FRAME),
.FRAMES_PER_MULTIFRAME(FRAMES_PER_MULTIFRAME)
) i_cfg (
.clk(clk),
.cfg_lanes_disable(cfg_lanes_disable),
.cfg_links_disable(cfg_links_disable),
.cfg_beats_per_multiframe(cfg_beats_per_multiframe),
.cfg_octets_per_frame(cfg_octets_per_frame),
.cfg_lmfc_offset(cfg_lmfc_offset),
@ -160,12 +165,14 @@ module rx_tb;
);
jesd204_rx #(
.NUM_LANES(NUM_LANES)
.NUM_LANES(NUM_LANES),
.NUM_LINKS(NUM_LINKS)
) i_rx (
.clk(clk),
.reset(reset),
.cfg_lanes_disable(cfg_lanes_disable),
.cfg_links_disable(cfg_links_disable),
.cfg_beats_per_multiframe(cfg_beats_per_multiframe),
.cfg_octets_per_frame(cfg_octets_per_frame),
.cfg_lmfc_offset(cfg_lmfc_offset),