• 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. get/getq: first arg must be either symbol, list, defstruct...

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 148
  • Views 2385
  • 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

get/getq: first arg must be either symbol, list, defstruct or user type - 67.45

ramdev
ramdev over 1 year ago

I’m trying to connect a same nets with different metal layers to connect together with a via, when I trying to execute a code it runs. But when I trying to use that it shows this error in ciw window.

get/getq: first arg must be either symbol, list, defstruct or user type - 67.45

here is the code

; Function to check if the object is a metal layer

procedure(dblsMetal(obj)

let((layerName)

layerName = obj~ > layerName

; Adjust the metal layer names as per your environment

member(layer Name '(METAL1" "METAL2" "METAL3" "METAL4" "METAL5" "METAL"))

)

)

; Function to determine the appropriate via type based on layer names

procedure(getViaType(layer1 layer2)

let(via Type)

cond(

(equal layer1 "METAL1") && (equal layer2 "METAL2")) (via Type = "VIA12")

(equal layer1 "METAL2" && (equal layer2 "METAL1")) (viaType = "VIA12")

(equal layer1 "METAL2") && (equal layer2 "METAL3")) (viaType = "VIA23")

(equal layer 1 "METAL3") && (equal layer2 "METAL2")) (via Type = "VIA23")

(equal layer 1 "METAL3") && (equal layer2 "METAL4") (via Type = "VIA34")

(equal layer1 "METAL4") && (equal layer2 "METAL3")) (viaType = "VIA34")

((equal layer 1 "METAL4") && (equal layer2 "METALS")) (viaType = "VIA45")

(equal layer 1 "METAL5") && (equal layer2 "METAL")) (viaType = "VIA56")

(equal layer 1 "METAL") && (equal layer2 "METALS")) (via Type = "VIA56")

(t error"Unsupported layer combination for via creation."))

)

viaType

)

)

; Main function to connect metals procedure(connectMetals

let((selection metals sameNetLayer sameNetLayer2 via Type startPoint endPoint)

; Get the selected objects using geGetSelSet for partial selection

selection = geGetSelSetO

unless(selection

error ("No objects selected.")

)

; Filter selected metals

metals = setof(obj selection dbIsMetal(obj))

; Debug message to print the metals found

printf("Metals selected: %L\n" metals)

; Check if two metals are selected

unless(length(metals) = = 2

error("Please select exactly two metal shapes.")

; Check if metals are on the same net

sameNetLayer = car(metals)

sameNetLayer2 = cadr(metals)

unless(sameNetLayer ~>net == sameNetLayer2~>net

error("Selected metals are not on the same net.")

)

; Get the starting and ending points for creating the path

startPoint = list((sameNetLayer1~>bBox~>IIx + sameNetLayer~>bBox~>urx) / 2

(sameNetLayer1~>bBox~>Ily + sameNetLayer1~>bBox~>ury) / 2)

endPoint = list((sameNetLayer2~>bBox~>lIx + sameNetLayer2~>bBox~>urx) / 2

(sameNetLayer2~>bBox~>Ily + sameNetLayer2~>bBox~>ury) / 2)

; Check if metals are on the same or different layers

if(sameNetLayer1~>layerName = = sameNetLayer2~> layerName then

; Connect metals directly

printi( Connecting metals directly without via. In')

dCreatePath(sameNetLayer1 ~ > cellView sameNetLayer1 ~ > layerName

sameNetLayer1 ~ > purpose startPoint endPoint

; Determine the via type

via Type = getVia Type(sameNetLayer1~> layerName sameNetLayer2~> layerName)

; Debug message to print the via type

printf("Connecting metals with via type: %5\n" via Type)

; Create a via to connect different layers

dbCreateVia(sameNetLayer1~> cellView viaType startPoint)

)

)

)

; Ensure the Layout window is active and the function is loaded when(hiGetCurrentWindow0 ~>type == "layout"

hiSetBindKey("Layout" "CtrI < Key>c" "connectMetals")

printf("Bindkey for 'connectMetals' is set to Ctri+ c\n*))

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    Given that this code is full of errors - spaces in the wrong place, missing parentheses, misspelt function names, debugging it is going to be pretty much impossible. Did you copy and paste it from an image of the code (using some kind of optical character recognition?), because there are so many problems with it that I'd hate to try to guess where the problem is.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ramdev
    ramdev over 1 year ago in reply to Andrew Beckett

    ; Function to check if the object is a metal layer
    procedure(dblsMetal (obj)
    let((layerName)
    layerName = obj~>layerName
    ; Adjust the metal layer names as per your environment
    member(layerName '("METAL1" "METAL2" "METAL3" "METAL4" "METAL5" "METAL6"))
    )
    )

    ; Function to determine the appropriate via type based on layer names
    procedure(getViaType(layer1 layer2)
    let((viaType)
    cond (
    ((equal layer1 "METAL1") && (equal layer2 "METAL2")) (viaType = "VIA12")
    ((equal layer1 "METAL2") && (equal layer2 "METAL1")) (viaType = "VIA12")
    ((equal layer1 "METAL2") && (equal layer2 "METAL3")) (viaType = "VIA23")
    ((equal layer1 "METAL3") && (equal layer2 "METAL2")) (viaType = "VIA23")
    ((equal layer1 "METAL3") && (equal layer2 "METAL4")) (viaType = "VIA34")
    ((equal layer1 "METAL4") && (equal layer2 "METAL3")) (viaType = "VIA34")
    ((equal layer1 "METAL4") && (equal layer2 "METAL5")) (viaType = "VIA45")
    ((equal layer1 "METAL5") && (equal layer2 "METAL4")) (viaType = "VIA45")
    ((equal layer1 "METAL5") && (equal layer2 "METAL6")) (viaType = "VIA56")
    ((equal layer1 "METAL6") && (equal layer2 "METAL5")) (viaType = "VIA56")
    (t (error "Unsupported layer combination for via creation."))
    )
    viaType
    )
    )

    ; Main function to connect metals
    procedure(connectMetals()
    let((selection metals sameNetLayer1 sameNetLayer2 viaType startPoint endPoint)

    ; Get the selected objects using geGetSelSet for partial selection
    selection = geGetSelSet()
    unless (selection
    error("No objects selected.")
    )

    ; Filter selected metals
    metals = setof(obj selection dblsMetal(obj))

    ; Debug message to print the metals found
    printf("Metals selected: %L\n" metals)

    ; Check if two metals are selected
    unless (length(metals) == 2
    error("Please select exactly two metal shapes.")
    )

    ; Check if metals are on the same net
    sameNetLayer1 = car(metals)
    sameNetLayer2 = cadr(metals)

    unless (sameNetLayer1~>net == sameNetLayer2~>net
    error("Selected metals are not on the same net.")
    )

    ; Get the starting and ending points for creating the path
    startPoint = list((sameNetLayer1~>bBox~>llx + sameNetLayer1~>bBox~>urx) / 2
    (sameNetLayer1~>bBox~>lly + sameNetLayer1~>bBox~>ury) / 2)
    endPoint = list((sameNetLayer2~>bBox~>llx + sameNetLayer2~>bBox~>urx) / 2
    (sameNetLayer2~>bBox~>lly + sameNetLayer2~>bBox~>ury) / 2)

    ; Check if metals are on the same or different layers
    if (sameNetLayer1~>layerName == sameNetLayer2~>layerName) then
    ; Connect metals directly
    printf("Connecting metals directly without via.\n")
    dbCreatePath(sameNetLayer1~>cellView
    sameNetLayer1~>layerName
    sameNetLayer1~>purpose
    startPoint endPoint)
    else
    ; Determine the via type
    viaType = getViaType(sameNetLayer1~>layerName sameNetLayer2~>layerName)
    ; Debug message to print the via type
    printf("Connecting metals with via type: %s\n" viaType)
    ; Create a via to connect different layers
    dbCreateVia(sameNetLayer1~>cellView viaType startPoint)
    )

    ; Ensure the Layout window is active and the function is loaded
    when (hiGetCurrentWindow()~>type == "layout"
    hiSetBindKey("Layout" "Ctrl<Key>c" "connectMetals()")
    printf("Bindkey for 'connectMetals' is set to Ctrl+c\n")
    )
    )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to ramdev

    There's still lots of spaces in the wrong place, parentheses wrong and so on. However, it fails because of this:

    ; Get the starting and ending points for creating the path
    startPoint = list((sameNetLayer1~>bBox~>llx + sameNetLayer1~>bBox~>urx) / 2
    (sameNetLayer1~>bBox~>lly + sameNetLayer1~>bBox~>ury) / 2)
    endPoint = list((sameNetLayer2~>bBox~>llx + sameNetLayer2~>bBox~>urx) / 2
    (sameNetLayer2~>bBox~>lly + sameNetLayer2~>bBox~>ury) / 2)

    You can't use ~>llx and ~>urx etc on a bounding box (which is a list of lists). Instead, I'd suggest:

    destructuringBind(((llx lly) (urx ury)) sameNetLayer1~>bBox
      startPoint=list((llx+urx)/2 (lly+ury)/2)
    )
    destructuringBind(((llx lly) (urx ury)) sameNetLayer2~>bBox
      endPoint=list((llx+urx)/2 (lly+ury)/2)
    )

    After that, the via creation code is just wrong. You need to find the via def from the tech file, and you weren't giving the right number of arguments for the dbCreateVia function. Also the dbCreatePath is incorrect - see the comments below.

    In future, please make sure that the code you post actually runs (at least runs with the same errors you are seeing). Figuring out which errors were due to optical character recognition failures and which were the bugs in your code is not a good use of time for volunteers on this forum.

    Anyway, here's the corrected* code. * - the metal layers and vias were changed, and I'm not sure the code actually does what you want, but it does seem to run in my limited testing (well, I didn't test the branch where it got to dbCreatePath, because that will certainly fail as is).

    ; Function to check if the object is a metal layer
    procedure(dbIsMetal(obj)
      let((layerName)
        layerName = obj~>layerName
        ; Adjust the metal layer names as per your environment
        member(layerName '("Metal1" "Metal2" "Metal3" "Metal4" "Metal5" "Metal6"))
      )
    )
    
    ; Function to determine the appropriate via type based on layer names
    procedure(getViaType(layer1 layer2)
      let((viaType)
        cond(
          (((equal layer1 "Metal1") && (equal layer2 "Metal2")) viaType = "M2_M1")
          (((equal layer1 "Metal2") && (equal layer2 "Metal1")) viaType = "M2_M1")
          (((equal layer1 "Metal2") && (equal layer2 "Metal3")) viaType = "M3_M2")
          (((equal layer1 "Metal3") && (equal layer2 "Metal2")) viaType = "M3_M2")
          (((equal layer1 "Metal3") && (equal layer2 "Metal4")) viaType = "M4_M3")
          (((equal layer1 "Metal4") && (equal layer2 "Metal3")) viaType = "M4_M3")
          (((equal layer1 "Metal4") && (equal layer2 "Metal5")) viaType = "M5_M4")
          (((equal layer1 "Metal5") && (equal layer2 "Metal4")) viaType = "M5_M4")
          (((equal layer1 "Metal5") && (equal layer2 "Metal6")) viaType = "M6_M5")
          (((equal layer1 "Metal6") && (equal layer2 "Metal5")) viaType = "M6_M5")
          (t (error "Unsupported layer combination for via creation."))
        )
        viaType
      )
    )
    
    ; Main function to connect metals
    procedure(connectMetals()
      let((selection metals sameNetLayer1 sameNetLayer2 viaType startPoint endPoint
         tfId viaDef)
    
        ; Get the selected objects using geGetSelSet for partial selection
        selection = geGetSelSet()
        unless(selection
          error("No objects selected.")
        )
    
        ; Filter selected metals
        metals = setof(obj selection dbIsMetal(obj))
    
        ; Debug message to print the metals found
        printf("Metals selected: %L\n" metals)
    
        ; Check if two metals are selected
        unless(length(metals) == 2
          error("Please select exactly two metal shapes.")
        )
    
        ; Check if metals are on the same net
        sameNetLayer1 = car(metals)
        sameNetLayer2 = cadr(metals)
    
        unless(sameNetLayer1~>net == sameNetLayer2~>net
          error("Selected metals are not on the same net.")
        )
    
        ; Get the starting and ending points for creating the path
        /*
        startPoint = list((sameNetLayer1~>bBox~>llx + sameNetLayer1~>bBox~>urx) / 2
        (sameNetLayer1~>bBox~>lly + sameNetLayer1~>bBox~>ury) / 2)
        endPoint = list((sameNetLayer2~>bBox~>llx + sameNetLayer2~>bBox~>urx) / 2
        (sameNetLayer2~>bBox~>lly + sameNetLayer2~>bBox~>ury) / 2)
        */
        destructuringBind(((llx lly) (urx ury)) sameNetLayer1~>bBox
          startPoint=list((llx+urx)/2 (lly+ury)/2)
        )
        destructuringBind(((llx lly) (urx ury)) sameNetLayer2~>bBox
          endPoint=list((llx+urx)/2 (lly+ury)/2)
        )
    
        ; Check if metals are on the same or different layers
        if(sameNetLayer1~>layerName == sameNetLayer2~>layerName then
          ; Connect metals directly
          printf("Connecting metals directly without via.\n")
          ;;; THIS IS INCORRECT. The second argument should be a list of layer
          ;;; and purpose. The third should be a list of start and end points.
          ;;; A fourth argument (the path width) is required too.
          dbCreatePath(sameNetLayer1~>cellView
            sameNetLayer1~>layerName
            sameNetLayer1~>purpose
            startPoint endPoint
          )
        else
          ; Determine the via type
          viaType = getViaType(sameNetLayer1~>layerName sameNetLayer2~>layerName)
          ; Debug message to print the via type
          printf("Connecting metals with via type: %s\n" viaType)
          ; Create a via to connect different layers
          tfId=techGetTechFile(sameNetLayer1~>cellView)
          viaDef=techFindViaDefByName(tfId viaType)
          dbCreateVia(sameNetLayer1~>cellView viaDef startPoint "R0")
        )
      )
    )
    
    ; Ensure the Layout window is active and the function is loaded
    ; this just doesn't work!
    when(hiGetCurrentWindow()~>type == "layout"
    hiSetBindKey("Layout" "Ctrl<Key>" "connectMetals()")
    printf("Bindkey for 'connectMetals' is set to Ctrl+c\n")
    )

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to ramdev

    There's still lots of spaces in the wrong place, parentheses wrong and so on. However, it fails because of this:

    ; Get the starting and ending points for creating the path
    startPoint = list((sameNetLayer1~>bBox~>llx + sameNetLayer1~>bBox~>urx) / 2
    (sameNetLayer1~>bBox~>lly + sameNetLayer1~>bBox~>ury) / 2)
    endPoint = list((sameNetLayer2~>bBox~>llx + sameNetLayer2~>bBox~>urx) / 2
    (sameNetLayer2~>bBox~>lly + sameNetLayer2~>bBox~>ury) / 2)

    You can't use ~>llx and ~>urx etc on a bounding box (which is a list of lists). Instead, I'd suggest:

    destructuringBind(((llx lly) (urx ury)) sameNetLayer1~>bBox
      startPoint=list((llx+urx)/2 (lly+ury)/2)
    )
    destructuringBind(((llx lly) (urx ury)) sameNetLayer2~>bBox
      endPoint=list((llx+urx)/2 (lly+ury)/2)
    )

    After that, the via creation code is just wrong. You need to find the via def from the tech file, and you weren't giving the right number of arguments for the dbCreateVia function. Also the dbCreatePath is incorrect - see the comments below.

    In future, please make sure that the code you post actually runs (at least runs with the same errors you are seeing). Figuring out which errors were due to optical character recognition failures and which were the bugs in your code is not a good use of time for volunteers on this forum.

    Anyway, here's the corrected* code. * - the metal layers and vias were changed, and I'm not sure the code actually does what you want, but it does seem to run in my limited testing (well, I didn't test the branch where it got to dbCreatePath, because that will certainly fail as is).

    ; Function to check if the object is a metal layer
    procedure(dbIsMetal(obj)
      let((layerName)
        layerName = obj~>layerName
        ; Adjust the metal layer names as per your environment
        member(layerName '("Metal1" "Metal2" "Metal3" "Metal4" "Metal5" "Metal6"))
      )
    )
    
    ; Function to determine the appropriate via type based on layer names
    procedure(getViaType(layer1 layer2)
      let((viaType)
        cond(
          (((equal layer1 "Metal1") && (equal layer2 "Metal2")) viaType = "M2_M1")
          (((equal layer1 "Metal2") && (equal layer2 "Metal1")) viaType = "M2_M1")
          (((equal layer1 "Metal2") && (equal layer2 "Metal3")) viaType = "M3_M2")
          (((equal layer1 "Metal3") && (equal layer2 "Metal2")) viaType = "M3_M2")
          (((equal layer1 "Metal3") && (equal layer2 "Metal4")) viaType = "M4_M3")
          (((equal layer1 "Metal4") && (equal layer2 "Metal3")) viaType = "M4_M3")
          (((equal layer1 "Metal4") && (equal layer2 "Metal5")) viaType = "M5_M4")
          (((equal layer1 "Metal5") && (equal layer2 "Metal4")) viaType = "M5_M4")
          (((equal layer1 "Metal5") && (equal layer2 "Metal6")) viaType = "M6_M5")
          (((equal layer1 "Metal6") && (equal layer2 "Metal5")) viaType = "M6_M5")
          (t (error "Unsupported layer combination for via creation."))
        )
        viaType
      )
    )
    
    ; Main function to connect metals
    procedure(connectMetals()
      let((selection metals sameNetLayer1 sameNetLayer2 viaType startPoint endPoint
         tfId viaDef)
    
        ; Get the selected objects using geGetSelSet for partial selection
        selection = geGetSelSet()
        unless(selection
          error("No objects selected.")
        )
    
        ; Filter selected metals
        metals = setof(obj selection dbIsMetal(obj))
    
        ; Debug message to print the metals found
        printf("Metals selected: %L\n" metals)
    
        ; Check if two metals are selected
        unless(length(metals) == 2
          error("Please select exactly two metal shapes.")
        )
    
        ; Check if metals are on the same net
        sameNetLayer1 = car(metals)
        sameNetLayer2 = cadr(metals)
    
        unless(sameNetLayer1~>net == sameNetLayer2~>net
          error("Selected metals are not on the same net.")
        )
    
        ; Get the starting and ending points for creating the path
        /*
        startPoint = list((sameNetLayer1~>bBox~>llx + sameNetLayer1~>bBox~>urx) / 2
        (sameNetLayer1~>bBox~>lly + sameNetLayer1~>bBox~>ury) / 2)
        endPoint = list((sameNetLayer2~>bBox~>llx + sameNetLayer2~>bBox~>urx) / 2
        (sameNetLayer2~>bBox~>lly + sameNetLayer2~>bBox~>ury) / 2)
        */
        destructuringBind(((llx lly) (urx ury)) sameNetLayer1~>bBox
          startPoint=list((llx+urx)/2 (lly+ury)/2)
        )
        destructuringBind(((llx lly) (urx ury)) sameNetLayer2~>bBox
          endPoint=list((llx+urx)/2 (lly+ury)/2)
        )
    
        ; Check if metals are on the same or different layers
        if(sameNetLayer1~>layerName == sameNetLayer2~>layerName then
          ; Connect metals directly
          printf("Connecting metals directly without via.\n")
          ;;; THIS IS INCORRECT. The second argument should be a list of layer
          ;;; and purpose. The third should be a list of start and end points.
          ;;; A fourth argument (the path width) is required too.
          dbCreatePath(sameNetLayer1~>cellView
            sameNetLayer1~>layerName
            sameNetLayer1~>purpose
            startPoint endPoint
          )
        else
          ; Determine the via type
          viaType = getViaType(sameNetLayer1~>layerName sameNetLayer2~>layerName)
          ; Debug message to print the via type
          printf("Connecting metals with via type: %s\n" viaType)
          ; Create a via to connect different layers
          tfId=techGetTechFile(sameNetLayer1~>cellView)
          viaDef=techFindViaDefByName(tfId viaType)
          dbCreateVia(sameNetLayer1~>cellView viaDef startPoint "R0")
        )
      )
    )
    
    ; Ensure the Layout window is active and the function is loaded
    ; this just doesn't work!
    when(hiGetCurrentWindow()~>type == "layout"
    hiSetBindKey("Layout" "Ctrl<Key>" "connectMetals()")
    printf("Bindkey for 'connectMetals' is set to Ctrl+c\n")
    )

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • ramdev
    ramdev over 1 year ago in reply to Andrew Beckett

    Thanks andrew 

    I will check on this.

    • 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.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information