The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> is possible to write model for piecewise linear source https://designers-guide.org/forum/YaBB.pl?num=1270820173 Message started by seefree on Apr 9th, 2010, 6:36am |
Title: is possible to write model for piecewise linear source Post by seefree on Apr 9th, 2010, 6:36am Hi there, Is it possible to write a pwl voltage source model in veriloga? I want to use a pwl voltage source with an enable signal, whenever the enable is high, the pwl source starts to work. The problem is, I don't know how to define the number of pairs for the model for different simulations. Thanks, |
Title: Re: is possible to write model for piecewise linear source Post by Boris Troyanovsky on Apr 9th, 2010, 10:32am Here's a Verilog-A pwl implementation using arrays for time/voltage input. It doesn't have the enable feature (not sure what the goal there would be), but you should be able to add that in. Code:
|
Title: Re: is possible to write model for piecewise linear source Post by Boris Troyanovsky on Apr 9th, 2010, 10:40am ... and here's one if you prefer string input for the pwl (e.g., pwl="0.0, 0.0, 0.5, 1.1, 1.0, -1.1,..."). It does use the non-standard string .len() operator from System-Verilog, and so may not be suitable for your application. Code:
|
Title: Re: is possible to write model for piecewise linear source Post by seefree on Apr 9th, 2010, 10:51am I will add the enable pin and try the models. Appreciate your help |
Title: Re: is possible to write model for piecewise linear source Post by seefree on Apr 14th, 2010, 11:25am This model works in spectre. However, if I run it in ams, I got the ncvlog error message complaining phrase: parameter real t[1:N] = {0,1}; It says "In Affirma-AMS, parameter array declaration is not supported" How can I solve this problem? Thanks, Boris Troyanovsky wrote on Apr 9th, 2010, 10:32am:
|
Title: Re: is possible to write model for piecewise linear source Post by patrick on Apr 14th, 2010, 1:42pm I'm not sure if this would work for you but you could put the pwl breakpoints into a file and use $table_model in the module body to read them in. Patrick |
Title: Re: is possible to write model for piecewise linear source Post by Marq Kole on May 17th, 2010, 4:11am Another approach is to create an array variable and assign it a value in an initial step: Code:
But first try to use Patrick's suggestion: it is much simpler and more flexible. Cheers, Marq |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |