2018-10-23 23:34:43 -07:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 2015-2017 Alex Forencich
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Language: Verilog 2001
|
|
|
|
|
|
|
|
`timescale 1ns / 1ps
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Testbench for axis_xgmii_rx_32
|
|
|
|
*/
|
|
|
|
module test_axis_xgmii_rx_32;
|
|
|
|
|
|
|
|
// Parameters
|
2019-06-07 16:38:36 -07:00
|
|
|
parameter DATA_WIDTH = 32;
|
|
|
|
parameter KEEP_WIDTH = (DATA_WIDTH/8);
|
|
|
|
parameter CTRL_WIDTH = (DATA_WIDTH/8);
|
|
|
|
parameter PTP_TS_ENABLE = 0;
|
|
|
|
parameter PTP_TS_WIDTH = 96;
|
|
|
|
parameter USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1;
|
2018-10-23 23:34:43 -07:00
|
|
|
|
|
|
|
// Inputs
|
|
|
|
reg clk = 0;
|
|
|
|
reg rst = 0;
|
2019-06-07 16:38:36 -07:00
|
|
|
reg [7:0] current_test = 0;
|
2018-10-23 23:34:43 -07:00
|
|
|
|
2019-06-07 16:38:36 -07:00
|
|
|
reg [DATA_WIDTH-1:0] xgmii_rxd = 32'h07070707;
|
|
|
|
reg [CTRL_WIDTH-1:0] xgmii_rxc = 4'hf;
|
|
|
|
reg [PTP_TS_WIDTH-1:0] ptp_ts = 0;
|
2018-10-23 23:34:43 -07:00
|
|
|
|
|
|
|
// Outputs
|
2019-06-07 16:38:36 -07:00
|
|
|
wire [DATA_WIDTH-1:0] m_axis_tdata;
|
|
|
|
wire [KEEP_WIDTH-1:0] m_axis_tkeep;
|
2018-11-07 22:35:06 -08:00
|
|
|
wire m_axis_tvalid;
|
|
|
|
wire m_axis_tlast;
|
2019-06-07 16:38:36 -07:00
|
|
|
wire [USER_WIDTH-1:0] m_axis_tuser;
|
2019-01-31 17:00:23 -08:00
|
|
|
wire start_packet;
|
2018-10-23 23:34:43 -07:00
|
|
|
wire error_bad_frame;
|
|
|
|
wire error_bad_fcs;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
// myhdl integration
|
|
|
|
$from_myhdl(
|
|
|
|
clk,
|
|
|
|
rst,
|
|
|
|
current_test,
|
|
|
|
xgmii_rxd,
|
2019-06-07 16:38:36 -07:00
|
|
|
xgmii_rxc,
|
|
|
|
ptp_ts
|
2018-10-23 23:34:43 -07:00
|
|
|
);
|
|
|
|
$to_myhdl(
|
2018-11-07 22:35:06 -08:00
|
|
|
m_axis_tdata,
|
|
|
|
m_axis_tkeep,
|
|
|
|
m_axis_tvalid,
|
|
|
|
m_axis_tlast,
|
|
|
|
m_axis_tuser,
|
2019-01-31 17:00:23 -08:00
|
|
|
start_packet,
|
2018-10-23 23:34:43 -07:00
|
|
|
error_bad_frame,
|
|
|
|
error_bad_fcs
|
|
|
|
);
|
|
|
|
|
|
|
|
// dump file
|
|
|
|
$dumpfile("test_axis_xgmii_rx_32.lxt");
|
|
|
|
$dumpvars(0, test_axis_xgmii_rx_32);
|
|
|
|
end
|
|
|
|
|
2019-06-07 16:38:36 -07:00
|
|
|
axis_xgmii_rx_32 #(
|
|
|
|
.DATA_WIDTH(DATA_WIDTH),
|
|
|
|
.KEEP_WIDTH(KEEP_WIDTH),
|
|
|
|
.CTRL_WIDTH(CTRL_WIDTH),
|
|
|
|
.PTP_TS_ENABLE(PTP_TS_ENABLE),
|
|
|
|
.PTP_TS_WIDTH(PTP_TS_WIDTH),
|
|
|
|
.USER_WIDTH(USER_WIDTH)
|
|
|
|
)
|
2018-10-23 23:34:43 -07:00
|
|
|
UUT (
|
|
|
|
.clk(clk),
|
|
|
|
.rst(rst),
|
|
|
|
.xgmii_rxd(xgmii_rxd),
|
|
|
|
.xgmii_rxc(xgmii_rxc),
|
2018-11-07 22:35:06 -08:00
|
|
|
.m_axis_tdata(m_axis_tdata),
|
|
|
|
.m_axis_tkeep(m_axis_tkeep),
|
|
|
|
.m_axis_tvalid(m_axis_tvalid),
|
|
|
|
.m_axis_tlast(m_axis_tlast),
|
|
|
|
.m_axis_tuser(m_axis_tuser),
|
2019-06-07 16:38:36 -07:00
|
|
|
.ptp_ts(ptp_ts),
|
2019-01-31 17:00:23 -08:00
|
|
|
.start_packet(start_packet),
|
2018-10-23 23:34:43 -07:00
|
|
|
.error_bad_frame(error_bad_frame),
|
|
|
|
.error_bad_fcs(error_bad_fcs)
|
|
|
|
);
|
|
|
|
|
|
|
|
endmodule
|