Electrical Rules Check (ERC)
These rules help ensure that the schematic is correctly designed and minimize potential issues. Each rule has a default state of Error, Warning, Info or Off:
- Error — reported and must be resolved
- Warning — reported but does not block output
- Info — the check runs but results are not shown in CLI output
- Off — the check is completely disabled; no results are produced
Running ERC checks
To perform ERC checks, pass the -e parameter to the Circuitscript CLI tool. ERC errors will be printed out.
Connection Rules
| Rule | Default State | Description |
|---|---|---|
UNCONNECTED-PIN | Warning | A component pin has no wire or net connected to it |
UNCONNECTED-WIRE | Warning | A wire end is not connected to a pin or another wire |
NO-CONNECT-ON-CONNECTED-PIN | Error | A no_connect() symbol is placed on a pin that is also connected to a wire or net |
Power Net Rules
| Rule | Default State | Description |
|---|---|---|
POWER-REFERENCE-ON-UNNAMED-NET | Error | A power reference symbol is placed on a net with no name |
POWER-NET-NAME-CONFLICT | Error | Two or more nets share the same name but are not connected |
POWER-REFERENCE-AMBIGUOUS-NET | Error | A power reference symbol connects to more than one net, making the target ambiguous |
POWER-REFERENCE-UNCONNECTED | Error | A power reference symbol is not connected to any net |
POWER-INPUT-UNCONNECTED | Error | A power input pin is not connected to a net |
POWER-NET-NO-SOURCE | Warning | A named power net has no driving source |
POWER-NET-UNUSED | Warning | A named power net is defined but never used |
POWER-NET-MULTIPLE-OUTPUTS | Warning | Multiple power output pins drive the same net (ignores same-named pins on a single component and unplaced components) |
POWER-OUTPUT-UNCONNECTED | Warning | A power output pin is not connected to any net |
POWER-SYMBOL-UNCONNECTED | Warning | A power symbol is placed but not connected to any net |
NO-POWER-REFERENCE-IN-SCHEMATIC | Warning | The schematic contains no power reference symbols at all |
POWER-NET-WITHOUT-DRIVER | Info | A power net has no driver (legacy rule, deprecated) |
POWER-INPUT-ON-UNNAMED-NET | Info | A power input pin is on a net with no name |
POWER-OUTPUT-ON-UNNAMED-NET | Info | A power output pin is on a net with no name |
Pin Type Compatibility Rules
| Rule | Default State | Description |
|---|---|---|
PIN-TYPE-OUTPUT-MULTIPLE | Warning | Net has multiple output pins — possible signal conflict |
PIN-TYPE-INPUT-UNDRIVEN | Warning | Net has input pin(s) but no driving output |
PIN-TYPE-BIDIRECTIONAL-POWER | Warning | Bidirectional pin on a power net |
PIN-TYPE-OUTPUT-POWER-INPUT | Warning | Signal output pin driving a power net directly — missing power symbol |
PIN-TYPE-PASSIVE-ONLY | Off | Net has only passive pins — no driver or typed receiver |
Example
from "std" import *
vcc = supply("VCC")
gnd = dgnd()
tmp = create component:
pins: 5
at tmp pin 5
wire right 100 down 100
to gnd
at tmp pin 1
add no_connect()
at tmp pin 3
add no_connect()
wire right 100
add res(10k)
wire right 100 down 200 to gnd
at tmp pin 4
wire left 200
The ERC output is:
ERC found 1 error(s), 5 warning(s):
1. [Warning] line 6, column: 0: UNCONNECTED-PIN - Unconnected pin: J1 pin 2
2. [Warning] line 11, column: 3: POWER-NET-UNUSED - Power net '/GND' is declared but has no physical connections
3. [Error] line 17, column: 0: NO-CONNECT-ON-CONNECTED-PIN - No connect on connected pin: J1 pin 3
4. [Warning] line 18, column: 4: POWER-NET-UNUSED - Power net '/VCC' is declared but has no physical connections
5. [Warning] line 23, column: 0: UNCONNECTED-WIRE - Unconnected wire end
6. [Warning] NO-POWER-REFERENCE-IN-SCHEMATIC - No power_reference pin found in schematic — no ground reference defined
Configuring Rule Severity
You can override the default severity for any rule using the erc_set() built-in function. Overrides apply globally to the document.
erc_set(rule_name, severity)
Sets the severity for the given rule.
rule_name— a string matching a valid rule identifier (e.g."UNCONNECTED-PIN")severity— one of"error","warning","info", or"off"
Throws a runtime error if either argument is invalid.
erc_get(rule_name)
Returns the severity override previously set by erc_set() for the given rule, or "unknown" if no override has been set. Throws a runtime error if rule_name is not a valid rule identifier.
Examples for changing severity
Raise a rule from warning to error:
erc_set("UNCONNECTED-PIN", "error")
Suppress a rule entirely:
erc_set("UNCONNECTED-PIN", "off")
Query the current severity:
severity = erc_get("UNCONNECTED-PIN")