Skip to content

Commit

Permalink
jesd204/tb: Update testbenches
Browse files Browse the repository at this point in the history
  • Loading branch information
ronagyl committed Feb 5, 2021
1 parent 589cfc6 commit 9418120
Show file tree
Hide file tree
Showing 13 changed files with 590 additions and 259 deletions.
21 changes: 14 additions & 7 deletions library/jesd204/tb/axi_jesd204_rx_regmap_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ module axi_jesd204_rx_regmap_tb;
for (i = 0; i < 1024; i = i + 1)
expected_reg_mem[i] <= 'h00;
/* Non zero power-on-reset values */
set_reset_reg_value('h00, 32'h00010261); /* PCORE version register */
set_reset_reg_value('h00, 32'h00010761); /* PCORE version register */
set_reset_reg_value('h0c, 32'h32303452); /* PCORE magic register */
set_reset_reg_value('h10, NUM_LANES); /* Number of lanes */
set_reset_reg_value('h18, NUM_LINKS); /* Number of links */
Expand All @@ -174,7 +174,8 @@ module axi_jesd204_rx_regmap_tb;
set_reset_reg_value('hc0, 'h1); /* Core reset */
set_reset_reg_value('hc4, 'h1); /* Core state */
// set_reset_reg_value('hc8, 'h28000); /* clock monitor */
set_reset_reg_value('h210, 'h3); /* OCTETS_PER_MULTIFRAME */
set_reset_reg_value('h210, 'h0); /* OCTETS_PER_MULTIFRAME */
set_reset_reg_value('h248, 'h4); /* FRAME_ALIGN_ERR_THRESHOLD */

/* Lane error statistics */
for (i = 0; i < NUM_LANES; i = i + 1) begin
Expand Down Expand Up @@ -310,7 +311,7 @@ module axi_jesd204_rx_regmap_tb;

/* Should be read-only when core is out of reset */
invert_register('h200); /* lanes enable */
invert_register('h210); /* octets per frame, beats per multiframe */
invert_register('h210); /* octets per frame, octets per multiframe */
invert_register('h218); /* links enable */
invert_register('h240); /* char replacement, scrambler */

Expand Down Expand Up @@ -362,17 +363,23 @@ module axi_jesd204_rx_regmap_tb;
.core_ilas_config_addr({NUM_LANES{core_ilas_config_addr}}),
.core_ilas_config_data(core_ilas_config_data),

.core_event_sysref_alignment_error(1'b0),
.core_event_sysref_edge(1'b0),
.device_event_sysref_alignment_error(1'b0),
.device_event_sysref_edge(1'b0),

.core_status_err_statistics_cnt(core_status_err_statistics_cnt),
.core_ctrl_err_statistics_mask(),
.core_ctrl_err_statistics_reset(),

.core_status_ctrl_state(2'b00),
.core_status_lane_cgs_state(4'b0000),
.core_status_lane_cgs_state({NUM_LANES{2'b0}}),
.core_status_lane_emb_state({NUM_LANES{3'b0}}),
.core_status_lane_ifs_ready({NUM_LANES{1'b0}}),
.core_status_lane_latency({NUM_LANES{14'h00}})
.core_status_lane_latency({NUM_LANES{14'h00}}),
.core_status_lane_frame_align_err_cnt({NUM_LANES{8'b0}}),

.status_synth_params0(NUM_LANES),
.status_synth_params1(2),
.status_synth_params2(NUM_LINKS)
);

endmodule
19 changes: 13 additions & 6 deletions library/jesd204/tb/axi_jesd204_tx_regmap_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ module axi_jesd204_tx_regmap_tb;
read_reg(addr, value);
expected = expected_reg_mem[addr[13:2]];
match <= value === expected;
if (value !== expected) begin
$display("Address %h, Expected %h, Found %h", addr, expected, value);
end
end
endtask

Expand All @@ -160,15 +163,15 @@ module axi_jesd204_tx_regmap_tb;
for (i = 0; i < 1024; i = i + 1)
expected_reg_mem[i] <= 'h00;
/* Non zero power-on-reset values */
set_reset_reg_value('h00, 32'h00010161); /* PCORE version register */
set_reset_reg_value('h00, 32'h00010661); /* PCORE version register */
set_reset_reg_value('h0c, 32'h32303454); /* PCORE magic register */
set_reset_reg_value('h10, NUM_LANES); /* Number of lanes */
set_reset_reg_value('h14, 'h2); /* Datapath width */
set_reset_reg_value('h18, NUM_LINKS); /* Number of links */
set_reset_reg_value('hc0, 'h1); /* Link disable */
set_reset_reg_value('hc4, 'h1); /* Core state */
// set_reset_reg_value('hc8, 'h80000); /* clock monitor */
set_reset_reg_value('h210, 'h3); /* OCTETS_PER_MULTIFRAME */
set_reset_reg_value('h210, 'h0); /* OCTETS_PER_MULTIFRAME */

set_reset_reg_value('h244, 'h3); /* MFRAMES_PER_ILAS */
end
Expand Down Expand Up @@ -247,7 +250,7 @@ module axi_jesd204_tx_regmap_tb;
/* Check JESD common config */
write_reg_and_update('h210, 32'hff03ff);
check_all_registers();
write_reg_and_update('h214, 32'h03);
write_reg_and_update('h214, 32'h00);
check_all_registers();

/* Check links disable */
Expand Down Expand Up @@ -356,11 +359,15 @@ module axi_jesd204_tx_regmap_tb;
.core_ilas_config_rd(1'b1),
.core_ilas_config_addr(2'b00),

.core_event_sysref_alignment_error(1'b0),
.core_event_sysref_edge(1'b0),
.device_event_sysref_alignment_error(1'b0),
.device_event_sysref_edge(1'b0),

.core_status_state(core_status_state),
.core_status_sync(core_status_sync)
.core_status_sync(core_status_sync),

.status_synth_params0(NUM_LANES),
.status_synth_params1(2),
.status_synth_params2(NUM_LINKS)
);

endmodule
1 change: 1 addition & 0 deletions library/jesd204/tb/frame_align_tb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SOURCE+=" ../jesd204_tx/jesd204_tx.v ../jesd204_tx/jesd204_tx_ctrl.v ../jesd204_
SOURCE+=" ../jesd204_tx_static_config/jesd204_tx_static_config.v"
SOURCE+=" ../jesd204_tx_static_config/jesd204_ilas_cfg_static.v"
SOURCE+=" ../../util_cdc/sync_bits.v"
SOURCE+=" ../../util_cdc/sync_event.v"

cd `dirname $0`
source run_tb.sh
121 changes: 85 additions & 36 deletions library/jesd204/tb/frame_align_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ module frame_align_tb;
wire [NUM_LINKS-1:0] tx_cfg_links_disable;
wire [9:0] tx_cfg_octets_per_multiframe;
wire [7:0] tx_cfg_octets_per_frame;
wire [7:0] tx_cfg_lmfc_offset;
wire tx_cfg_sysref_disable;
wire tx_cfg_sysref_oneshot;
wire [7:0] tx_device_cfg_lmfc_offset;
wire [9:0] tx_device_cfg_octets_per_multiframe;
wire [7:0] tx_device_cfg_octets_per_frame;
wire [7:0] tx_device_cfg_beats_per_multiframe;
wire tx_device_cfg_sysref_disable;
wire tx_device_cfg_sysref_oneshot;
wire tx_cfg_continuous_cgs;
wire tx_cfg_continuous_ilas;
wire tx_cfg_skip_ilas;
Expand Down Expand Up @@ -262,24 +265,29 @@ module frame_align_tb;
.LINK_MODE(1),
.SYSREF_DISABLE(SYSREF_DISABLE),
.SYSREF_ONE_SHOT(SYSREF_ONE_SHOT),
.DATA_PATH_WIDTH(DATA_PATH_WIDTH)
.DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.TPL_DATA_PATH_WIDTH(DATA_PATH_WIDTH)
) i_tx_cfg (
.clk(clk),

.cfg_lanes_disable(tx_cfg_lanes_disable),
.cfg_links_disable(tx_cfg_links_disable),
.cfg_octets_per_multiframe(tx_cfg_octets_per_multiframe),
.cfg_octets_per_frame(tx_cfg_octets_per_frame),
.cfg_lmfc_offset(tx_cfg_lmfc_offset),
.cfg_sysref_disable(tx_cfg_sysref_disable),
.cfg_sysref_oneshot(tx_cfg_sysref_oneshot),
.cfg_continuous_cgs(tx_cfg_continuous_cgs),
.cfg_continuous_ilas(tx_cfg_continuous_ilas),
.cfg_skip_ilas(tx_cfg_skip_ilas),
.cfg_mframes_per_ilas(tx_cfg_mframes_per_ilas),
.cfg_disable_char_replacement(tx_cfg_disable_char_replacement),
.cfg_disable_scrambler(tx_cfg_disable_scrambler),

.device_cfg_octets_per_multiframe(tx_device_cfg_octets_per_multiframe),
.device_cfg_octets_per_frame(tx_device_cfg_octets_per_frame),
.device_cfg_beats_per_multiframe(tx_device_cfg_beats_per_multiframe),
.device_cfg_lmfc_offset(tx_device_cfg_lmfc_offset),
.device_cfg_sysref_disable(tx_device_cfg_sysref_disable),
.device_cfg_sysref_oneshot(tx_device_cfg_sysref_oneshot),

.ilas_config_rd(tx_ilas_config_rd),
.ilas_config_addr(tx_ilas_config_addr),
.ilas_config_data(tx_ilas_config_data)
Expand All @@ -290,11 +298,17 @@ module frame_align_tb;
.NUM_LINKS(NUM_LINKS),
.NUM_OUTPUT_PIPELINE(0),
.LINK_MODE(1),
.DATA_PATH_WIDTH(DATA_PATH_WIDTH)
.DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.TPL_DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.ASYNC_CLK(0),
.ENABLE_CHAR_REPLACE(1)
) i_tx (
.clk(clk),
.reset(reset),

.device_clk(clk),
.device_reset(reset),

.phy_data(phy_data_out),
.phy_charisk(phy_charisk_out),
.phy_header(),
Expand All @@ -309,47 +323,59 @@ module frame_align_tb;
.tx_ready(tx_ready),
.tx_eof(tx_eof),
.tx_sof(tx_sof),
.tx_somf(),
.tx_eomf(),
.tx_valid(1'b1),

.cfg_lanes_disable(tx_cfg_lanes_disable),
.cfg_links_disable(tx_cfg_links_disable),
.cfg_octets_per_multiframe(tx_cfg_octets_per_multiframe),
.cfg_octets_per_frame(tx_cfg_octets_per_frame),
.cfg_lmfc_offset(tx_cfg_lmfc_offset),
.cfg_sysref_disable(tx_cfg_sysref_disable),
.cfg_sysref_oneshot(tx_cfg_sysref_oneshot),
.cfg_continuous_cgs(tx_cfg_continuous_cgs),
.cfg_continuous_ilas(tx_cfg_continuous_ilas),
.cfg_skip_ilas(tx_cfg_skip_ilas),
.cfg_mframes_per_ilas(tx_cfg_mframes_per_ilas),
.cfg_disable_char_replacement(tx_cfg_disable_char_replacement),
.cfg_disable_scrambler(tx_cfg_disable_scrambler),

.device_cfg_octets_per_multiframe(tx_device_cfg_octets_per_multiframe),
.device_cfg_octets_per_frame(tx_device_cfg_octets_per_frame),
.device_cfg_beats_per_multiframe(tx_device_cfg_beats_per_multiframe),
.device_cfg_lmfc_offset(tx_device_cfg_lmfc_offset),
.device_cfg_sysref_disable(tx_device_cfg_sysref_disable),
.device_cfg_sysref_oneshot(tx_device_cfg_sysref_oneshot),

.ilas_config_rd(tx_ilas_config_rd),
.ilas_config_addr(tx_ilas_config_addr),
.ilas_config_data(tx_ilas_config_data),

.ctrl_manual_sync_request(1'b0),


.event_sysref_edge (tx_event_sysref_edge),
.event_sysref_alignment_error (tx_event_sysref_alignment_error),
.device_event_sysref_edge (tx_event_sysref_edge),
.device_event_sysref_alignment_error (tx_event_sysref_alignment_error),

.status_sync (tx_status_sync),
.status_state (tx_status_state)
.status_state (tx_status_state),

.status_synth_params0(),
.status_synth_params1(),
.status_synth_params2()
);

wire [NUM_LANES-1:0] rx_cfg_lanes_disable;
wire [NUM_LINKS-1:0] rx_cfg_links_disable;
wire [9:0] rx_cfg_octets_per_multiframe;
wire [7:0] rx_cfg_octets_per_frame;
wire [7:0] rx_cfg_lmfc_offset;
wire rx_cfg_sysref_disable;
wire rx_cfg_sysref_oneshot;
wire [7:0] rx_device_cfg_lmfc_offset;
wire [9:0] rx_device_cfg_octets_per_multiframe;
wire [7:0] rx_device_cfg_octets_per_frame;
wire [7:0] rx_device_cfg_beats_per_multiframe;
wire rx_device_cfg_sysref_disable;
wire rx_device_cfg_sysref_oneshot;
wire rx_device_cfg_buffer_early_release;
wire [7:0] rx_device_cfg_buffer_delay;
wire rx_cfg_disable_scrambler;
wire rx_cfg_disable_char_replacement;
wire rx_cfg_buffer_early_release;
wire [7:0] rx_cfg_buffer_delay;
wire [NUM_LANES-1:0] rx_status_lane_ifs_ready;
wire [NUM_LANES*14-1:0] rx_status_lane_latency;
wire [NUM_LANES*8-1:0] rx_status_lane_frame_align_err_cnt;
Expand All @@ -376,22 +402,27 @@ module frame_align_tb;
.LINK_MODE(1),
.SYSREF_DISABLE(SYSREF_DISABLE),
.SYSREF_ONE_SHOT(SYSREF_ONE_SHOT),
.DATA_PATH_WIDTH(DATA_PATH_WIDTH)
.DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.TPL_DATA_PATH_WIDTH(DATA_PATH_WIDTH)
) i_rx_cfg (
.clk(clk),

.cfg_lanes_disable(rx_cfg_lanes_disable),
.cfg_links_disable(rx_cfg_links_disable),
.cfg_octets_per_multiframe(rx_cfg_octets_per_multiframe),
.cfg_octets_per_frame(rx_cfg_octets_per_frame),
.cfg_lmfc_offset(rx_cfg_lmfc_offset),
.cfg_sysref_disable(rx_cfg_sysref_disable),
.cfg_sysref_oneshot(rx_cfg_sysref_oneshot),
.cfg_disable_scrambler(rx_cfg_disable_scrambler),
.cfg_disable_char_replacement(rx_cfg_disable_char_replacement),
.cfg_buffer_delay(rx_cfg_buffer_delay),
.cfg_buffer_early_release(rx_cfg_buffer_early_release),
.cfg_frame_align_err_threshold(rx_cfg_frame_align_err_threshold)
.cfg_frame_align_err_threshold(rx_cfg_frame_align_err_threshold),

.device_cfg_octets_per_multiframe(rx_device_cfg_octets_per_multiframe),
.device_cfg_octets_per_frame(rx_device_cfg_octets_per_frame),
.device_cfg_beats_per_multiframe(rx_device_cfg_beats_per_multiframe),
.device_cfg_lmfc_offset(rx_device_cfg_lmfc_offset),
.device_cfg_sysref_disable(rx_device_cfg_sysref_disable),
.device_cfg_sysref_oneshot(rx_device_cfg_sysref_oneshot),
.device_cfg_buffer_early_release(rx_device_cfg_buffer_early_release),
.device_cfg_buffer_delay(rx_device_cfg_buffer_delay)
);

jesd204_rx #(
Expand All @@ -401,11 +432,17 @@ module frame_align_tb;
.LINK_MODE(1),
.DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.ENABLE_FRAME_ALIGN_CHECK(1),
.ENABLE_FRAME_ALIGN_ERR_RESET(1)
.ENABLE_FRAME_ALIGN_ERR_RESET(1),
.TPL_DATA_PATH_WIDTH(DATA_PATH_WIDTH),
.ASYNC_CLK(0),
.ENABLE_CHAR_REPLACE(1)
) i_rx (
.clk(clk),
.reset(reset),

.device_clk(clk),
.device_reset(reset),

.phy_data(phy_data_in),
.phy_header({2*NUM_LANES{1'b0}}),
.phy_charisk(phy_charisk_in),
Expand All @@ -417,8 +454,10 @@ module frame_align_tb;
.lmfc_edge(rx_lmfc_edge),
.lmfc_clk(rx_lmfc_clk),

.event_sysref_alignment_error(rx_event_sysref_alignment_error),
.event_sysref_edge(rx_event_sysref_edge),
.device_event_sysref_alignment_error(rx_event_sysref_alignment_error),
.device_event_sysref_edge(rx_event_sysref_edge),
.event_frame_alignment_error(),
.event_unexpected_lane_state_error(),

.sync(sync),

Expand All @@ -428,19 +467,25 @@ module frame_align_tb;
.rx_valid(rx_valid),
.rx_eof(rx_eof),
.rx_sof(rx_sof),
.rx_eomf(),
.rx_somf(),

.cfg_lanes_disable(rx_cfg_lanes_disable),
.cfg_links_disable(rx_cfg_links_disable),
.cfg_octets_per_multiframe(rx_cfg_octets_per_multiframe),
.cfg_octets_per_frame(rx_cfg_octets_per_frame),
.cfg_lmfc_offset(rx_cfg_lmfc_offset),
.cfg_sysref_disable(rx_cfg_sysref_disable),
.cfg_sysref_oneshot(rx_cfg_sysref_oneshot),
.cfg_buffer_early_release(rx_cfg_buffer_early_release),
.cfg_buffer_delay(rx_cfg_buffer_delay),
.cfg_disable_char_replacement(rx_cfg_disable_char_replacement),
.cfg_disable_scrambler(rx_cfg_disable_scrambler),

.device_cfg_octets_per_multiframe(rx_device_cfg_octets_per_multiframe),
.device_cfg_octets_per_frame(rx_device_cfg_octets_per_frame),
.device_cfg_beats_per_multiframe(rx_device_cfg_beats_per_multiframe),
.device_cfg_lmfc_offset(rx_device_cfg_lmfc_offset),
.device_cfg_sysref_disable(rx_device_cfg_sysref_disable),
.device_cfg_sysref_oneshot(rx_device_cfg_sysref_oneshot),
.device_cfg_buffer_early_release(rx_device_cfg_buffer_early_release),
.device_cfg_buffer_delay(rx_device_cfg_buffer_delay),

.ctrl_err_statistics_reset(1'b0),
.ctrl_err_statistics_mask(7'b0),

Expand All @@ -458,7 +503,11 @@ module frame_align_tb;
.status_lane_ifs_ready(rx_status_lane_ifs_ready),
.status_lane_latency(rx_status_lane_latency),
.status_lane_emb_state(),
.status_lane_frame_align_err_cnt(rx_status_lane_frame_align_err_cnt)
.status_lane_frame_align_err_cnt(rx_status_lane_frame_align_err_cnt),

.status_synth_params0(),
.status_synth_params1(),
.status_synth_params2()
);

assign cur_data_mismatch = (rx_data & rx_mask) !== ({NUM_LANES{rx_ref_data}} & rx_mask);
Expand Down
4 changes: 3 additions & 1 deletion library/jesd204/tb/jesd204_frame_mark_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ parameter VCD_FILE = "jesd204_frame_mark_tb.vcd";
localparam DATA_PATH_WIDTH = 8;

wire [9:0] cfg_octets_per_multiframe = 23;
wire [7:0] cfg_beats_per_multiframe = 2;
wire [7:0] cfg_octets_per_frame = 5;
wire [DATA_PATH_WIDTH-1:0] sof;
wire [DATA_PATH_WIDTH-1:0] somf;
Expand All @@ -67,11 +68,12 @@ jesd204_frame_mark #(
.clk (clk),
.reset (reset),
.cfg_octets_per_multiframe (cfg_octets_per_multiframe),
.cfg_beats_per_multiframe (cfg_beats_per_multiframe),
.cfg_octets_per_frame (cfg_octets_per_frame),
.sof (sof),
.eof (eof),
.somf (somf),
.eomf (eomf)
);

endmodule
endmodule
Loading

0 comments on commit 9418120

Please sign in to comment.