Jacki
|
Hello,
I am quite new to VerilogA. Currently I want to read a .log file into VerilogA and use the transition filter. The file is just a lot of "0" and "1", and either "0" or "1" in each line. How can I read it correctly? I try to use fscanf(), but I get the syntax error. Could anybody help me to correct the error?
// VerilogA for VerilogA, readfile, veriloga
`include "constants.vams" `include "disciplines.vams"
module readfile (clk, out); input clk; output out; electrical out, clk;
integer pwmfileA; real hold; real pwm_A[0:1024]; genvar i, k=0; parameter real thresh=0.6; parameter tr=1n, tf=1n, dy=0; integer j=1; analog begin
@(initial_step) begin pwmfileA = $fopen("./pwm_A.log","r"); // here report an error $fclose(pwmfileA); end
for (i=0; i<1024; i=i+1) begin pwm_A[i] = $fscanf(pwmfileA,"%d",j); //here report an error j=j+1; end for (k=0;k<1024;k=k+1) begin @cross(V(clk)-thresh, +1) hold = pwmfileA[k]; V(out) <+ 1.2*transition(hold, dy, tr, tf); end end endmodule
the reported errors are shown here: Error found by spectre during AHDL compile. ERROR (VACOMP-1149): "./veriloga.va", line 26: Genvar loop evaluation failed. Check whether `/usr/bin/perl' is available. ERROR (VACOMP-1816): Exiting AHDL compilation.
Any comments are welcome. Thank you. Jacki
|