Skip to main content

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

RuleDefault StateDescription
UNCONNECTED-PINWarningA component pin has no wire or net connected to it
UNCONNECTED-WIREWarningA wire end is not connected to a pin or another wire
NO-CONNECT-ON-CONNECTED-PINErrorA no_connect() symbol is placed on a pin that is also connected to a wire or net

Power Net Rules

RuleDefault StateDescription
POWER-REFERENCE-ON-UNNAMED-NETErrorA power reference symbol is placed on a net with no name
POWER-NET-NAME-CONFLICTErrorTwo or more nets share the same name but are not connected
POWER-REFERENCE-AMBIGUOUS-NETErrorA power reference symbol connects to more than one net, making the target ambiguous
POWER-REFERENCE-UNCONNECTEDErrorA power reference symbol is not connected to any net
POWER-INPUT-UNCONNECTEDErrorA power input pin is not connected to a net
POWER-NET-NO-SOURCEWarningA named power net has no driving source
POWER-NET-UNUSEDWarningA named power net is defined but never used
POWER-NET-MULTIPLE-OUTPUTSWarningMultiple power output pins drive the same net (ignores same-named pins on a single component and unplaced components)
POWER-OUTPUT-UNCONNECTEDWarningA power output pin is not connected to any net
POWER-SYMBOL-UNCONNECTEDWarningA power symbol is placed but not connected to any net
NO-POWER-REFERENCE-IN-SCHEMATICWarningThe schematic contains no power reference symbols at all
POWER-NET-WITHOUT-DRIVERInfoA power net has no driver (legacy rule, deprecated)
POWER-INPUT-ON-UNNAMED-NETInfoA power input pin is on a net with no name
POWER-OUTPUT-ON-UNNAMED-NETInfoA power output pin is on a net with no name

Pin Type Compatibility Rules

RuleDefault StateDescription
PIN-TYPE-OUTPUT-MULTIPLEWarningNet has multiple output pins — possible signal conflict
PIN-TYPE-INPUT-UNDRIVENWarningNet has input pin(s) but no driving output
PIN-TYPE-BIDIRECTIONAL-POWERWarningBidirectional pin on a power net
PIN-TYPE-OUTPUT-POWER-INPUTWarningSignal output pin driving a power net directly — missing power symbol
PIN-TYPE-PASSIVE-ONLYOffNet 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
Component J1: line 6:11133552244J1line 11:4GNDline 14:1line 17:1Component R1: line 19:1R110kline 20:28GND

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")