• 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 do a search on the name of the table

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 15219
  • 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 do a search on the name of the table

WTony
WTony over 7 years ago

Hi,

I created few table with makeTable command. Now, I'm trying to find the table base on the name of the table. I don't have any clue how to get that information. I can use printstruct to get see the table name but I can't store that information to a variable.

MyTable1 = makeTable("Table1")

MyTable2 = makeTable("Table2")

MyTable3 = makeTable("Table3")

how can I do a search by name ("Table1")

If I do printstruct(MyTable1), it show: "structure of type association table (table:Table1):"

but I can't extract that information

Any idea how can I get It.

Thanks for all the suggestion

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    I'm not really sure why you want to do this, because the "name" given as the first argument to makeTable is not very useful - all it affects is the "print name" of the table - it's not used for anything else. There's no requirement for it to be unique, so having code that distinguishes on it is not very useful. I'm not sure what you mean by "search on the name of the table" - there's no mechanism to search based on this name (because it doesn't need to be unique). The primary purpose is when debugging that you can get some idea of what kind of data you might have in the table if your code is producing multiple tables with different kinds of content.

    Now, if you really want to retrieve the table name from an instance of a table, you can do that:

    cadr(parseString(sprintf(nil "%L" MyTable2) ":"))

    This would return "Table2"

    Regards,

    Andrew.

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

    I have a procedure that create the table. and it return all the table created base on the file read. It can create 1 to 3 tables. 

    So when I call yhwReadFile() it can return:

    a = yhwReadFile()
    (table:TAP table:Pcell)

    a = yhwReadFile()
    (table:TAP table:Pcell table:prBoundary)

    a = yhwReadFile()
    (table:Pcell)

    so when I want to process those Table, I need first to know which table I'm processing.

    I wish that is more clear why I need to find which table is it.

    Thanks

    procedure(yhwReadFile()
      prog((lines Pcell_table TAP_table prB_table)
        if( yhwFile = infile("~/Porting2/port/txana_drv_hbridge_out2x_2to1_nostack.txt") then
        while(gets(line yhwFile)
          word = parseString(line " ")
          length(word)
          case( nthelem(1 word)
            ("Pcell"
              if(!tablep(Pcell_table) then
               Pcell_table=makeTable("Pcell")
              )
            )
            ("TAP"
              if(!tablep(TAP_table) then
                TAP_table=makeTable("TAP")
              )
            )
            ("prBoundary"
              if(!tablep(prB_table) then
                prB_table=makeTable("prBoundary")
              )
            )
            (t
            )
          )
        )
        )
      all_Table = list()
      if(tablep(prB_table) then
        all_Table = cons(prB_table all_Table)
      )
      if(tablep(Pcell_table) then
        all_Table = cons(Pcell_table all_Table)
      )
      if(tablep(TAP_table) then
        all_Table = cons(TAP_table all_Table)
      )
      return(all_Table)
     )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • WTony
    WTony over 7 years ago in reply to Andrew Beckett

    I have a procedure that create the table. and it return all the table created base on the file read. It can create 1 to 3 tables. 

    So when I call yhwReadFile() it can return:

    a = yhwReadFile()
    (table:TAP table:Pcell)

    a = yhwReadFile()
    (table:TAP table:Pcell table:prBoundary)

    a = yhwReadFile()
    (table:Pcell)

    so when I want to process those Table, I need first to know which table I'm processing.

    I wish that is more clear why I need to find which table is it.

    Thanks

    procedure(yhwReadFile()
      prog((lines Pcell_table TAP_table prB_table)
        if( yhwFile = infile("~/Porting2/port/txana_drv_hbridge_out2x_2to1_nostack.txt") then
        while(gets(line yhwFile)
          word = parseString(line " ")
          length(word)
          case( nthelem(1 word)
            ("Pcell"
              if(!tablep(Pcell_table) then
               Pcell_table=makeTable("Pcell")
              )
            )
            ("TAP"
              if(!tablep(TAP_table) then
                TAP_table=makeTable("TAP")
              )
            )
            ("prBoundary"
              if(!tablep(prB_table) then
                prB_table=makeTable("prBoundary")
              )
            )
            (t
            )
          )
        )
        )
      all_Table = list()
      if(tablep(prB_table) then
        all_Table = cons(prB_table all_Table)
      )
      if(tablep(Pcell_table) then
        all_Table = cons(Pcell_table all_Table)
      )
      if(tablep(TAP_table) then
        all_Table = cons(TAP_table all_Table)
      )
      return(all_Table)
     )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to WTony

    Probably what I’d do is return an object wrapping the table rather than directly returning the table. This could be done very elegantly using the SKILL++ object system. For example:  

    defclass(yhwTable ()
      (
        (table @reader yhwGetTable @initform makeTable("theTable"))
      )
    )
    (defclass yhwPcellTable (yhwTable))
    (defclass yhwTAPTable (yhwTable))
    (defclass yhwPrBoundaryTable (yhwTable))
    (defmethod yhwProcessTable ((tableObj yhwPcellTable))
      let((table)
        table=yhwGetTable(tableObj)
        printf("I'm processing the PCell Table and it contains:\n")
        pprint(tableToList(table))
        newline()
      )
    )
    (defmethod yhwProcessTable ((tableObj yhwTAPTable))
      let((table)
        table=yhwGetTable(tableObj)
        printf("I'm processing the TAP Table and it contains:\n")
        pprint(tableToList(table))
        newline()
      )
    )

    You then can create the objects using:  

     Pcell_table=makeInstance(‘yhwPcellTable)  

    Having created the table wrapper object, you could then use either Pcell_table->table to retrieve that actual table inside the object, or yhwGetTable(Pcell_table) - take your pick.  

    As you can see, I’m defining a method specialised on the specific table type to do the processing - it will automatically call the right method based on the class of the object.  

    Regards,  

    Andrew.  

    • 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