I'm trying to read 16384 values in from a .txt file and use them as values in my testbench. I'm using $fopen and trying to use $fscanf. The error I'm getting back is that 'A' is an unpacked array, I'm not sure if my method is correct even without this error. Thanks for any help!
module tb2_fir;
// Inputs
reg Clk,rst_n;
reg signed [7:0] Xin;
// Outputs
wire signed [15:0] Yout;
reg signed [15:0]A[0:16383];
integer file,fd,i,file1,file2;
// Instantiate the Unit Under Test (UUT)
fir uut (
.Clk(Clk),
.Xin(Xin),
.Yout(Yout),
.rst_n(rst_n)
);
//Generate a clock with 10 ns clock period.
initial Clk = 0;
always #5 Clk =~Clk;
always @(negedge Clk)
begin
if(rst_n)
Xin<='0;
end
//Initialize and apply the inputs.
initial begin
file=$fopen("data_1.txt","r");
file2=$fscanf(file,"%d",A);
for(i=0;i<16383;i=i+1)
@(negedge Clk) Xin=A[i];
$finish;
end
endmodule