• 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. VerilogA models in Cadence

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 125
  • Views 21089
  • 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

VerilogA models in Cadence

Sali
Sali over 11 years ago

Dear all,

I need your help to how to finish this simulation I spent a lot of time learning VerilogA and the way of creating new models in Cadence

My circuit that I need to simulated it in Cadence is  

At the begining I tried to model three separate sources and connect them together in the schematic but it fails to simulate, then I tried to write all model in one cell view and connect it to the rest of the circuit, here I coudn't continue and I don't know how to connect it.

The schematic is in the following figure:

  

The transient analysis:

The verilogA code is :

// VerilogA for Chua12, VxijwithFile, veriloga

 

`include "constants.vams"

`include "disciplines.vams"

module VxijwithFile(x,xij,gnd);

inout x,xij,gnd;

electrical x,xij,gnd;

real parameter c=1e-9,r=1e3,I=0,Vx0=1;

integer mcd,retval,count,f;

real Vykl[1:9],a,vx,A[1:9],Vxij[1:9],Avy[1:9],sum,v1,v2,t;

branch(xij,gnd) ij;

genvar i; 

analog begin

   mcd=$fopen("/home/Documents/scanftest.dat","r");

      retval=2;

      count=1;

      sum=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));

         Avy[count]=A[count]*Vykl[count];

         sum=sum+Avy[count];

         count=count+1;

      end

$fclose(mcd);

       f=0;          

      for (i=1;i<10;i=i+1) begin 

       f=f+A[f]*Vykl[f];

       end      

v1=exp((t-c*r)/(r*c))*(f/c);

v2=idt(v1,0,10e-5);

V(x,gnd) <+ exp(-t/(r*c))+v2;

//I(xij,gnd) <+ sum;  

end

endmodule

 

 

                

 

 

 

 

The error I got:

Error found by spectre during IC analysis, during transient analysis `tran'.

    ERROR (SPECTRE-16080): No DC solution found (no convergence).  

 

The values for those nodes that did not converge on the last Newton iteration are given below.  The manner in which the convergence criteria were not satisfied is also given.

            Failed test: | Value | > RelTol*Ref + AbsTol

 

 Top 7 Residue too large Convergence failure:

    V(net4) = 0 V

        residue too large: | -1 A | > 5 mA + 1 pA

 

 

The following set of suggestions might help you avoid convergence difficulties.  Once you have a solution, write it to a nodeset file using the `write' parameter and read it back in on subsequent simulations using the `readns' parameter.

 

 1. Evaluate and resolve any notice, warning, or error messages.

 2. Perform sanity check on the parameter values using the parameter range checker (use ``+param param-limits-file'' as a command line argument) and heed any warnings.  Print the minimum and maximum parameter value using the `info' analysis.  Ensure that the bounds given for instance, model, output, temperature-dependent, and operating-point (if possible) parameters are reasonable.

 

 3. Check the direction of both independent and dependent current sources. Convergence problems might result if current sources are connected such that they force current backward through diodes.

 

 4.  Enable diagnostic messages by setting option `diagnose=yes'.

 5. Small floating resistors connected to high impedance nodes might cause convergence difficulties. Avoid very small floating resistors, particularly small parasitic resistors in semiconductors. Instead, use voltage sources or iprobes to measure current.

 6. If you have an estimate of what the solution should be, use nodeset statements or a nodeset file and set as many nodes as possible.

 7. Use realistic device models. Check all component parameters, particularly nonlinear device model parameters, to ensure that they are reasonable.

 8. If simulating a bipolar analog circuit, ensure the region parameter on all transistors and diodes is set correctly.

 9. Loosen tolerances, particularly absolute tolerances like `iabstol' (on options statement). If tolerances are set too tight, they might preclude convergence.

10. If analysis fails at an extreme temperature, but succeeds at room temperature, try adding a DC analysis that sweeps temperature.  Start at room temperature, sweep to the extreme temperature, and write the final solution to a nodeset file.

11. Increase the value of gmin (on options statement).

12. Use numeric pivoting in the sparse matrix factorization by setting `pivotdc=yes' (on options statement). Sometimes, it is also necessary to increase the pivot threshold to somewhere in the range of 0.1 to 0.5 using `pivrel' (on options statement).

13. Try to simplify the nonlinear component models in order to avoid regions in the model that might contribute to convergence problems.

14. Divide the circuit into smaller pieces and simulate them individually, but ensure that the results will be close to what they would be if you had simulated the whole circuit.  Use the results to generate nodesets for the whole circuit.

15. If all else fails, replace the DC analysis with a transient analysis and modify all the independent sources to start at zero and ramp to their DC values. Run the transient analysis well beyond the time when all the sources have reached their final value (remember that transient analysis is very cheap when all of the signals in the circuit are not changing) and write the final point to a nodeset file. To make the transient analysis more efficient, set the integration method to backward Euler (`method=euler') and loosen the local truncation error criteria by increasing `lteratio', say to 50. Occasionally, this approach will fail or be very slow because the circuit contains an oscillator.  Often times the oscillation can be eliminated for the sake of finding the dc solution by setting the minimum capacitance from each node to ground (`cmin') to a large value.

 

Analysis `tran' was terminated prematurely due to an error.

finalTimeOP: writing operating point information to rawfile. 

 

 

Could you please help me.

Thanks 

  • Circuit1.png
  • View
  • Hide
  • Cancel
  • Sali
    Sali over 11 years ago

    how to post the images correctly? 

     

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

    Use the Options tab when posting, and upload a png file (say).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sali
    Sali over 11 years ago

    At the begining I wrote three separate codes for the three voltage-controlled current sources and created three symbols for them but when I connect them with the capacitor and the resistor it seems that the voltage at node x has a zero value.

    Those three codes are simply the equations indicated under the circuit schematic in Fig.1. 

    After I put the code inside one symbol and connect it to the rest of the circuit, it gave me the previous error.

    I'm using data comes from an external data file.

    If I remove the // at the end of the code another error appears and it says that the function I is not defined 

    If you need any further information please let me know.

    THank you,

    Sali 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sali
    Sali over 11 years ago
    I simplified the circuit and removed the dc sources and still receiving the same error, although my final goal is to keep the three voltage controlled current sources separated and two of them(Ixy and Iyx) receive its input from the first one(Vxij)
    • Circuit in Cadence 2.png
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

     First of all, the line:

     real parameter c=1e-9,r=1e3,I=0,Vx0=1;

    Is the reason why the I() function doesn't work. You have defined a parameter called I, and these clash. Since it doesn't appear to be used, either rename it or remove it.

    The equations refer to a real number t, which is not set - so this will be 0. I'm not sure if that's important.

    Debugging the convergence issue is hard since you didn't provide  scanftest.dat. If you don't want to provide that, if you add:

    $strobe(f,sum)

    after you've computed the value of f, that would be sufficient.

    The code is also reading the file on every iteration, which seems a bit excessive to me... probably a good way of slowing down the simulation (once it converges).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sali
    Sali over 11 years ago

    Thank you so much, I corrected the line of I and the error of undefined function disappeared, thanks again.

    The data file is :

    1,1

    0,1

    2,0

    1,1

    1,0

    0,1

    2,1

    0,0

    1,1 

     

    But coud you please explain more about what did you mean by  "The equations refer to a real number t, which is not set - so this will be 0. I'm not sure if that's important."

    Thanks

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

    I'll take a look at the example with the coefficients you've provided later, but the last point about t is that you have these equations:

    v1=exp((t-c*r)/(r*c))*(f/c);
    v2=idt(v1,0,10e-5);
    V(x,gnd) <+ exp(-t/(r*c))+v2;

    These expressions use a variable t, which is not set anywhere in your model. So it will be 0 in all the expressions. It's not clear to me what you were expecting, but I assume you didn't really want it to be 0 all the time? I'm not sure what you are actually expecting it to do...

    Regards,

    Andrew.

     

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

    There are also a couple of cases in your code where you are getting array bound violations. The first is in this section:     

    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));
             Avy[count]=A[count]*Vykl[count];
             sum=sum+Avy[count];
             count=count+1;
          end

    Well, this will go around the loop after the 9th read having incremented count to 10. No major harm will happen though on this one.

    The second is in this loop:

            f=0;          
          for (i=1;i<10;i=i+1) begin
           f=f+A[f]*Vykl[f];
           end      

    Are the array indices supposed to be [f] ? If so, this breaks because the arrays start at 1. Not sure whether f will overflow too. Was it supposed to be [i]?

    I suggest you correct the basic things first and then see what happens.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sali
    Sali over 11 years ago

    Thank you so much, I got some results although it is not the results I'm looking for, but at least the circuit is working now, I added in the first loop while(retval==2 & count<10)

     in the 2nd loop I put i instead of f , actually it is supposed to be i. 

    I'm going to separate the model(symbol) to three models (symbols) and see.

    I just have another two questions please, 1st is regarding the operator idt, as of my understanding this operator performs the integration with respect to time, that is why I didn't set a value for t variable in the equation at the begining, am I right or I must set a value to it, since I have got the current results after I set a value!

    Second question is about a good reference or online courses related to build the cellular neural network using Cadence (Virtuoso).

    Thank you so much for your help. 

     

     

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

    I can't really answer your first question, because it depends on what you were trying to model. The idt() does an integration with respect to time, certainly. So the question is whether the thing you are integrating needs to be a function of time or not - if it is, you'd use $abstime to get that rather than setting a variable. 

    I have no idea about the second. I suspect google is your best bet.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
>

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