Netlist Simulator

class netlist_simulator.NetlistSimulatorPlugin
get_name(self: netlist_simulator.NetlistSimulatorPlugin) → str

Get the name of the plugin.

Returns:The name of the plugin.
Return type:str
get_version(self: netlist_simulator.NetlistSimulatorPlugin) → str

Get the version of the plugin.

Returns:The version of the plugin.
Return type:str
name

The name of the plugin.

Type:str
version

The version of the plugin.

Type:str
class netlist_simulator.NetlistSimulator
generate_vcd(self: netlist_simulator.NetlistSimulator, path: os.PathLike, start_time: int, end_time: int, nets: Set[hal_py.Net] = set()) → bool

Generates the a VCD file for parts the simulated netlist.

Parameters:
  • path (pathlib.Path) – The path to the VCD file.
  • start_time (int) – Start of the timeframe to write to the file (in picoseconds).
  • end_time (int) – End of the timeframe to write to the file (in picoseconds).
  • nets (set[hal_py.Net]) – Nets to include in the VCD file.
Returns:

True if the file gerneration was successful, false otherwise.

Return type:

bool

get_simulation_state(self: netlist_simulator.NetlistSimulator) → hal::Simulation

Get the current simulation state.

Returns:The current simulation state.
Return type:libnetlist_simulator.Simulation
get_simulation_timeout(self: netlist_simulator.NetlistSimulator) → int

Get the current iteration timeout value.

Returns:The iteration timeout.
Return type:int
initialize(self: netlist_simulator.NetlistSimulator) → None

Initialize the simulation. No additional gates or clocks can be added after this point.

initialize_sequential_gates(*args, **kwargs)

Overloaded function.

  1. initialize_sequential_gates(self: netlist_simulator.NetlistSimulator, filter: Callable[[hal_py.Gate], bool] = None) -> None

    Configure the sequential gates matching the (optional) user-defined filter condition with initialization data specified within the netlist. Schedules the respective gates for initialization, the actual configuration is applied during initialization of the simulator. This function can only be called before the simulation has started.

    param lambda filter:
     The optional filter to be applied before initialization.
  2. initialize_sequential_gates(self: netlist_simulator.NetlistSimulator, value: hal_py.BooleanFunction.Value, filter: Callable[[hal_py.Gate], bool] = None) -> None

    Configure the sequential gates matching the (optional) user-defined filter condition with the specified value. Schedules the respective gates for initialization, the actual configuration is applied during initialization of the simulator. This function can only be called before the simulation has started.

    param hal_py.BooleanFunction.Value value:
     The value to initialize the selected gates with.
    param lambda filter:
     The optional filter to be applied before initialization.
load_initial_values(self: netlist_simulator.NetlistSimulator, value: hal_py.BooleanFunction.Value) → None

Load the specified initial value into the current state of all sequential elements.

Parameters:value (hal_py.BooleanFunction.Value) – The initial value to load.
load_initial_values_from_netlist(self: netlist_simulator.NetlistSimulator) → None

Load the initial value specified within the netlist file into the current state of all sequential elements. This is especially relevant for FPGA netlists, since these may provide initial values to load on startup.

reset(self: netlist_simulator.NetlistSimulator) → None

Reset the simulator state, i.e., treat all signals as unknown. Does not remove gates/nets from the simulation set.

set_input(self: netlist_simulator.NetlistSimulator, net: hal_py.Net, value: hal_py.BooleanFunction.Value) → None

Set the signal for a specific wire to control input signals between simulation cycles.

Parameters:
set_iteration_timeout(self: netlist_simulator.NetlistSimulator, iterations: int) → None

Set the iteration timeout, i.e., the maximum number of events processed for a single point in time. Useful to abort in case of infinite loops. A value of 0 disables the timeout.

Parameters:iterations (int) – The iteration timeout.
set_simulation_state(self: netlist_simulator.NetlistSimulator, state: hal::Simulation) → None

Set the simulator state, i.e., net signals, to a given state. Does not influence gates/nets added to the simulation set.

Parameters:state (netlist_simulator.Simulation) – The state to apply.
simulate(self: netlist_simulator.NetlistSimulator, picoseconds: int) → None

Simulate for a specific period, advancing the internal state. Automatically initializes the simulation if ‘initialize’ has not yet been called. Use p set_input to control specific signals.

Parameters:picoseconds (int) – The duration to simulate.
class netlist_simulator.Simulation
add_event(self: netlist_simulator.Simulation, event: hal::WaveEvent) → None

Adds a custom event to the simulation.

Parameters:event (netlist_simulator.Event) – The event to add.
get_events(self: netlist_simulator.Simulation) → Dict[hal_py.Net, List[hal::WaveEvent]]

Get all events of the simulation.

Returns:A map from net to associated events for that net sorted by time.
get_net_value(self: netlist_simulator.Simulation, net: hal_py.Net, time: int) → hal_py.BooleanFunction.Value

Get the signal value of a specific net at a specific point in time specified in picoseconds.

Parameters:
  • net (hal_py.Net) – The net to inspect.
  • time (int) – The time in picoseconds.
Returns:

The net’s signal value.

Return type:

hal_py.BooleanFunction.Value