`include "constants.vams"
`include "disciplines.vams"
module module_filereader (val);
output val;
electrical val;
parameter real period = 1/10k ;
parameter integer maxcount = 128 ;
integer dataread, cnt;
real mydata1, mydata2;
real datacol1 [maxcount-1:0];
analog begin
@(initial_step) begin
cnt = 0;
dataread = $fopen("/home/datafiles/data.txt","r"); //opening file readable access
end
@(timer(0, period )) begin
cnt = cnt+1;
end
while( cnt < maxcount ) begin
mydata1 = $fscanf(dataread,"%e", datacol1[cnt]);
end
$display ("| Transient:%g | data1: %g |", $realtime, mydata1) ;
@(final_step) $fclose(dataread);
// V(val) <+ transition(mydata1, 1n, 1n, 1n);
end
endmodule