• 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. how to test if a table exist or not

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 14394
  • 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

how to test if a table exist or not

WTony
WTony over 7 years ago

Hi,

I'm trying to verify is a table exist, if not the it will create it.

if(tablep(My_table) then
       for( i 2 length(word)/2-1
              My_table[list(nthelem(2 word) nthelem(2*i+1 word))] = nthelem(2*i+2 word)
       )
else
       My_table=makeTable("Table")
)

Message: *Error* eval: unbound variable - My_table

I can use "boundp" to test it but if they have "tablep" function, it should be able to work.

Thanks

  • Cancel
  • skillUser
    skillUser over 7 years ago

    Hi Yu Hao,

    I think that you need to combine the boundp() test AND the tablep() test:

    
    if(and(boundp('My_table) tablep(My_table)) then
      for(i 2 length(word)/2-1
        My_table[list(nthelem(2 word) nthelem(2*i+1 word))] = nthelem(2*i+2 word)
      )
    else 
      My_table=makeTable("Table") 
    ) 

    However, if your "My_table" variable is declared in a 'let()' statement it will already exist and have a default value of 'nil', so I guess you have not declared the variable?

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • WTony
    WTony over 7 years ago in reply to skillUser

    thanks,

    yes, I didn't declare it in the let(). after declare it, it works

    • 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