Home > Community > Forums > Custom IC Design > noisefile in a vdc source modeled by Verilog-A

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 noisefile in a vdc source modeled by Verilog-A 

Last post Fri, Sep 27 2013 6:26 AM by Aldo2. 3 replies.
Started by Aldo2 12 Apr 2013 05:30 AM. Topic has 3 replies and 1055 views
Page 1 of 1 (4 items)
Sort Posts:
  • Fri, Apr 12 2013 5:30 AM

    • Aldo2
    • Top 200 Contributor
    • Joined on Mon, Aug 29 2011
    • Posts 43
    • Points 650
    noisefile in a vdc source modeled by Verilog-A Reply

     Hello,

    Is it possible to read a noise file from Verilog-A?

    I would like to add a known noise shape to a model of a vdc voltage source modeled by Verilog-A.

    (I need to read data from a file and pass them to noise_table)

    thank you very much

    Best regards

    Aldo

    • Post Points: 20
  • Tue, Apr 30 2013 6:22 AM

    Re: noisefile in a vdc source modeled by Verilog-A Reply

    Aldo,

    How about this code below. A simple command line testcase would be:

    // noise_from_file.scs

    I1 (n1) noise_from_file filename="noise.dat" //debug=1
    r1 (n1 0) resistor r=1k isnoisy=no

    ahdl_include "noise_from_file.va"

    noise (n1 0) noise start=1 stop=1G dec=10

    With this as the noise.dat:

    1e3,1e-9
    2e3,2e-9
    10e3,1.8e-9
    1e6,2.2e-9

     

    `include "disciplines.vams"
    
    module noise_from_file (op);
    
    output op;
    electrical op;
    integer mcd,count,retval;
    real frq,val;
    parameter string filename="noise.dat";
    parameter maxpoints=100;
    parameter debug=0;
    real noisetab[0:maxpoints-1];
    
    analog begin
    
       @(initial_step) begin
          mcd=$fopen(filename,"r");
          retval=2;
          count=0;
          while(retval==2) begin
    	  retval=$fscanf(mcd,"%f,%f",frq,val);
    	  if (debug) $debug("Data is %d %g %g",retval,frq,val);
    	  noisetab[count]=frq;
    	  count=count+1;
    	  noisetab[count]=val;
    	  count=count+1;
          end
          $fclose(mcd);
        end
    
        V(op) <+ noise_table(noisetab);
    end
    
    endmodule

     

    Regards,

    Andrew.

    • Post Points: 20
  • Mon, May 6 2013 10:04 AM

    • Aldo2
    • Top 200 Contributor
    • Joined on Mon, Aug 29 2011
    • Posts 43
    • Points 650
    Re: noisefile in a vdc source modeled by Verilog-A Reply

     Many thanks, Andrew

    Regards,

    Aldo

    • Post Points: 5
  • Fri, Sep 27 2013 6:26 AM

    • Aldo2
    • Top 200 Contributor
    • Joined on Mon, Aug 29 2011
    • Posts 43
    • Points 650
    Re: noisefile in a vdc source modeled by Verilog-A Reply

    Hi Andrew,

    Starting from your suggestions I wrote the following code:

    module TEST(VOUT,ADJ);
        inout      VOUT, ADJ;
        electrical VOUT, ADJ;

        integer    voutPar,file,i,retVal;
        real       vthr,noiseFrq,noiseVal,voutVal;
        string     filename,temp;
        real       noisetab[0:1000];

        analog begin
            vthr=0.1;
            if(V(ADJ)>vthr) voutPar=1;
            else voutPar=0;
            case (voutPar)
                0: begin
                       filename="TEST_1V.csv";
                       voutVal  =1;
                   end
                1: begin
                       filename="TEST_2V.csv";
                       voutVal  =2;
                   end
            endcase
            file=$fopen(filename,"r");
            $fscanf(file,"%s",temp);
            $display("%s",temp);
            i=0;
            retVal=$fscanf(file,"%f %f",noiseFrq,noiseVal);
            while(retVal==2) begin
                noisetab[i]=noiseFrq;
                i=i+1;
                noisetab[i]=noiseVal;
                i=i+1;
                retVal=$fscanf(file,"%f %f",noiseFrq,noiseVal);
            end
            $fclose(file);
            V(VOUT) <+ voutVal+noise_table(noisetab);
        end
    endmodule

     If voutPar=1, I get the following error message:

    Internal error found in spectre during DC analysis `dcOp'. 
    Encountered a critical error during simulation. Submit a Service Request via Cadence Online Support, including the netlist, the Spectre log file, the behavioral model files, and any other information that can help identify the problem.
        FATAL (SPECTRE-18): Segmentation fault.

    Whereas if voutPar=0 it works.

    If I make load the same file in both cases:

    case (voutPar)
                    0: begin
                           filename="TEST_1V.csv";
                           voutVal  =1;
                       end
                    1: begin
                           filename="TEST_1V.csv";
                           voutVal  =2;
                       end
                endcase

    the code works

    Thank you

    Best regards

    Aldo

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by Aldo2 at 12 Apr 2013 05:30 AM. Topic has 3 replies.