boxsym-rnd(5)
π boxsym-rnd π β the boxsym description syntax, explained by your fav Unix bestie
okay so bestie, welcome to boxsym-rnd(5), a page from the sch-rnd manual. this is THE doc for how you write a boxsym file, and honestly? it's giving "weirdly chill file format". let's get into it π
β¨ NAME β¨
boxsym-rnd β the syntax for a boxsym description. yep, that's the whole vibe of this page π¦
πΈ DESCRIPTION πΈ
A boxsym file is where you spell out the symbol attributes and the pins (aka terminals) for either:
- one single box symbol, or
- a whole set of inhomogenousely slotted box symbols (say that five times fast, I dare you π)
Now, when slotted symbols get generated, here's what actually comes out:
- one symbol file per slot, and it contains only the pins defined for that specific slot (the file name gets suffixed with the slot name), and
- a monolith symbol (which uses the original file name) with all the pins thrown into one large box.
π§ Syntax π§
The boxsym syntax is a plain text, line based, hierarchical file format, with a syntax similar to tEDAx. Iconic lineage tbh.
- Leading whitespace in lines is ignored β she does not care about your indentation, do it for you.
- Empty lines are ignored. So are lines starting with a hashmark (
#). - The first word of a line is a command.
If the command is begin, then everything after it β up until the matching end line β gets read as a nested level of hierarchy. And yes, the syntax allows "begin in begin", meaning nesting to any depth. Go off. The second word of begin and end is the type of the nested subtree.
Commands issued outside of any begin-end blocks are said to be made in global scope. β¨
π Refdes π
There can be only one refdes line, and it lives in global scope. The argument is a single word: the refdes attribute.
If no refdes is specified? No stress β the default refdes is used. π«Ά
π Attributes π
Attributes are symbol attributes. Here's the tea on scope:
- Attributes specified in the global scope will be present in every symbol generated from the file.
- Attributes specified for a slot will be present in that slot's symbol and in the monolith symbol.
An attribute is defined in the following form:
attr key value
Key is a single word. value is anything up to the end of the line. This definition creates the attribute and places a dyntext+floater text object that prints the value of the attribute.
- If the command is
attr_both, the text object is created to printkey=value. - If the command is
attr_invis, the attribute is still created, but no text object is made. Sneaky. Invisible. Lowkey iconic.
π Other global settings π
A line starting with text_size_mult followed by a decimal number (greater than zero, bestie, don't test her) changes the text pixel length allocation factor.
Increasing the values will allocate more pixels to each text in length. Note: text height is not affected. Length only. Periodt.
π¦ Defining pins π¦
Pins are defined using a pin subtree: begin pin pinname, then lines defining pin properties, then end pin.
Pinname should be the textual, human readable name of the pin (it's also used as an input for the optional devmap) β not the physical pin number, okurrr?
For example:
begin pin Vcc
num 14
loc top
end pin
begin pin B
num 2:5:10:13
loc left
dir in
invcirc
funcmap
end pin
Within the pin block, the num line specifies the physical footprint pin number. For a pin participating in a slot, this should be a colon separated list of pin number per slot.
The mandatory loc line specifies the location of the pin β the side of the box on which it should be placed β one of: left, right, top or bottom. (Mandatory!! do not forget her π)
- If a
dirline is present, extra "pin direction" graphics is drawn for the pin inside of the box. Values areinorout. - If
invcircis present, the pin will have a small circle near the box to indicate the pin is inverted. Cute lil bubble π«§. - If
labelis present, its value (anything written afterlabel) is printed within the box next to the pin, instead of the pin name. - If
funcmapis present, the label is replaced with adyntextthat prints the abstract attributefuncmap/name. This is useful for symbols that are going to use a funcmap (alternate pin function mapping). The funcmap file is normally also referenced from the component, setting thefuncmapattribute to the funcmap file name.
πΈ Arranging pins πΈ
By default, pins are listed per side (loc), tightly packed, in order of appearance in the file, from the start of the side. Bestie behaviour: organized, no gaps.
You can change that using pinalign lines in global or slot scope. For example:
pinalign left center
will arrange left side pins on the center (vertically). Slay. β¨
π Defining a single box symbol π
The simplest form of box symbols emits a single file that has a single large box with all the pins. The boxsym definition for such symbols contains the constructs described above, and no begin slot subtrees. Simple. Elegant. No drama.
π Defining inhomogenous slot symbol π
In a multi-box, inhomogenous slot symbol, there are different symbols representing different sections of the component.
The typical example is an MCU which is split up into a couple of boxes: a few boxes per port groups, and another few per peripheral types. Each box represents a slot that appears only once in the MCU.
Another typical example is logic ICs, e.g. 7400 implemented in two different slot symbols:
- one for power (
Vccandgnd), which presents once in the component, and - one for a 3 pin gate β the same box used 4 times for 4 different slots.
An inhomogenous slot symbol does not have any pin in global scope, but defines one or more begin slot slotname subtrees for all the different types of slots.
And here's the key thing: if the same slot appears multiple times in the component, it needs to be defined only once β and you assign multiple pin numbers in the pin definitions. Efficiency queen π.
π₯ EXAMPLE π₯
π Single box LDO π
refdes U??
attr_invis sym-source sch-rnd default symbol lib
attr_invis sym-copyright (C) 2022 Tibor 'Igor2' Palinkas
attr_invis sym-license-dist GPLv2+
attr_invis sym-license-use Public Domain
pinalign bottom center
pinalign left center
pinalign right center
shape box
shape_fill yes
begin pin in
num 1
loc left
end pin
begin pin gnd
num 2
loc bottom
end pin
begin pin out
num 3
loc right
end pin
π§ Inhomogenous slot 7400 π§
refdes U??
pinalign right center
pinalign bottom center
pinalign top center
attr device 7400
begin slot power
shape box
shape_fill yes
begin pin Vcc
num 14
loc top
end pin
begin pin gnd
num 7
loc bottom
end pin
pinalign top center
pinalign bottom center
end slot
begin slot logic
attr device 7400
attr_both slot 1
begin pin A
num 1:4:9:12
loc left
dir in
end pin
begin pin B
num 2:5:10:13
loc left
dir in
end pin
begin pin Z
num 3:6:8:11
loc right
dir out
invcirc
end pin
pinalign left center
pinalign right center
end slot
β SEE ALSO β
boxsym-rnd(1)β go read her too, she's right there π«Ά
okay that's the whole page bestie, you're officially a boxsym girlie now π anyway this lil drop was brought to you by the sch-rnd manual, dated 2022-03-28 β so if you're reading this from the future, hi, you're cute, and the syntax is still right there waiting for you. no cap. bye!! πππ¦
π¦ where this page comes from
- debian trixie: sch-rnd-core 1.0.8-3 Β· GPL-2.0-or-later
- ubuntu noble: sch-rnd-core 1.0.5-2 Β· GPL-2.0-or-later
- ubuntu questing: sch-rnd-core 1.0.9-1build1
- ubuntu resolute: sch-rnd-core 1.0.10-1 Β· GPL-2.0-or-later
- ubuntu stonking: sch-rnd-core 1.0.11-2 Β· GPL-2.0-or-later
- Copyright (C) 2022 Tibor 'Igor2' Palinkas\\n
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms