• 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. Mixed-Signal Design
  3. VerilogA: analysis function will not take a string vari...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 64
  • Views 9826
  • 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: analysis function will not take a string variable

NewScreenName
NewScreenName over 3 years ago

Hello,

I am trying to create my own analysis dependent switch.

Let's say I want it to be a closed switch during a certain analysis that I decide as a parameter when I instantiate the switch, and open otherwise, thus I wrote the following below. However I get an error "incorrect argument type for 'analysis'. specify one or more constant string arguments".

Now I am quite unsure how to solve this, ana is indeed defined to be a string, and if I wrote analysis("dc") instead of analysis(ana), then it would work properly.

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

module analysis_switch(in, ou);

inout in, ou;

electrical in, ou;

parameter string ana = "dc";

analog begin
if(analysis(ana))
V(ou,in)<+0;
else
I(ou,in)<+0;
end

endmodule

Thank you

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    There's the built-in component switch in spectre which does this already. Can you use that instead? If using in Virtuoso, there is the sp[1234]tswitch components in analogLib which netlist to the spectre switch component.

    The approach above won't work because the analysis function expects a literal constant string (this is clear from the Verilog-AMS standard LRM too).

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName over 3 years ago in reply to Andrew Beckett

    Thank you for your reply.

    The reason I am not using the component provided in analogLib is because it allows you to choose only among DC, AC, tran, IC. Now suppose in a testbench I want the switch to be open only for sp analysis and closed for any other analysis, then, correct me if I am wrong, the sp[1234]tswitch will not do the job, right?

    Regarding the literal constant string: it is not clear to me when I write string ana ="something"; now isn't ana a string? And so, what is the difference between this string and such expected literal constant string? (even when it is not a parameter it won't work).

    I've had a look at the verilog AMS LRM, and from there paragraph 3.3 it looks to me like "something" being a literal string, when assigned to a variable var="something" then var becomes a string, which is something different than a literal constant string. So what could be the workaround to have a switch with a parameter where I choose the target analysis? (otherwise I should create a cell for each different combination of analyses that I want it to be selective to).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to NewScreenName

    I believe that "ac" will work for sp analysis too on the switch component (I didn't check to be sure though). It would be very strange to only want a setting for a model in a specific analysis (i.e. "sp" and not "ac"), but maybe you want this for some reason.

    Anyway, the issue is not that. you can't have string parameters - of course you can. The issue is that the analysis function only supports literal strings. From A.8.2 Function Calls:

    analysis_function_call ::= analysis ( " analysis_identifier " { , " analysis_identifier " } )

    Notice that the analysis_identifier are in quotes. It doesn't support parameters or variables with the analysis. This is probably because it needs to be known quite earlier for compilation/optimisation purposes. The message you are getting is indicating that it needs a constant string expression as the argument to analysis. Passing a parameter would need this to be resolved differently on each instance of the model, for example.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName over 3 years ago in reply to Andrew Beckett

    Alright, so it I understand there is not really a workaround for this, but creating one cell for each specific set of analyses I want my switch to be selective to.

    Thank you for your answers

    • 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