• 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 VACOMP-2032: Parameter for port width leads to...

Stats

  • Replies 7
  • Subscribers 127
  • Views 2028
  • Members are here 0

Verilog A VACOMP-2032: Parameter for port width leads to error.

MC20250412421
MC20250412421 4 months ago

Hello,

I am trying to generate a block to use in my schematics which has a output port bus with a width defined by a parameter. To illustrate my problem I copied the code from a language reference manual for verilog A I found on the internet: https://www.siue.edu/~gengel/ece585WebStuff/OVI_VerilogA.pdf

This following code is the example at section 6-8 (page 94), it has a port "out" which has a width defined by the parameter bits=8.


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

module adc(in,out);

    parameter bits=8, fullscale=1.0, delay=0.0, ttime=10n ;
    input in ;
    output [0:bits-1] out ;
    electrical in, out ;
    real sample, thresh ;
    
    analog begin
        thresh = fullscale/2.0 ;
        generate i (bits-1,0) begin
            V(out[i]) <+ transition(sample > thresh, delay, ttime) ;
            if (sample > thresh) sample = sample - thresh ;
            sample = 2.0 * sample ;
        end
    end

endmodule

Building this module by clicking the button in the cadence verilog A text editor gives me the following error:


    Error found by spectre during AHDL compile.
    ERROR (VACOMP-2032):
        "/veriloga.va",
        line 6: The range specifications in the two declarations of the port
        'out' have different size, direction, or index. Provide the same range
        specification and rerun the simulation.
    ERROR (VACOMP-1816): Exiting AHDL compilation.

Is it possible to possible to define a port width as a parameter ? If so is there anything I can do to fix the code so that at the end I am able to generate a symbol to use in my schematics ?

Thanks in advance !

  • Sign in to reply
  • Cancel
  • Volker T
    Volker T 4 months ago

    Hi,

    you simply need to define the electrical net to have the same size.

    Instead of writing

    electrical in, out ;

    you should write

    electrical in ;

    electrical [0:bits-1] out ;

    EDIT:

    And by the way, I am not sure if "bits" may be specified as a parameter (it will be tough to keep that in sync with the symol).

    If it does not work as a parameter, use a macro instead:

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

    `define bits 8 module adc(in,out); parameter fullscale=1.0, delay=0.0, ttime=10n ; input in ; output [0:`bits-1] out ;
    electrical in ;
    electrical [0:`bits-1] out ;
        real sample, thresh ;

    analog begin
    ...
    end
    endmodule
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • henker
    henker 4 months ago in reply to Volker T

    Have a look at the article "How to create a VerilogA model of a DAC with a variable width bus input"

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O0V00000911TpUAI&pageName=ArticleContent

    Regards,

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Volker T
    Volker T 4 months ago in reply to henker

    Very interesting. Thank you.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • MC20250412421
    MC20250412421 4 months ago in reply to Volker T

    Very sorry for the late reply, I totally missed the cadence notification.
    Your solution is great, I can't believe I didn't think of using a macro, this was what I was looking for.
    Concerning the bus width, it may very well have been a typo in the reference manual, my bad for not looking at the code closer.

    Thanks a lot Volker T and have a great day !

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • MC20250412421
    MC20250412421 4 months ago in reply to henker

    Unfortunately your link seems to ask for a Cadence Host ID which I do not have access to but regardless, I eventually found out on another forum that cadence's implementation of Verilog A in virtuoso doesn't allow for the port width to be a parameter while the original verilog A standard apparently does as highlighted in the reference manual.
    Couldn't be a cadence product if they didn't find a way to make things harder then they should be : )
    In any case, Volker's answer of using a macro perfectly fits my needs.

    Thanks a lot for your input henker 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 4 months ago in reply to MC20250412421
    MC20250412421 said:
    I eventually found out on another forum that cadence's implementation of Verilog A in virtuoso doesn't allow for the port width to be a parameter while the original verilog A standard apparently does as highlighted in the reference manual.
    Couldn't be a cadence product if they didn't find a way to make things harder then they should be : )

    Not strictly true (it's not that our implementation of VerilogA doesn't support the port width to be a parameter - it does). The challenge is that for this to work with ADE netlisting, you need to have a symbol with a parameterised bus width, and also the "shadow" database alongside the veriloga view to also have a parameterised bus width - this is so that the placed symbol and switch view match. OpenAccess itself (the database used by Virtuoso and many other industry tools) doesn't directly support parameterised bus widths, but instead we can make these parameterised cells which allows the bus width to be changed dynamically based on a parameter. That's exactly what the article that Volker pointed to does (I wrote it!). Yes, it's a little bit tricky but not too hard if you follow the article.

    You might think this is just us making it harder than it should be, but it's really due to a limitation of the industry-standard database format.

    The hostid you need (by the way) is the hostid of your license server - if you know where your license server is, you can log onto that and run "lmhostid" and then use that to register yourself. If you are having difficulty creating an account, email support@cadence.com for assistance in getting logged in.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • MC20250412421
    MC20250412421 4 months ago in reply to Andrew Beckett

    Thanks immensely Andrew Beckett !

    I never knew about OpenAccess before so I understand the reason behind this design decision now. In any case, I was able to easily fix my issue using a macro. Having the port width as a parameter that can easily be set inside the schematic could potentially be something I'll look into further down the road. The parametrized cells seem like something that could come in handy for me.

    I really value posts like yours because they shed light on what feels to me like a very obscure, corporate and proprietary software which is virtuoso.
    I'll be transparent and mention that I am a university student who has been using cadence (mostly virtuoso) on university servers for about a year now so concerning the hostid, I'm afraid that's not something I really have access to. I also once asked cadence support a question about virtuoso and they refused to answer stating it was against the university agreement. Thankfully, these forums are open and I must thank you Andrew for all these posts you've done all these years, you really helped me immensely, more than you can think of. I can of course ask the EDA staff at my university but sometimes it's just quicker to use this forum.

    Having said all this, as someone new to the EDA space and to Cadence, I must admit that my main gripe with the whole leaning experience is that finding support and good documentation for it feels needlessly hard. I needed some documentation for a SKILL script and some Analog Lib blocks and it was very hard to find inside your manuals and impossible to find online given how closed and secretive everything seems to be. I know cadence is a business and needs to sell online courses too but come on, I'm not asking you to become an open source project, just make my life easier trying to learn your product Joy

    Sorry for the rant, I guess much of what I perceive as being bad in cadence virtuoso mostly stems from my limited knowledge of it. These forums are great, they have already helped me so much so I'll probably be back eventually.

    Thanks again Andrew and have a great day/evening !

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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