1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
//
// Copyright 2016 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
module float_to_iq_tb();
reg clk, reset;
integer x,file;
reg [31:0] in;
wire [15:0] out;
initial clk = 0;
always #10 clk = ~clk;
initial $dumpfile("float_to_iq_tb.vcd");
initial $dumpvars(0,float_to_iq_tb);
initial
begin
x <= 0;
reset <= 1;
in <= 0;
file = $fopen("float_to_iq_VER.txt");
repeat(65536) @(posedge clk);
reset <=0;
repeat(65536) @(posedge clk)
begin
in <= data[x];
x <= x+1;
$fdisplayh(file,out);
end
$fclose(file);
repeat(65536) @(posedge clk);
$finish;
end
float_to_iq #(.BITS_IN(32),.BITS_OUT(16))
dut
(
.in(in), .out(out), .clk(clk), .reset(reset)
);
//input
reg [31:0] data [0:65535];
initial $readmemh("iq_to_float_output.txt",data);
//golden output
//
/*
reg [15:0] out_array [0:65535];
initial $readmemh("my_data.txt",out_array);
reg fail;
initial
fail <= 0;
//compare golden output with your output
always @(posedge clk) begin
if (out != out_array[index]) begin
$display("Line %d : Expected %x, got %x",index,out_array[index],out);
fail <= 1;
end
end
*/
end
endmodule
|