The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Simulator gives error if parameters are changed
https://designers-guide.org/forum/YaBB.pl?num=1297252828

Message started by JussiS on Feb 9th, 2011, 4:00am

Title: Simulator gives error if parameters are changed
Post by JussiS on Feb 9th, 2011, 4:00am

Has anyone else encountered a problem where the simulator (Cadence AMS) gives an error, if you change any of the parameters in a component from the schematic properties-view?

The error it gives is:


ncelab: *E,CUBSPA (./ihnl/Buck_vcm/Buck_voltage/schematic/verilog.vams,26||44): Assigment of string to real or integer type parameter.

The code is:

/Verilog-AMS HDL for "Buck_vcm", "Compensator" "verilogams"


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


module Compensator ( Vref, Vin, Vout);


input Vref, Vin;

output Vout;


parameter real Pole_a = 10;

parameter real Pole_b = 100e4;

parameter real Pole_c = 100e5;

parameter real Zero_a = 1000;

parameter real Zero_b = 20e3;


parameter real Gain_dB=20;


real PI=3.14159265;

real Poles[0:5];

real Zeros[0:3];

real Gain;






electrical Vin, Vref, Vout;

 
 analog begin



  Gain = pow(10,(Gain_dB/20));


  Poles[0] = -2*PI*Pole_a;

  Poles[1] = 0;

  Poles[2] = -2*PI*Pole_b;

  Poles[3] = 0;

  Poles[4] = -2*PI*Pole_c;

  Poles[5] = 0;

 Zeros[0] = -2*PI*Zero_a;

  Zeros[1] = 0;

  Zeros[2] = -2*PI*Zero_b;

  Zeros[3] = 0;

  V(Vout) <+ Gain*laplace_zp(V(Vref,Vin),Zeros,Poles);


 end



endmodule

If I don't touch the properties, the simulation is completed normally.

Title: Re: Simulator gives error if parameters are changed
Post by Geoffrey_Coram on Feb 9th, 2011, 9:12am

Seems like a problem with the netlisting code -- I bet, when you specify a parameter, you get
 Pole_a = "10"
instead of
 Pole_a = 10
on the instance line.

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 9th, 2011, 9:38pm

So it would be bug in software itself?

How should one go about fixing the issue?

Title: Re: Simulator gives error if parameters are changed
Post by Geoffrey_Coram on Feb 11th, 2011, 4:06am

You might need to look into the CDF parameters that you defined for the symbol; I'll bet you have valueType "string" instead of valueType "int"

Did you create the symbol?  If not, you may need help from the person who did.

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 11th, 2011, 5:39am


Geoffrey_Coram wrote on Feb 11th, 2011, 4:06am:
You might need to look into the CDF parameters that you defined for the symbol; I'll bet you have valueType "string" instead of valueType "int"

Did you create the symbol?  If not, you may need help from the person who did.


Yes, I created the symbol myself and was not aware that I have to define the CDF parameters outside of the verilog-ams code.

In the code the are defined: "parameter real nameofparameter".

Or then I'm 'missing' something here. Could you please elaborate on the subject of the CDF parameters?

Thanks for the info so far.


Title: Re: Simulator gives error if parameters are changed
Post by Andrew Beckett on Feb 12th, 2011, 3:13pm

Please enter in the CIW:

cdfDump("Buck_vcm" "Compensator.cdf" ?cellName "Compensator")

and then post the contents of the file Compensator.cdf here.

Best Regards,

Andrew.

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 13th, 2011, 11:04pm

Here you go:


/****************************************************/
LIBRARY = "Buck_vcm"
CELL    = "Compensator"
/****************************************************/

let( ( libId cellId cdfId )
   unless( cellId = ddGetObj( LIBRARY CELL )
       error( "Could not get cell %s." CELL )
   )
   when( cdfId = cdfGetBaseCellCDF( cellId )
       cdfDeleteCDF( cdfId )
   )
   cdfId  = cdfCreateBaseCellCDF( cellId )

   ;;; Parameters
   cdfCreateParam( cdfId
       ?name           "Pole3"
       ?prompt         "Pole3"
       ?defValue       "1e+07"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole3)"
       ?parseAsNumber  "yes"
       ?parseAsCEL     "yes"
   )
   cdfCreateParam( cdfId
       ?name           "Gain"
       ?prompt         "Gain"
       ?defValue       "0"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Gain)"
   )
   cdfCreateParam( cdfId
       ?name           "Pole1"
       ?prompt         "Pole1"
       ?defValue       "10"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole1)"
   )
   cdfCreateParam( cdfId
       ?name           "Zero1"
       ?prompt         "Zero1"
       ?defValue       "100"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Zero1)"
   )
   cdfCreateParam( cdfId
       ?name           "Pole2"
       ?prompt         "Pole2"
       ?defValue       "100"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole2)"
   )
   cdfCreateParam( cdfId
       ?name           "Zero2"
       ?prompt         "Zero2"
       ?defValue       "1"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Zero2)"
   )
   cdfCreateParam( cdfId
       ?name           "Pole"
       ?prompt         "Pole"
       ?defValue       "10"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole)"
       ?parseAsNumber  "yes"
       ?parseAsCEL     "yes"
   )
   cdfCreateParam( cdfId
       ?name           "Pole_b"
       ?prompt         "Pole_b"
       ?defValue       "7.9477e+06"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole_b)"
   )
   cdfCreateParam( cdfId
       ?name           "Pole_c"
       ?prompt         "Pole_c"
       ?defValue       "2e+12"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole_c)"
   )
   cdfCreateParam( cdfId
       ?name           "Zero_a"
       ?prompt         "Zero_a"
       ?defValue       "0.1"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Zero_a)"
   )
   cdfCreateParam( cdfId
       ?name           "Zero_b"
       ?prompt         "Zero_b"
       ?defValue       "794770"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Zero_b)"
   )
   cdfCreateParam( cdfId
       ?name           "Pole_a"
       ?prompt         "Pole_a"
       ?defValue       "1e-05"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Pole_a)"
   )
   cdfCreateParam( cdfId
       ?name           "Gain_dB"
       ?prompt         "Gain_dB"
       ?defValue       "0"
       ?type           "string"
       ?display        "artParameterInToolDisplay('Gain_dB)"
   )

   ;;; Properties
   cdfId->formInitProc            = ""
   cdfId->doneProc                = ""
   cdfId->buttonFieldWidth        = 340
   cdfId->fieldHeight             = 35
   cdfId->fieldWidth              = 350
   cdfId->promptWidth             = 175
   cdfId->viewInfo                = '(nil verilogams (nil moduleName "Compensator" namePrefix "ahdl"
termOrder (Vref Vin Vout) parameterList (Pole_a Pole_b Pole_c Zero_a Zero_b
   Gain_dB
)
)
)
   cdfSaveCDF( cdfId )
)

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 13th, 2011, 11:05pm

And I'm guessing the problem is:

cdfCreateParam( cdfId
      ?name           "Pole3"
      ?prompt         "Pole3"
      ?defValue       "1e+07"
      ?type           "string"    <-Right there??

-Jussi

Title: Re: Simulator gives error if parameters are changed
Post by Geoffrey_Coram on Feb 14th, 2011, 5:59am


JussiS wrote on Feb 11th, 2011, 5:39am:
Yes, I created the symbol myself and was not aware that I have to define the CDF parameters outside of the verilog-ams code.


How did you create the symbol?  Did you use "create cellview from cellview" or something?  (I've never made a symbol for a Verilog-AMS module myself.)  I would think that, if the CDF parameters for the symbol were automatically generated from the .vams file, then they should have the right data type.

Title: Re: Simulator gives error if parameters are changed
Post by Geoffrey_Coram on Feb 14th, 2011, 6:21am


JussiS wrote on Feb 13th, 2011, 11:05pm:
And I'm guessing the problem is:

cdfCreateParam( cdfId
      ?name           "Pole3"
      ?prompt         "Pole3"
      ?defValue       "1e+07"
      ?type           "string"    <-Right there??

-Jussi


Yep.  Also the defValue is "1e+07" (a string) rather than 1+e07 (a floating-point number).

Perhaps Andrew can tell you how to load the cdf back in, after you change all those "string" to "real"

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 15th, 2011, 4:19am


Geoffrey_Coram wrote on Feb 14th, 2011, 5:59am:

JussiS wrote on Feb 11th, 2011, 5:39am:
Yes, I created the symbol myself and was not aware that I have to define the CDF parameters outside of the verilog-ams code.


How did you create the symbol?  Did you use "create cellview from cellview" or something?  (I've never made a symbol for a Verilog-AMS module myself.)  I would think that, if the CDF parameters for the symbol were automatically generated from the .vams file, then they should have the right data type.


I first created the Verilog-AMS cellview and after saving and closing the file, Cadence says, that no symbol exists, would you like to create it?

Click yes and the symbol view appears in the listing of the components views.

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Feb 20th, 2011, 10:54pm


Geoffrey_Coram wrote on Feb 14th, 2011, 6:21am:

JussiS wrote on Feb 13th, 2011, 11:05pm:
And I'm guessing the problem is:

cdfCreateParam( cdfId
      ?name           "Pole3"
      ?prompt         "Pole3"
      ?defValue       "1e+07"
      ?type           "string"    <-Right there??

-Jussi


Yep.  Also the defValue is "1e+07" (a string) rather than 1+e07 (a floating-point number).

Perhaps Andrew can tell you how to load the cdf back in, after you change all those "string" to "real"



What is Andrews nick on this board? (Probably just "Andrew", but gotta ask anyways).

Thanks

Title: Re: Simulator gives error if parameters are changed
Post by Geoffrey_Coram on Feb 22nd, 2011, 5:26am

I meant Andrew Beckett, who responded earlier in this thread.

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Apr 4th, 2011, 11:01pm

Tried contacting Andrew with a PM, but no response so far (it's been a month).

Anybody else have any idea as to how to fix this?

Title: Re: Simulator gives error if parameters are changed
Post by boe on Apr 5th, 2011, 8:22am

JussiS,

the output of cdfDump looks like a SKILL script to me, so you should try to just run it. But you could also use the CDF tool to change this directly with the GUI.
BTW, you could also leave the parameter type as string and change the parseAsNumber...

Code:
cdfCreateParam( cdfId
      ?name           "Pole3"
      ?prompt         "Pole3"
      ?defValue       "1e+07"
      ?type           "string"
      ?display        "artParameterInToolDisplay('Pole3)"
      ?parseAsNumber  "yes"  ;; needed for all numeric values w type=string
      ?parseAsCEL     "yes"     ;; may also be needed
...
Does this help?
B O E

Title: Re: Simulator gives error if parameters are changed
Post by JussiS on Apr 5th, 2011, 10:55pm

The problem has been fixed by changing the parameter type in the CDF tool-view in the GUI.  So pretty much what BOE said. Thanks everybody.

Title: Re: Simulator gives error if parameters are changed
Post by Andrew Beckett on May 31st, 2011, 1:39am

Sorry for how late my response has been. I've been extraordinarily busy over the last couple of months and have not been able to keep up with the DG forums.

Anyway, this is a known bug - CCR 874580 - and is scheduled to be fixed in IC615 ISR4 (due out in a couple of weeks, roughly).

I do have a workaround for it, but it's rather a hack, and not one I'd be comfortable posting in a public forum...

Regards,

Andrew.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.