• 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 2061
  • 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
Parents
  • 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
  • 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
Reply
  • 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
Children
No Data

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