Skip to main content

std::symbol

std::symbol is the standard library module that draws a cell's symbol: the shapes, text, and pins a parent's schematic draws each instance of the cell with. See Symbols for how a symbol fits into a cell.

Importing​

Nothing in std::symbol is in scope by default. Import the names a module uses:

use std::symbol::{Align, circle, inst_name, line, param, pin, polygon, rect, text};

rect, polygon, and text also exist in std::layout, so a module that draws both views imports one set under aliases, or calls one by full path. A bare rect that nothing imports is reported as having moved to std::layout.

Every call returns (). Coordinates are keyword arguments in grid units, and are required. Shape and text coordinates are Float, so arrows and bubbles can fall between grid points; pin coordinates are Int, so a parent's wires end on the grid. A Float that depends on constraints waits until it is solved. A value that isn't a finite number is an error.

line​

line(points: [(Float, Float)])

Draws an open polyline.

ArgumentTypeRequirementDescription
points[(Float, Float)]Required, positionalTwo or more points, joined in order.
line([(-4., 0.), (-2., 0.)]);

polygon​

polygon(points: [(Float, Float)], fill=Bool)

Draws a closed outline.

ArgumentTypeRequirementDescription
points[(Float, Float)]Required, positionalThree or more points; the last joins back to the first.
fillBoolOptional keywordWhether the outline is filled. Default false.
polygon([(-2., 2.), (-2., -2.), (2., 0.)]);

rect​

rect(x0=Float, y0=Float, x1=Float, y1=Float, fill=Bool)

Draws an axis-aligned rectangle.

ArgumentTypeRequirementDescription
x0, y0, x1, y1FloatRequired keywordsTwo opposite corners.
fillBoolOptional keywordWhether the rectangle is filled. Default false.
rect(x0=-0.5, y0=-1., x1=0.5, y1=1.);

circle​

circle(x=Float, y=Float, r=Float, fill=Bool)

Draws a circle.

ArgumentTypeRequirementDescription
x, yFloatRequired keywordsThe center.
rFloatRequired keywordThe radius, which must be positive.
fillBoolOptional keywordWhether the circle is filled. Default false.
circle(x=2.25, y=0., r=0.25);

arc​

arc(x=Float, y=Float, r=Float, start=Float, end=Float)

Draws an arc.

ArgumentTypeRequirementDescription
x, yFloatRequired keywordsThe center.
rFloatRequired keywordThe radius, which must be positive.
start, endFloatRequired keywordsThe angles the arc runs between, counterclockwise from start to end, in degrees from the +x axis.
arc(x=0., y=0., r=1., start=0., end=180.);

text​

text(value: String, x=Float, y=Float, size=Float, align=Align)

Draws literal text.

ArgumentTypeRequirementDescription
valueStringRequired, positionalThe text.
x, yFloatRequired keywordsThe anchor: y is the vertical center, and x the left end, center, or right end by align.
sizeFloatOptional keywordThe text height, which must be positive. Default 1.
alignAlignOptional keywordWhich end of the text x anchors. Default Align::Left.
text("VDD", x=1., y=3.);

Text runs horizontally in symbol coordinates. The GUI keeps it upright under every placement of the instance.

inst_name​

inst_name(x=Float, y=Float, size=Float, align=Align)

Draws the instance's name in the parent.

ArgumentTypeRequirementDescription
x, yFloatRequired keywordsThe anchor, as for text.
sizeFloatOptional keywordThe text height. Default 1.
alignAlignOptional keywordDefault Align::Left.
inst_name(x=2., y=2.);

A placeholder, since the instance's name, such as Xinv or Mmp, is known only in the parent.

param​

param(name: String, value: Float | Int | String, x=Float, y=Float, size=Float, align=Align)

Draws a parameter as name=value.

ArgumentTypeRequirementDescription
nameStringRequired, positionalThe label.
valueFloat | Int | StringRequired, positionalThe value, typed as a device parameter is, and formatted as netlists format parameters: w=0.15, c=1e-12.
x, yFloatRequired keywordsThe anchor, as for text.
sizeFloatOptional keywordThe text height. Default 1.
alignAlignOptional keywordDefault Align::Left.
param("w", w, x=2., y=-2.);

pin​

pin(signal: Signal, x=Int, y=Int, label=Bool)

Places the pin of a port, where a parent's wires end.

ArgumentTypeRequirementDescription
signalSignalRequired, positionalAny signal on the port's net, including an instance or device terminal connected to it.
x, yIntRequired keywordsThe pin, on the grid.
labelBoolOptional keywordWhether the port's name is drawn beside the pin. Default false.
pin(vdd, x=0, y=4, label=true);

Pins are checked once the body has run and the ports are known. See pins for the rules and where a label goes.

Align​

enum Align {
Left,
Center,
Right,
}

Which end of a text its x anchors: the left end, the center, or the right end.

Device helpers​

std::symbol also draws the device symbols, as Argon functions over the natives above. Each one draws its shapes, its pins, and inst_name, with its terminals in the order the device kind takes them. A cell that wraps one device can draw itself as that device by calling the helper on its ports.

HelperPins
mos(d, g, s, b), nmos(d, g, s, b)d (0, 2), g (-2, 0), s (0, -2), b (2, 0)
pmos(d, g, s, b)s (0, 2), g (-2, 0), d (0, -2), b (2, 0)
res(p, n), cap(p, n), diode(p, n)p (0, 2), n (0, -2)
bjt(c, b, e), npn(c, b, e)c (0, 2), b (-2, 0), e (0, -2)
pnp(c, b, e)e (0, 2), b (-2, 0), c (0, -2)
bjt4(c, b, e, sub), npn4(c, b, e, sub), pnp4(c, b, e, sub)The pins of the 3-terminal helper, plus sub (2, 0).
cell mos(nfet: Bool, w: Float, nf: Int) {
pub let d = Signal();
pub let g = Signal();
pub let s = Signal();
pub let b = Signal();
device(DeviceKind::Subckt, [d, g, s, b], model, l=0.15, w=w, nf=nf);

if nfet {
std::symbol::nmos(d, g, s, b);
} else {
std::symbol::pmos(d, g, s, b);
};
}

The GUI draws a raw device with the helper for its kind and terminal count, so a wrapper cell and the device it wraps look the same. A Subckt device is drawn as a box with numbered pins.