• 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. Functional Verification
  3. Replication Patterns

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 64
  • Views 15204
  • 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

Replication Patterns

archive
archive over 18 years ago

Look what I got!

    preamble =   '{PREAMBLE_SIZE{40'hDDDDDDDDDD}};
                                |
ncvlog: *E,APTYPE (/lsi/ftc/yampa_design/users/dfechser/experimental/lib/lsi_uvc_lib/lsi_nrz/sv/lsi_nrz_package.sv,81|32): Assignment Pattern - replication patterns unsupported at this time (PREAMBLE_SIZE) [SystemVerilog].


...anyone know when ncverilog will support this (PREAMBLE_SIZE is a variable)?

Dave F.


Originally posted in cdnusers.org by dfechser
  • Cancel
  • archive
    archive over 18 years ago

    I'm assuming that PREAMBLE_SIZE is a parameter. In that case, you could try to add another set of brackets like


    parameter PREAMBLE_SIZE=16;
    ...
    preamble = '{{PREAMBLE_SIZE{40'hDDDDDDDDDD}};
    ....

    David Walker


    Originally posted in cdnusers.org by dwalker@sirenza.com
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    PREAMBLE_SIZE is an input to the "new" function and is used to set the size of the dynamic array.

    When I added the extra brackets I get an error that says "Illegal operand for constant expression" which sounds closer than I was before. 

    I need to figure out how to tell SV that the function input is a constant, I guess.


    Originally posted in cdnusers.org by dfechser
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    Hm, I tried "const ref" and "const ref int" and both give me the same error message:

    "Illegal operand for constant expression"

    Does anyone have any ideas?

    What I have is a transaction with resizeable preamble, data, and flush fields so I want to set them in the new() function and use dynamic arrays to hold the parts.


    Originally posted in cdnusers.org by dfechser
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    replication patterns are not currently supported, something like the following works in 5.8. not the most elegant, but the underlying implementation would need to do the same....

    module temp;

    parameter PREAMBLE_SIZE = 16;
    bit preamble[];

    initial
    begin
    preamble=new[PREAMBLE_SIZE];
    for (int i=0; i preamble[i]=40'hDDDDDDDDDD;
    end

    endmodule


    Originally posted in cdnusers.org by Jim McGrath
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    If it's a parameter, why not do

    ------------------------------------
    module temp;

    parameter PREAMBLE_SIZE = 16;
    bit [PREAMBLE_SIZE*40-1:0] preamble;

    initial begin
    preamble='{{PREAMBLE_SIZE{40'hDDDDDDDDDD}}};
    end

    endmodule
    ------------------------------------
    It compiled for me in 5.83. I assume the OP wanted to pass it to a task as a parameter like

    ------------------------------------
    module test;

    // the dynamic array must be defined here because it is invalid in a task
    bit preamble[];

    task xxx(input int PREAMBLE_SIZE);


    preamble = new[PREAMBLE_SIZE*40];

    preamble = '{PREAMBLE_SIZE{40'hDDDDDDDDDD}};

    endtask

    initial begin
    xxx(13);
    xxx(10);
    end

    endmodule
    ------------------------------------

    When I did this, I got the same error messages as the OP. I tried your for loop trick in the above and it worked OK.

    David Walker


    Originally posted in cdnusers.org by dwalker@sirenza.com
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    yeah, my bad. The issue is with replication initialization which is not currently supported. ~jm


    Originally posted in cdnusers.org by Jim McGrath
    • 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