Salamandra Netlist Manipulation Framework

1.0.1 · active · verified Thu Apr 16

Salamandra is an extensible Pythonic infrastructure for loading, analyzing, generating, and storing netlists. Developed by EnICS labs, it is currently at version 1.0.1 and is under active development. The library supports Python 3.5+ and is released under the Apache 2.0 open-source license.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create basic `Component` objects, add `Pin`s, and then construct a hierarchical component like an inverter with subcomponents and connections.

import salamandra as slm

# Create an NMOS component skeleton
nmos = slm.Component('nmos')
nmos.add_pin(slm.Pin('source'))
nmos.add_pin(slm.Pin('drain'))
nmos.add_pin(slm.Pin('gate'))
nmos.add_pin(slm.Pin('body'))

# Create an inverter component with subcomponents and connections
inv = slm.Component('inv')
# Add pins to the inverter
inv.add_pin(slm.Input('I'))
inv.add_pin(slm.Output('ZN'))
inv.add_pin(slm.Inout('VDD'))
inv.add_pin(slm.Inout('VSS'))

# Add subcomponents (instances of nmos and pmos - pmos would be defined similarly to nmos)
# For this example, let's assume 'pmos' is also a defined slm.Component object
pmos = slm.Component('pmos') # Define a dummy pmos for the example to be runnable
pmos.add_pin(slm.Pin('source'))
pmos.add_pin(slm.Pin('drain'))
pmos.add_pin(slm.Pin('gate'))
pmos.add_pin(slm.Pin('body'))

inv.add_subcomponent(nmos, 'n1')
inv.add_subcomponent(pmos, 'p1')

# Establish connections
inv.connect('I', 'n1.gate')
inv.connect('I', 'p1.gate')
inv.connect('ZN', 'n1.drain')
inv.connect('ZN', 'p1.drain')
inv.connect('VDD', 'p1.source')
inv.connect('VDD', 'p1.body')

print(f"Created component: {inv.name}")
print(f"Pins: {[p.name for p in inv.pins]}")
print(f"Subcomponents: {[s.name for s in inv.subcomponents]}")
# For full netlist export, one would typically call functions like inv.print_verilog()
# print("\nVerilog Netlist (example snippet):")
# inv.print_verilog()

view raw JSON →