• 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. Found a bug of system function $fwrite in verilog A

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 14621
  • 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

Found a bug of system function $fwrite in verilog A

Biasing
Biasing over 9 years ago

When I was using $fwrite to save the data generated during simulation, there are some unexpected 0s in the txt file. But in the Virtuoso Visualization tool, there are no any 0s.

The code is $fwrite(fp,"%f \n",Newout)

Then I write a test function, which is

// VerilogA for ADC, VerilogBugTest, veriloga

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

module VerilogBugTest(clk,Dout);
input clk;
output Dout;

voltage clk;
voltage Dout;
real Data;
integer fp;
analog begin
      @(initial_step) begin
            Data = 0;
            fp = $fopen("/users/mingliang/tsmcoa018BCD/ADC_Idealblock/VerilogABugTest.txt","a");
      end
      @(cross(V(clk)-0.9,+1)) begin
            Data = Data + 1;
            $fwrite(fp,"%f \n",Data);
      end
      V(Dout)   <+ transition(Data,0.5p,0.5p);
end

endmodule

The result shown in the Virtuoso Visualization tool is 

I also exported the data written by the system function $fwrite and plot it in the Matlab.

There are two 0s !.

Is these a bug of Verilog A or Is there something wrong in my verilog A code?

Best regards,

Biasing

  • Cancel
Parents
  • Biasing
    Biasing over 9 years ago

    Thank you very much! I have solved that. The problem is exactly same to what you said.

    Best regards,

    Biasing

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Biasing
    Biasing over 9 years ago

    Thank you very much! I have solved that. The problem is exactly same to what you said.

    Best regards,

    Biasing

    • 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