Sometimes a design is easier specified by text than drawing. Typical examples:
Non-graphical sheets are implemented in plugins and provide different methods and syntax for specifying abstract components, abstract networks and their relations. The cschem compiler can use this as an input on the same level as a graphical sheet. That means, a non-graphical sheet can be an Nth sheet in a multisheet project. For example draw the power and analog parts on graphical sheets and have the 28 pin parallel bus connections to the CPU, ram, I/O chips and connectors specified in one more more non-graphical sheet in the same project.
Below are different methods and syntax to describe non-graphical sheets.
tEDAx is very easy to parse, well specified, and is relatively easy to read and write as human. Implemented by io_ngrp_tedax.
Here are a few small examples, all describing the same "7805 with 2 bypass caps" circuit using different approaches:
These are not different sets of syntax, but they are all just different usage and combination of the same few blocks that are all available. As a proper declarative description, order of blocks or order of attributes/connections within a block doesn't matter.
The verbose versions are perhaps more practical if there are a lot of attributes to specify. The compact version is more practical for listing a lot of connections and few attributes.
Another way of mixing different blocks is big32.tdx, which is an imaginary CPU board with 2 SRAM chips, an I/O chip and an extension port. It uses the verbose component description for the chips and capacitors, also connects power and gnd there and then uses the compact, table-like description for the address/data/control networks. It's also an example of combining graphical and non-graphical sheets: U5 is a network of gates that controls chip-select; it's better drawn for clarity.
Summary of blocks:
block | description | cschem_acomp name | create a new (abstract) component; name is the name of the component (e.g. "R17"); can add component attributes and create connections from ports of the component to nets | cschem_anet name | create a new (abstract) network; name is the name of the net (e.g. "Vcc"); can add net attributes and create connections from the net to ports of components | cschem_acompact | compact syntax that can describe both components and nets, multiple of them |
---|
Content of a cschem_acomp block: each line is one of these:
Content of a cschem_anet block: each line is one of these:
Content of a cschem_acompact block: each line is one of these:
line | description | comp cname [attrs...] | create a new (abstract) component; cname is the name of the component (e.g. "R17"); followed by zero or more attributes (see below) | net nname [attrs...] | create a new (abstract) network; nname is the name of the net (e.g. "Vcc"); followed by zero or more attributes (see below) | conn nname ports... | creates one or more connections from the network called nname to ports (see below) |
---|
Attrs are specified in key=value syntax, e.g. footprint=1206. If key or value contains whitespace, it needs to be escaped, as per tEDAx syntax, using backslash.
Ports are specified in a comp=port syntax, e.g. U12=4 for port 4 of component U12. If component or port name contains whitespace, it needs to be escaped, as per tEDAx syntax, using backslash.
In some cases parts of the design can be specified using repetitive patterns. An easy way to handle this is to write a script that generates a graphical sheet or a non-graphical sheet using a declarative syntax.
If that script is written in fawk, sch-rnd can run it without having to generate and parse the declarative intermediate. Implemented by io_ngrp_fawk. This feature is limited to fawk because:
A simple example script, r2r.fawk generates 5 bits of the classic R2R DAC. It can be configured by changing the values in main().
The script doesn't emit a netlist or declarative tEDAx non-graphical sheet. The result can be observed in sch-rnd by loading only the fawk script as a sheet and using the abstract model dialog.
(An alternative is implementing the cschem functions locally, as vararg fawk functions and make them print to stdout using fawk_print(). Then the script can be ran and debugged independently of cschem, using the example libfawk command line interpreter.)
Functions provided by sch-rnd:
function | description |
---|---|
acomp_attr(name, key, val, ...); | create a component by name, or add to existing component by that name; add key=val pairs of attributes; this is a vararg function, accepting zero or more key,val pairs. |
anet_attr(name, key, val, ...); | create a network by name, or add to existing network by that name; add key=val pairs of attributes; this is a vararg function, accepting zero or more key,val pairs. |
aconn(netname, compname, termname, ...); | create a network by netname, or extend existing network by that name; connect terminal(s) addressed by (compname-termname); this is a vararg function, accepting one or more compname,termname pairs. |