• 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. `case' expression with list literal behaves differently...

Stats

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

`case' expression with list literal behaves differently in pcDefinePCell than in the toplevel

tweeksii
tweeksii over 7 years ago
;; The `case' expression in this pcell is expected to return "V2", but it
;; returns `nil' instead. Why?
(pcDefinePCell (list (ddGetObj "dungeon") "case_in_pcell" "layout")
((metal1_layer "M2")
(metal2_layer "M3"))
(let (via_layer)
(fprintf stdout "%A\n" (list metal1_layer metal2_layer))
(case (list metal1_layer metal2_layer)
((("M1" "M2")) "V1")
((("M2" "M3")) "V2"))
(fprintf stdout "%A\n" via_layer)
(rodCreateRect ?layer via_layer)))

> (load "~/skill/case_in_pcell.il")
Generating Pcell for 'case_in_pcell layout'.
("M2" "M3")
nil
*WARNING* (ROD-1011) rodCreateRect: required argument "?layer" not specified or nil
*WARNING* (ROD-1075) rodCreateRect: command failed in "dungeon/case_in_pcell/layout"
t
> getVersion
"@(#)$CDS: virtuoso version ICADV12.3-64b 09/01/2017 10:34 (sjfhw305) $"
> getVersion t
"sub-version ICADV12.3-64b.500.14 "
> metal1_layer = "M2"
"M2"
> metal2_layer = "M3"
"M3"
> (case (list metal1_layer metal2_layer)
((("M1" "M2")) "V1")
((("M2" "M3")) "V2"))
"V2"

Am I going insane?  ⊙﹏⊙

  • Cancel
  • skillUser
    skillUser over 7 years ago

    Hi Tom,

    I don't see the variable via_layer being assigned, but also I am a little confused by the format of your case statement, partly because I know that 'case' allows for alternative matches in the first item which are represented as a list of choices, but it looks as though you may have dealt with that already?  Anyhow, perhaps try the following:

    
    (pcDefinePCell (list (ddGetObj "dungeon") "case_in_pcell" "layout")
        ((metal1_layer "M2")
         (metal2_layer "M3"))
      (let (via_layer)
        (fprintf stdout "%A\n" (list metal1_layer metal2_layer))
        (setq via_layer (case (list metal1_layer metal2_layer)
          ((("M1" "M2")) "V1")
          ((("M2" "M3")) "V2")))
        (fprintf stdout "%A\n" via_layer)
        (rodCreateRect ?layer via_layer)))
        

    Hopefully it was just the varibale assignment that you overlooked?

    Cheers,

    Lawrence.

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

    Hi Lawrence,

    Thank you for fixing my bug!  You're right, adding the setq fixed it.  ^_^;

    Somehow this equivalent code (with the setq) does not work inside my org's custom pcell compiler, however.... Disappointed  But I'm on my own for that one.

    • 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