• 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. Verilog-A syntax error with user-defined function and if...

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 125
  • Views 5971
  • 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

Verilog-A syntax error with user-defined function and if-else statement

gjeong35
gjeong35 over 1 year ago

I want to make ELU function in the verilog-A code, but it shows syntax error continuously. But the Verilog-A document says that this is the correct syntax, so I would like to ask you what should I fix.



module myVerilogAmodel(d, g, s); //* input parameters
analog function real ELU;
real k;
real alpha = 1.0; // Setting alpha value
begin
ELU = (k > 0) ? k : alpha * (exp(k) - 1);
end
endfunction


analog begin
Vg = V(g) ;
Vs = V(s) ;
Vd = V(d) ;
Vgsraw = Vg-Vs ;
Vgdraw = Vg-Vd ;

if (Vgsraw >= Vgdraw) begin
Vgs = ((Vg-Vs) - MinVg) * normVg ;
dir = 1;
end

else begin
Vgs = ((Vg-Vd) - MinVg) * normVg ;
dir = -1;
end

Vds = (abs(Vd-Vs) - MinVd) * normVd ;

Lg = (L -MinLg)*normLg ;

hc1_0 = ELU(-2.0581515*Vgs+1.1546319*Vds+0.59735364*Lg+0.7725613);
...

 

I wanted to find the Verilog-A version of the Cadence virtuoso solver, but I could not find it.

The error says:

 ERROR (VACOMP-1576):
"/nethome/gjeong35/iwo_transistor/LVIWO_nch_elu_elu/veriloga/veriloga.va",
line 57: Missing arguments for function ELU. Specify at least one
argument for a function.
ERROR (VACOMP-1240): "hc1_0 =
ELU(-2.0581515*Vgs+1.1546319*Vds+0.59735364*Lg+0.7725613)<<--? ;"
"/nethome/gjeong35/iwo_transistor/LVIWO_nch_elu_elu/veriloga/veriloga.va",
line 88: Argument count mismatch for function `ELU'. The number of
passed arguments must match the number of arguments the function
requires.
ERROR (VACOMP-1563):
"/nethome/gjeong35/iwo_transistor/LVIWO_nch_elu_elu/veriloga/veriloga.va",
line 88: Encountered invalid type conversion for `hc1_0' (`*undef*' to
`real'). Check the validity of conversion and try again.
ERROR (VACOMP-1240): "hc1_1 =
ELU(-1.2754086*Vgs+1.0171142*Vds+-0.18343183*Lg+0.44029102)<<--? ;"
"/nethome/gjeong35/iwo_transistor/LVIWO_nch_elu_elu/veriloga/veriloga.va",
line 89: Argument count mismatch for function `ELU'. The number of
passed arguments must match the number of arguments the function
requires.

The spectre version is 23.10.053. Thank you for your help in advance!

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    First of all, posting your question in an appropriate forum is wise (the Feedback, Questions and Suggestions forum is for issues with the forums themselves, not for technical questions).

    Secondly, posting something complete enough to reproduce the problem helps. There was a lot missing from your code to make it run.

    Anyway, the key issue is that you didn't declare any input parameters to the ELU analog function so it wasn't expecting any arguments. You should have defined it like this:

     analog function real ELU;
     input k;
     real k;
     real alpha = 1.0; // Setting alpha value
     begin
     ELU = (k > 0) ? k : alpha * (exp(k) - 1);
     end
     endfunction
    

    I'm not sure what the "Cadence virtuoso solver" is that you're referring to (there is no "Cadence virtuoso solver"), but this will be an issue in any version of Spectre because it isn't correct according to the Verilog-A/AMS LRM.

    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