• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. Reading a data file in Veriloga code

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 125
  • Views 16830
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading a data file in Veriloga code

Sali
Sali over 11 years ago

Dear all,

I'm a new user with Veriloga in Cadence I wrote the following model and created a symbol to simulated it with other components but I got the following error:

FATAL (VLOGA-5096):  16: I50:  Cannot open file 'scanftest' for reading. Check this file to verify that it exists and that you have permission to open it for reading and try again. The idea is reading the numbers from the file then store each colomn in a separete array to use it after in the claculations. where I must svae the data file, it is two colomns of 9 decimal numbers and thsi is the code:

`include "constants.vams"
`include "disciplines.vams"

module VxijwithFile(x);
inout x;
electrical x;
real parameter c=1e-9,r=1e3,I=0,Vx0=1,t=5e-6;
integer A[1:9], Vxij[1:9],mcd,retval,count,f;
real Vykl[1:9],a,vx;
genvar i;

analog begin
 @(initial_step) begin
      mcd=$fopen("/home/VxijwithFile/veriloga/scanftest","r");
      retval=2;
      count=0;
      while(retval==2) begin
         retval=$fscanf(mcd,"%f %f",a,vx);
         A[count]=a;
         Vxij[count]=vx;
         Vykl[count]=0.5*(abs(Vxij[count]+1)-abs(Vxij[count]-1));
count=count+1;
      end
$fclose(mcd);

       f=0;
       for (i=1;i<8;i=i+1) begin
       f=f+A[f]*Vykl[f];
       end
end
V(x) <+ exp(-t/(r*c))+idt(exp((t-c*r)/(r*c))*(f/c));

end

endmodule

 

thank you 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Your contribution statement appears to be inside the begin/end block for @(initial_step), whereas it should be outside (it was earlier). So you have two end statements below the contribution statement (the V(x,n) <+ ... line), and one above - there should be two end statements above and one below.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Your contribution statement appears to be inside the begin/end block for @(initial_step), whereas it should be outside (it was earlier). So you have two end statements below the contribution statement (the V(x,n) <+ ... line), and one above - there should be two end statements above and one below.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information