• 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 SKILL
  3. defstruct being re-cast as array in procedure called within...

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 13102
  • 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

defstruct being re-cast as array in procedure called within procedure

aakhavan
aakhavan over 7 years ago

I have three procedures: portDesign(), portCellview(), and loadPortMap().

portDesign() is the "top level" procedure

loadPortMap() is called within portDesign(), converts a DPL to a 2D association table whose elements are defstructs, and returns that.

portCellview() is called within portDesign() and uses the 2D association table. However, when portCellView() attempts to access one of these defstruct elements, I get a get/getq error of "first arg must be either symbol, list, defstruct or usertype - array@0x12345678".

If I pp(associationTable[0][0]) in portDesign, it prints defstruct_name@0x12345678. if I pp(associationTable[0][0]) in portCellview, it prints array@0x12345678. It seems that its pointing to the right location, but somehow is confusing the variable type.

Any idea what's going on here and how to fix it? (See some psuedo code below)

I suspect it may be a scoping issue. Note: If I put the assocTable in portDesign()'s prog(), and pass the variable to portCellView(), I still observe the same behavior.

procedure(portDesign()
prog(()
assocTable = loadPortMap()
pprint(assocTable[0][0]) ;prints ds@0x...
portCellView(); throws error
))

procedure(portCellView()
prog((dummy)
pp(assocTable[0][0]) ;prints array@0x... (same address as above)
dummy = assocTable[0][0]->ds_ele ;throws error
))

procedure(loadPortMap()
prog((assocTable)
assocTable = makeTable("assoc1"
)assocTable[0] = makeTable("assoc2")
assocTable[0][0] = make_ds(?ds_ele 1)
return(assocTable)
))

defstruct(ds ds_ele)
  • Cancel
  • aakhavan
    aakhavan over 7 years ago

    The problem was, effectively, that I had a variable named ds in the portCellView() function. Don't name variables after your defstructs!

    • 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