Appearance
Spec: Netlist Export
Overview
Enable exporting circuit connectivity as a structured netlist in industry-standard formats (SPICE, EDIF, custom JSON) for interoperability with external simulation, synthesis, and analysis tools.
Motivation
Netlists are the universal exchange format for circuit descriptions. Exporting netlists allows:
- Simulating in SPICE for analog/mixed-signal analysis.
- Importing into PCB layout tools.
- Feeding into synthesis/optimization tools.
- Machine-readable circuit representation for custom analysis scripts.
Requirements
Functional Requirements
- SPICE Netlist: Generate SPICE-compatible netlist (subcircuits for macros).
- EDIF Export: IEEE EDIF 2.0.0 format for EDA tool interoperability.
- JSON Netlist: Custom JSON format for programmatic access and custom tools.
- Hierarchical Support: Macros export as subcircuit/cell definitions.
- Net Naming: Use annotation labels when available; auto-generate otherwise.
- Component Mapping: Map each component to its netlist equivalent (device model).
- Pin Mapping: Correct pin ordering per component type's standard pinout.
- Power/Ground Nets: VCC and GND components create named power nets.
- Bus Expansion: Multi-bit buses expand to individual nets (bus[0], bus[1], ...).
- Export Validation: Pre-export check for floating nets, missing connections.
- Custom Model Library: Users can define custom SPICE models for components.
Non-Functional Requirements
- Generated SPICE netlists parse without errors in LTspice, ngspice, and HSPICE.
- EDIF output is valid per the EDIF 2.0.0 specification.
- JSON netlist is well-documented with a JSON Schema.
- Export handles circuits up to 10000 components.
Design
Netlist Data Model
csharp
public class Netlist
{
public string Name { get; set; }
public List<NetlistComponent> Components { get; set; }
public List<Net> Nets { get; set; }
public List<Port> Ports { get; set; } // top-level I/O
public List<Netlist> SubCircuits { get; set; } // macro definitions
}
public class NetlistComponent
{
public string InstanceName { get; set; }
public string ModelName { get; set; }
public Dictionary<string, string> PinToNetMap { get; set; }
public Dictionary<string, string> Properties { get; set; }
}
public class Net
{
public string Name { get; set; }
public List<PinReference> ConnectedPins { get; set; }
}SPICE Output Example
spice
* DigitalWorks Netlist Export
* Circuit: half_adder.dwm
.subckt HALF_ADDER A B SUM CARRY
X1 A B net1 XOR_GATE
X2 A B CARRY AND_GATE
.ends
.subckt XOR_GATE IN1 IN2 OUT
* Internal XOR implementation
.endsJSON Output Example
json
{
"name": "half_adder",
"ports": [
{ "name": "A", "direction": "input" },
{ "name": "B", "direction": "input" },
{ "name": "SUM", "direction": "output" },
{ "name": "CARRY", "direction": "output" }
],
"components": [
{ "instance": "U1", "model": "XOR2", "pins": { "A": "A", "B": "B", "Y": "SUM" } },
{ "instance": "U2", "model": "AND2", "pins": { "A": "A", "B": "B", "Y": "CARRY" } }
],
"nets": [
{ "name": "A", "pins": ["port:A", "U1:A", "U2:A"] },
{ "name": "B", "pins": ["port:B", "U1:B", "U2:B"] }
]
}Export Pipeline
Circuit Model
→ Net Extraction (trace connectivity, assign net names)
→ Hierarchy Extraction (identify macro boundaries)
→ Component Mapping (DigitalWorks type → netlist model)
→ Format-Specific Writer (SPICE / EDIF / JSON)
→ Validation
→ File OutputImplementation Tasks
- Create
DigitalWorks.Core/Export/Netlist/namespace. - Implement net extraction algorithm (trace all connected pins).
- Implement net naming strategy (annotations → auto-names).
- Implement component-to-model mapping table.
- Implement SPICE netlist writer.
- Implement EDIF netlist writer.
- Implement JSON netlist writer with schema.
- Handle macro hierarchy (subcircuit/cell definitions).
- Add export validation (floating nets, missing connections).
- Create export dialog UI with format selection.
- Add menu item (File → Export → Netlist).
Risks & Open Questions
- How to handle components without SPICE equivalents (LEDs, 7-segment displays)?
- Should the SPICE export include a simulation directive (.tran, .dc)?
- EDIF complexity: is full EDIF 2.0.0 needed or is a subset sufficient?
- Should there be a netlist import counterpart (covered in separate spec)?
Priority
Medium — Enables professional EDA tool interoperability.