• 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. Adding "FILE NAME" as a parameter in verilog-A module

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 126
  • Views 3280
  • 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

Adding "FILE NAME" as a parameter in verilog-A module

RFStuff
RFStuff over 10 years ago

Dear All,

I have written a Verilog-A code which writes simulation data into the file (file_name.txt).

I want to use the file name as a variable(parameter) so that I can change the file name for different instances of the module.

Could anybody please tell how it can be done ?

################################

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

module FILE_WRITE( VIN,clk_edge_rise);
 
 input VIN;
 electrical VIN,clk_edge_rise;  
 integer fp1;
integer count ;
 
 
 
 analog begin
  @(initial_step) begin
      count=0;
      
     fp1=$fopen("/home/MAT_WORK_CAD/MODULATOR/file_name.txt","w");
     
   end
   
   @(cross(V(clk_edge_rise) - Vth, dir, ttol, vtol)) begin
     count=count+1;
     
     $fwrite(fp1, "%d , %.15E\n", count,V(VIN) );
     
    end
    @(final_step) begin
      $fclose(fp1);
      
    end
    
    
  end
     
endmodule

Kind Regards,

  • Cancel
Parents
  • theopaone
    theopaone over 10 years ago

    I don't know the language this is written in but your file name in the $fopen call is a string and not a variable. You have to build the file name from the directory path and the variable file_name. In SKILL, this is done with

    sprintf( nil "/home/MAT_WORK_CAD/MODULATOR/%s.txt" file_name)

    You will have to translate this into something Verilog understands.

    Ted

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • theopaone
    theopaone over 10 years ago

    I don't know the language this is written in but your file name in the $fopen call is a string and not a variable. You have to build the file name from the directory path and the variable file_name. In SKILL, this is done with

    sprintf( nil "/home/MAT_WORK_CAD/MODULATOR/%s.txt" file_name)

    You will have to translate this into something Verilog understands.

    Ted

    • 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