2023-08-18 07:55:04 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
// Copyright (C) 2017, 2018, 2022 Analog Devices, Inc. All rights reserved.
|
|
|
|
// SPDX short identifier: ADIJESD204
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2017-05-17 17:28:50 +00:00
|
|
|
|
2018-08-27 07:14:54 +00:00
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
2017-05-17 17:28:50 +00:00
|
|
|
module scrambler_tb;
|
|
|
|
parameter VCD_FILE = "scrambler_tb.vcd";
|
|
|
|
|
|
|
|
`include "tb_base.v"
|
|
|
|
|
|
|
|
reg [31:0] data_in;
|
|
|
|
reg [31:0] data_out_expected;
|
|
|
|
wire [31:0] data_scrambled;
|
|
|
|
wire [31:0] data_out;
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
if (reset == 1'b1) begin
|
|
|
|
data_in <= 'h03020100;
|
|
|
|
end else begin
|
|
|
|
data_in <= data_in + {4{8'h04}};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
jesd204_scrambler #(
|
|
|
|
.DESCRAMBLE(0)
|
|
|
|
) i_scrambler (
|
|
|
|
.clk(clk),
|
|
|
|
.reset(reset),
|
|
|
|
.enable(1'b1),
|
|
|
|
.data_in(data_in),
|
2022-04-08 10:21:52 +00:00
|
|
|
.data_out(data_scrambled));
|
2017-05-17 17:28:50 +00:00
|
|
|
|
|
|
|
jesd204_scrambler #(
|
|
|
|
.DESCRAMBLE(1)
|
|
|
|
) i_descrambler (
|
|
|
|
.clk(clk),
|
|
|
|
.reset(reset),
|
|
|
|
.enable(1'b1),
|
|
|
|
.data_in(data_scrambled),
|
2022-04-08 10:21:52 +00:00
|
|
|
.data_out(data_out));
|
2017-05-17 17:28:50 +00:00
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
if (data_in != data_out && failed == 1'b0) begin
|
|
|
|
failed <= 1'b1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|