<@U016EM8L91B> is it possible to use tcl to creat ...
# magic
s
@Tim Edwards is it possible to use tcl to creat pcell in magic? Thank you
t
Of course. That's the basis of the device generators for sky130 and gf180mcu.
s
Do you have a tutorial to teach how to do it in your open circuit design website?
t
Unfortunately, not really. I have a placeholder web page that has never been finished. None of it was very refined until recently when I was able to do a lot of development with sky130 and gf180mcu. For now, you have to mostly work by example from the existing device generators. Fortunately, the existing device generators cover most use cases that you would need.
s
Thank you. Which is the correct directory to locate the device generators? 👍
t
Short summary: Look at the examples in the open_pdks repository under
sky130/magic/sky130.tcl
and
gf180mcu/magic/gf180mcu.tcl
. Every defined device needs to define five procedures:
<device>_defaults
sets default parameters
<device>_dialog
defines the dialog GUI
<device>_convert
describes how to import from SPICE
<device>_check
checks parameter limits
<device>_draw
draws the device. There are basic routines for device types like
mos_draw
that handle most basic devices for the process and can be extended by passing local parameters. The parameterization is handled by passing around a Tcl dictionary variable called
parameters
and merging it with local modifications. The base dictionary is
ruleset
(mostly DRC rule distances), then each device has a dictionary that comes from the
_defaults
procedure, is merged with values captured from the dialog, and passed to the
_draw
procedure, where it is combined with a dictionary specific to the device being drawn. Most of the drawing involves manipulating the "cursor box" in magic and using a stack with the commands
pushbox
and
popbox
to save and retrieve the box in specific positions. I could go on, but it would take all day and then I'd be writing the documentation that I'm missing, which is what I really should be doing instead of posting in Slack.
👍 2