ashrafsazid
Advanced Member level 4
Hi,
I need some helps regarding reading a file (say .txt, could be .csv as well) from a directory path and then generate a voltage signal based on the array of values from the file.
There is a timing event, and the elements of the file array will be accessed based on timing events.
Here is the VerilogA code:
The input file is like this with many values depending on the count:
The problem is I am getting some simulation error regarding the content of the file and it says
Please help me to solve this.
I need some helps regarding reading a file (say .txt, could be .csv as well) from a directory path and then generate a voltage signal based on the array of values from the file.
There is a timing event, and the elements of the file array will be accessed based on timing events.
Here is the VerilogA code:
Code:
`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
The input file is like this with many values depending on the count:
Code:
1
4
12
3
6
2
6
7
4
10
7
9
9
..... and so on
The problem is I am getting some simulation error regarding the content of the file and it says
Code:
Fatal error found by spectre during IC analysis, during transient analysis `tran'.
FATAL (ASL-3211): "/home/cadence_libs/mylib/module_filereader/veriloga/veriloga.va" 35: I225: Digit not found in input file/string to match $fread/$fscanf/$sscanf format string. Change the format string to match the input file/string or correct the input file/string.
Analysis `tran' was terminated prematurely due to an error.
Please help me to solve this.