i have text file (3x3) as shown below in the screenshot , and when i wrote the below code, it only reads the first line, however i need to read all number ( 2 dimensional array).
the first line will be on port A, second line on: port b , third line on: port C
module read_file (a,b,c);
output a,b,c;
electrical a,b;
integer in_file_0,data_value, valid,count_0,count_1,count_2,retval;
real A,B,C,v0_int,v1_int,v2_int;
// real int_value,v0_int,int_valu;
analog begin
@(initial_step) begin
in_file_0 = $fopen("/home/hh1667/ee610/my_library/read_file/data2.csv","r");
if($fscanf (in_file_0, "%f,%f,%f", A,B,C)==3) begin
count_0= A;
$display("%f", A);
count_1 =B;
$display("%f", B);
count_2 =C;
$display("%f", C);
end
//$display("%f,%f,%f", A,B,C);
v0_int = A;
v1_int = B;
v2_int = C;
//$display("%f,%f,%f", v0_int,v1_int,v2_int);
end
// V(a) <+ A;
// V(b) <+ B;
end
endmodule
`