Dario Quintero
09/05/2023, 4:28 PMDario Quintero
09/05/2023, 4:29 PMKennedy Caisley
09/05/2023, 4:43 PMKennedy Caisley
09/05/2023, 4:44 PM# Create instances.
in0 = tnmos.generate(name="MN0", params={"nf": nf_b, "tie": "S"})
ip0 = tpmos.generate(name="MP0", transform="MX", params={"nf": nf_b, "tie": "S"})
in1 = tnmos.generate(name="MN1", params={"nf": nf_a, "trackswap": True})
ip1 = tpmos.generate(name="MP1", transform="MX", params={"nf": nf_a, "tie": "S"})
# Place instances, array-based placement
dsn.place(grid=pg, inst=[[in0, in1], [ip0, ip1]], mn=[0, 0])
# Create and place wires.
_mn = [<http://r23.mn|r23.mn>(in1.pins["G"])[0], <http://r23.mn|r23.mn>(ip1.pins["G"])[0]] # A
va0, ra0, va1 = dsn.route(grid=r23, mn=_mn, via_tag=[True, True])
_mn = [<http://r23.mn|r23.mn>(in0.pins["G"])[0], <http://r23.mn|r23.mn>(ip0.pins["G"])[0]] # B
vb0, rb0, vb1 = dsn.route(grid=r23, mn=_mn, via_tag=[True, True])
_mn = [<http://r12.mn|r12.mn>(in0.pins["D"])[1], <http://r12.mn|r12.mn>(in1.pins["S"])[0]] # internal
dsn.route(grid=r23, mn=_mn)
_mn = [<http://r12.mn|r12.mn>(ip0.pins["D"])[1], <http://r12.mn|r12.mn>(ip1.pins["D"])[0]] # output
dsn.route(grid=r23, mn=_mn)
_mn = [<http://r23.mn|r23.mn>(in1.pins["D"])[1], <http://r23.mn|r23.mn>(ip1.pins["D"])[1]]
_, rout0, _ = dsn.route(grid=r23, mn=_mn, via_tag=[True, True])
# Create pins.
pB = dsn.pin(name="B", grid=r23, mn=<http://r23.mn|r23.mn>(rb0))
pA = dsn.pin(name="A", grid=r23, mn=<http://r23.mn|r23.mn>(ra0))
pout0 = dsn.pin(name="O", grid=r23, mn=<http://r23.mn|r23.mn>(rout0))
_mn = [<http://r12.mn|r12.mn>(in0.pins["RAIL"])[0], <http://r12.mn|r12.mn>(in1.pins["RAIL"])[1]]
pvss0 = dsn.pin(name="VSS", grid=r12, mn=_mn)
_mn = [<http://r12.mn|r12.mn>(ip0.pins["RAIL"])[0], <http://r12.mn|r12.mn>(ip1.pins["RAIL"])[1]]
pvdd0 = dsn.pin(name="VDD", grid=r12, mn=_mn)
Dario Quintero
09/05/2023, 4:47 PMKennedy Caisley
09/05/2023, 4:50 PMKennedy Caisley
09/05/2023, 4:52 PMDario Quintero
09/05/2023, 4:52 PMDario Quintero
09/05/2023, 4:52 PMDario Quintero
09/05/2023, 4:52 PMDario Quintero
09/05/2023, 4:53 PMKennedy Caisley
09/05/2023, 4:53 PM#Create Instances
section could be pulled entirely from a netlistDario Quintero
09/05/2023, 4:53 PMDario Quintero
09/05/2023, 4:53 PMDario Quintero
09/05/2023, 4:53 PMKennedy Caisley
09/05/2023, 4:53 PMCreate wires
and create pins
could also be inferred from the netlist.Dario Quintero
09/05/2023, 4:54 PMKennedy Caisley
09/05/2023, 4:55 PMKennedy Caisley
09/05/2023, 4:55 PMKennedy Caisley
09/05/2023, 4:56 PMDario Quintero
09/05/2023, 4:57 PMDario Quintero
09/05/2023, 5:29 PMKennedy Caisley
09/07/2023, 7:52 PMsim.save()
attribute when running a batch mode simulation, to save a certain node in the circuit? This is the definition of the valid target parameters for it in the Hdl21 source:
# Union of "save-able" types
SaveTarget = Union[
SaveMode, # A `SaveMode`, e.g. `SaveMode.ALL`, `SaveMode.SELECTED`, or `SaveMode.NONE`.
Signal, # A single `Signal`
List[Signal], # A list of `Signal`s
str, # A signal signale-name
List[str], # A list of signal-names
]
I thought I could then just plug in a h.Signal
defined earlier, like below. (The line with sim.save(tb.VDS)
)
# Create a test bench module
tb = h.sim.tb()
# Create signals in testbench module
tb.VDS = h.Signal()
tb.VGS = h.Signal()
tb.VBS = h.Signal()
# Create testbench devices in testbench module
tb.dut = nch(MosParams(w=0.5, l=0.15, nf=1))(D=tb.VDS, G=tb.VGS, S=tb.VSS, B=tb.VBS)
tb.VDS_src = Vdc(Vdc.Params(dc=str(vds)))(p=tb.VDS, n=tb.VSS)
tb.VGS_src = Vdc(Vdc.Params(dc=str(vgs)))(p=tb.VGS, n=tb.VSS)
tb.VBS_src = Vdc(Vdc.Params(dc=str(vbs)))(p=tb.VBS, n=tb.VSS)
# Create simulation object, wrapped around testbench module
sim = h.sim.Sim(tb=tb)
sim.lib(f"/tools/kits/SKY/sky130A/libs.tech/ngspice/sky130.lib.spice", 'tt')
sim.op()
sim.save(tb.VDS) # <--- How to probe the tb.VDS signal?
sim.save(SaveMode.SELECTED)
# Setup sim options
sim_options = SimOptions(
rundir=Path("./scratch"),
fmt=ResultFormat.SIM_DATA,
simulator=SupportedSimulators.XYCE,
)
# Run simulation
sim_results = sim.run(sim_options)
But this isn't working: NotImplementedError: Unimplemented control card signal: "VDS" for <vlsirtools.netlist.spice.XyceNetlister object at 0x7fe4cd1ffb10>
Any ideas?Kennedy Caisley
09/07/2023, 7:59 PMsim_results
return value from starting sim.run()
, but I was hoping to learn how to use the sim.save(...)
approach so that I can produce netlists directly with corresponding .SAVE
control statements in them. Here's a snippet from the ngspice
docs about the statements:Kennedy Caisley
09/07/2023, 8:00 PMThomas Pluck
09/07/2023, 11:02 PMhdl21/sim/data.py
makes for the best documentation, line 292 has the Save
simattr
definition which will take any SaveTarget
object which can be lists of Signal name strings or just the Signals themselves (presumably accessed as attributes of the Sim Tb Module
?).Thomas Pluck
09/07/2023, 11:05 PMDario Quintero
09/22/2023, 11:00 AMKennedy Caisley
09/22/2023, 1:32 PMDario Quintero
09/22/2023, 2:49 PMlibstdc++.so.6
c compilation files missing issues and some tkinter import issues too. Has been a bit weird as its only a few machines that have it. We've been trying to sort it out, but currently setting it up in an apptainer server to host the nix setup and then for sure it should be reproducible even in centos or ubuntu