• 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. Accessing Packed Arrays using Tcl Interface

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 65
  • Views 14588
  • 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

Accessing Packed Arrays using Tcl Interface

GaneshAMBA
GaneshAMBA over 7 years ago

I am exploring options to access and modify the contents of a packed array in the simulation hierarchy, with the aim of replicating some VPI functionality using the Tcl scripting interface.

I have a small test-case to clarify the issue that I am facing:

The design has a packed array defined as below:

logic [5:0][5:0] packed_array_test;

With vpi_put_value, packed_array_test can be accessed as a single-dimensional array of [35:0], and it is possible to deposit, say, any 32-bit value to packed_array_test[31:0]

Is it possible to get a similar functionality with the Tcl interface?

I have currently tried the following:

xcelium> value %b TB.DUT0.packed_array_test
36'b000000000001000000000000000001000000
xcelium> force TB.DUT0.packed_array_test = 36'h12345FFFF
xcelium> value %b TB.DUT0.packed_array_test
36'b000100100011010001011111111111111111
xcelium> force TB.DUT0.packed_array_test[31:0] = 32'hFFFF1234
xmsim: *E,PINRNG: Index value out of range: [31:0].

It appears that the force command will either work on the full packed array, or, if accessing a particular set of bits, with all the dimensions explicitly specified.

Do the Tcl force / value commands have any options that would allow for packed array access functionality similar to vpi_put_value / vpi_get_value?

  • Cancel
  • tpylant
    tpylant over 7 years ago

    TCL cannot access [31:0] because the array is defined as [5:0][5:0]. 

    xcelium> force TB.DUT0.packed_array_test[3][5:0] = 6'hFF
    xcelium> force TB.DUT0.packed_array_test[2][5:0] = 6'hFF
    xcelium> force TB.DUT0.packed_array_test[1][5:0] = 6'h12

    xcelium> force TB.DUT0.packed_array_test[0][5:0] = 6'h34

    Or 

    xcelium> force TB.DUT0.packed_array_test = 32''hFFFF1234

    Tim

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GaneshAMBA
    GaneshAMBA over 7 years ago in reply to tpylant

    Tim,

    Thank you for the response. I understand the first solution, but it is something not readily implementable in my current setup. The second solution doesn't work always because I might want to access packed_array_test[35:32] alone - something that IS possible with a single call to vpi_put_value / vpi_get_value.

    I was looking to avoid multiple force statements, and also parsing of the 'describe' command output - as they both complicate the overall environment in which the scheme has to work. The input to the Tcl script is just the hierarchical path to the signal and its unrolled packed dimensions - now, it looks like I have to find a way to get the original dimensions of the signal definition from within the Tcl script.

    • 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