Line 21... |
Line 21... |
|
|
`timescale 1ns/1ns
|
`timescale 1ns/1ns
|
|
|
module tsu_queue_tb;
|
module tsu_queue_tb;
|
|
|
|
parameter giga_mode = 1'b1;
|
|
|
reg rst;
|
reg rst;
|
wire gmii_rxclk;
|
wire gmii_rxclk;
|
wire gmii_rxctrl;
|
wire gmii_rxctrl;
|
wire [ 7:0] gmii_rxdata;
|
wire [ 7:0] gmii_rxdata;
|
wire gmii_txclk;
|
wire gmii_txclk;
|
Line 67... |
Line 69... |
.rst(rst),
|
.rst(rst),
|
|
|
.gmii_clk(gmii_rxclk),
|
.gmii_clk(gmii_rxclk),
|
.gmii_ctrl(gmii_rxctrl),
|
.gmii_ctrl(gmii_rxctrl),
|
.gmii_data(gmii_rxdata),
|
.gmii_data(gmii_rxdata),
|
|
.giga_mode(giga_mode),
|
|
|
.ptp_msgid_mask(8'b11111111),
|
.ptp_msgid_mask(8'b11111111),
|
|
|
.rtc_timer_clk(rtc_timer_clk),
|
.rtc_timer_clk(rtc_timer_clk),
|
.rtc_timer_in(rtc_timer_in),
|
.rtc_timer_in(rtc_timer_in),
|
Line 86... |
Line 89... |
(
|
(
|
.gmii_rxclk(gmii_rxclk),
|
.gmii_rxclk(gmii_rxclk),
|
.gmii_rxctrl(gmii_rxctrl),
|
.gmii_rxctrl(gmii_rxctrl),
|
.gmii_rxdata(gmii_rxdata)
|
.gmii_rxdata(gmii_rxdata)
|
);
|
);
|
|
defparam BFM_RX.giga_mode = giga_mode;
|
|
|
|
|
tsu DUT_TX
|
tsu DUT_TX
|
(
|
(
|
.rst(rst),
|
.rst(rst),
|
|
|
.gmii_clk(gmii_txclk),
|
.gmii_clk(gmii_txclk),
|
.gmii_ctrl(gmii_txctrl),
|
.gmii_ctrl(gmii_txctrl),
|
.gmii_data(gmii_txdata),
|
.gmii_data(gmii_txdata),
|
|
.giga_mode(giga_mode),
|
|
|
.ptp_msgid_mask(8'b11111111),
|
.ptp_msgid_mask(8'b11111111),
|
|
|
.rtc_timer_clk(rtc_timer_clk),
|
.rtc_timer_clk(rtc_timer_clk),
|
.rtc_timer_in(rtc_timer_in),
|
.rtc_timer_in(rtc_timer_in),
|
Line 114... |
Line 119... |
(
|
(
|
.gmii_txclk(gmii_txclk),
|
.gmii_txclk(gmii_txclk),
|
.gmii_txctrl(gmii_txctrl),
|
.gmii_txctrl(gmii_txctrl),
|
.gmii_txdata(gmii_txdata)
|
.gmii_txdata(gmii_txdata)
|
);
|
);
|
|
defparam BFM_TX.giga_mode = giga_mode;
|
|
|
integer rx_ptp_event_cnt, rx_ptp_mismatch_cnt;
|
integer rx_ptp_event_cnt, rx_ptp_mismatch_cnt;
|
integer ref_file_handle_rx, return_fscanf_rx, ref_num_rx;
|
integer ref_file_handle_rx, return_fscanf_rx, ref_num_rx;
|
initial begin
|
initial begin
|
rx_ptp_event_cnt = 0;
|
rx_ptp_event_cnt = 0;
|
Line 155... |
Line 161... |
fork
|
fork
|
@(posedge BFM_RX.eof_rx);
|
@(posedge BFM_RX.eof_rx);
|
@(posedge BFM_TX.eof_tx);
|
@(posedge BFM_TX.eof_tx);
|
join
|
join
|
|
|
if (rx_ptp_event_cnt == 0 || tx_ptp_event_cnt == 0) begin
|
|
if (rx_ptp_event_cnt == 0)
|
if (rx_ptp_event_cnt == 0)
|
$display("RX Parser Test Fail: found 0 PTP-EVENT!");
|
$display("RX Parser Test Fail: found 0 PTP-EVENT!\n");
|
if (tx_ptp_event_cnt == 0)
|
if (tx_ptp_event_cnt == 0)
|
$display("TX Parser Test Fail: found 0 PTP-EVENT!");
|
$display("TX Parser Test Fail: found 0 PTP-EVENT!\n");
|
end
|
|
else if (rx_ptp_mismatch_cnt > 0 || tx_ptp_mismatch_cnt > 0) begin
|
|
if (rx_ptp_mismatch_cnt > 0)
|
if (rx_ptp_mismatch_cnt > 0)
|
$display("Rx Parser Mismatch Found: RX-PTP-EVENT-MISMATCH = %d", rx_ptp_mismatch_cnt);
|
$display("Rx Parser Mismatch Found: RX-PTP-EVENT-MISMATCH = %d\n", rx_ptp_mismatch_cnt);
|
if (tx_ptp_mismatch_cnt > 0)
|
if (tx_ptp_mismatch_cnt > 0)
|
$display("Tx Parser Mismatch Found: TX-PTP-EVENT-MISMATCH = %d", tx_ptp_mismatch_cnt);
|
$display("Tx Parser Mismatch Found: TX-PTP-EVENT-MISMATCH = %d\n", tx_ptp_mismatch_cnt);
|
end
|
|
else begin
|
if (rx_ptp_event_cnt > 0 && rx_ptp_mismatch_cnt == 0)
|
$display("RX and TX Parser Test Pass:\n RX-PTP-EVENT = %d\n TX-PTP-EVENT = %d", rx_ptp_event_cnt, tx_ptp_event_cnt);
|
$display("RX Parser Test Pass: RX-PTP-EVENT = %d\n", rx_ptp_event_cnt);
|
end
|
if (tx_ptp_event_cnt > 0 && tx_ptp_mismatch_cnt == 0)
|
|
$display("TX Parser Test Pass: TX-PTP-EVENT = %d\n", tx_ptp_event_cnt);
|
|
|
#100 $stop;
|
#100 $stop;
|
end
|
end
|
|
|
endmodule
|
endmodule
|