Netlist Simulator Controller¶
-
class
netlist_simulator_controller.
NetlistSimulatorControllerPlugin
¶ -
create_simulator_controller
(self: netlist_simulator_controller.NetlistSimulatorControllerPlugin, name: str = '', workdir: str = '') → hal::NetlistSimulatorController¶ Create a netlist simulation controller instance.
Parameters: Returns: The simulator controller instance.
Return type:
-
get_name
(self: netlist_simulator_controller.NetlistSimulatorControllerPlugin) → str¶ Get the name of the plugin.
Returns: The name of the plugin. Return type: str
-
get_version
(self: netlist_simulator_controller.NetlistSimulatorControllerPlugin) → str¶ Get the version of the plugin.
Returns: The version of the plugin. Return type: str
-
restore_simulator_controller
(self: netlist_simulator_controller.NetlistSimulatorControllerPlugin, netlist: hal_py.Netlist, filename: str) → hal::NetlistSimulatorController¶ Restore controller with waveform data from previous simulation.
Parameters: - netlist (hal_py.Netlist) – The netlist the simulation was performed with.
- filename (str) – Full path and filename of ‘netlist_simulator_controller.json’.
Returns: The simulator controller instance.
Return type:
-
simulator_controller_by_id
(self: netlist_simulator_controller.NetlistSimulatorControllerPlugin, id: int) → hal::NetlistSimulatorController¶ Share netlist simulator controller instance addressed by id.
Parameters: id (int) – The controller-ID. Return type: netlist_simulator_controller.NetlistSimulatorController
-
-
class
netlist_simulator_controller.
NetlistSimulatorController
¶ The controller instance owns all relevant simulation data like engine, input, resulting waveform and provides the API.
-
add_boolean_accept_list_waveform
(self: netlist_simulator_controller.NetlistSimulatorController, input_waves: List[hal::WaveData], accepted_combination: List[int]) → int¶ Add boolean waveform based on list of accepted combinations.
Parameters: - input_waves (list[netlist_simulator_controller.WaveData]) – List of input waveforms.
- accept_combination (list[int]) – List of accepted combinations. Each combination is coded as binary integer value which is matched bitwise with value of input waveform.
Returns: ID of new boolean waveform.
Return type:
-
add_boolean_expression_waveform
(self: netlist_simulator_controller.NetlistSimulatorController, expression: str) → int¶ Add waveform based on boolean expression.
Parameters: expression (str) – The boolean expression based on names of existing waveforms. Returns: ID of new boolean waveform. Return type: int
-
add_clock_frequency
(self: netlist_simulator_controller.NetlistSimulatorController, clock_net: hal_py.Net, frequency: int, start_at_zero: bool = True) → None¶ Specify a net that carries the clock signal and set the clock frequency in hertz.
Parameters: - clock_net (hal_py.Net) – The net that carries the clock signal.
- frequency (int) – The clock frequency in hertz.
- start_at_zero (bool) – Initial clock state is 0 if true, 1 otherwise.
-
add_clock_period
(self: netlist_simulator_controller.NetlistSimulatorController, clock_net: hal_py.Net, period: int, start_at_zero: bool = True, duration: int = 0) → None¶ Specify a net that carries the clock signal and set the clock period in picoseconds.
Parameters: - clock_net (hal_py.Net) – The net that carries the clock signal.
- period (int) – The clock period from rising edge to rising edge in picoseconds.
- start_at_zero (bool) – Initial clock state is 0 if true, 1 otherwise.
- duration (int) – Optional max time limit when showing clock in VCD viewer or editor
-
add_gates
(self: netlist_simulator_controller.NetlistSimulatorController, gates: List[hal_py.Gate]) → None¶ Add gates to the simulation set. Only elements in the simulation set are considered during simulation.
Parameters: gates (list[hal_py.Gate]) – The gates to add.
-
add_trigger_time
(self: netlist_simulator_controller.NetlistSimulatorController, trigger_waves: List[hal::WaveData], trigger_on_values: List[int]) → int¶ Add trigger time vector based on wave transitions.
Parameters: - trigger_waves (list[netlist_simulator_controller.WaveData]) – The list of source waveform to generate trigger time.
- trigger_on_values (list[int]) – Optional list of values. Order of values must match order of waveform. Trigger will only be generated upon transition to value.
Returns: ID of new trigger time.
Return type:
-
add_waveform_group
(*args, **kwargs)¶ Overloaded function.
add_waveform_group(self: netlist_simulator_controller.NetlistSimulatorController, name: str, nets: List[hal_py.Net]) -> int
Add waveform group. Netlist must not be empty. First net in list is considered the lowest significant bit.
param str name: The waveform group name. param List[hal_py.Net] nets: List of nets for the group. return: ID of the new waveform group. rtype: int add_waveform_group(self: netlist_simulator_controller.NetlistSimulatorController, pin_group: hal_py.ModulePinGroup) -> int
Create a waveform group from the nets of a given module pin group.
param hal_py.ModulePinGroup pin_group: The pin_group to create waveform group from. return: ID of the new waveform group. rtype: int add_waveform_group(self: netlist_simulator_controller.NetlistSimulatorController, name: str, pin_group: hal_py.ModulePinGroup) -> int
Create a waveform group from the nets of a given module pin group.
param str name: The name of the newly created waveform group. param hal_py.ModulePinGroup pin_group: The pin_group to create waveform group from. return: ID of the new waveform group. rtype: int
-
create_simulation_engine
(self: netlist_simulator_controller.NetlistSimulatorController, name: str) → hal::SimulationEngine¶ Select and set the engine for simulation. The list of available engines is provided by function get_engine_names().
Parameters: name (str) – The name of the engine to be selected. Returns: The engine created by factory method Return type: netlist_simulator_controller.SimulationEngine or None
-
generate_vcd
(self: netlist_simulator_controller.NetlistSimulatorController, path: os.PathLike, start_time: int = 0, end_time: int = 0, nets: Set[hal_py.Net] = set()) → bool¶ Generates the a VCD file for parts the simulated netlist.
Parameters: - path (hal_py.hal_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:
-
get_engine_names
(self: netlist_simulator_controller.NetlistSimulatorController) → List[str]¶ Get a list of registered simulation engines.
Returns: A list of registered sim. Return type: list[str]
-
get_gates
(self: netlist_simulator_controller.NetlistSimulatorController) → Set[hal_py.Gate]¶ Get all gates that are in the simulation set.
Returns: The name. Return type: set[hal_py.Gate]
-
get_id
(self: netlist_simulator_controller.NetlistSimulatorController) → int¶ Get unique controller id.
Returns: The unique id of the controller. Return type: int
-
get_input_nets
(self: netlist_simulator_controller.NetlistSimulatorController) → Set[hal_py.Net]¶ Get all nets that are considered inputs, i.e., not driven by a gate in the simulation set or global inputs.
Returns: The input nets. Return type: list[hal_py.Net]
-
get_max_simulated_time
(self: netlist_simulator_controller.NetlistSimulatorController) → int¶ Get the last time covered by simulation. This is the last transition found in waveforms. :returns: Maximum of simulated time.
-
get_name
(self: netlist_simulator_controller.NetlistSimulatorController) → str¶ Get controller name.
Returns: The name of the controller. Return type: str
-
get_output_nets
(self: netlist_simulator_controller.NetlistSimulatorController) → List[hal_py.Net]¶ Get all output nets of gates in the simulation set that have a destination outside of the set or that are global outputs.
Returns: The output nets. Return type: list[hal_py.Net]
-
get_partial_netlist_nets
(self: netlist_simulator_controller.NetlistSimulatorController) → List[hal_py.Net]¶ Get all nets for partial netlist.
Returns: The nets for partial netlist. Return type: list[hal_py.Net]
-
get_results
(self: netlist_simulator_controller.NetlistSimulatorController) → bool¶ Get simulated data from engine, either from shared memory or from VCD file
Returns: True on success, False otherwise Return type: bool
-
get_trigger_time_by_id
(self: netlist_simulator_controller.NetlistSimulatorController, id: int) → hal::WaveDataTrigger¶ Getter for trigger time.
Parameters: id (int) – Trigger time id. Returns: The trigger time object which derives from WaveData. Return type: hal_py.WaveDataTrigger
-
get_waveform_boolean_by_id
(self: netlist_simulator_controller.NetlistSimulatorController, id: int) → hal::WaveDataBoolean¶ Getter for boolean waveform.
Parameters: id (int) – Boolean waveform id. Returns: The boolean waveform object. Return type: hal_py.WaveDataBoolean
-
get_waveform_by_net
(self: netlist_simulator_controller.NetlistSimulatorController, net: hal_py.Net) → hal::WaveData¶ Getter for a single waveform.
Parameters: net (hal_py.Net) – The net waveform is associated with. Returns: The waveform object. Return type: netlist_simulator_controller.WaveData
-
get_waveform_group_by_id
(self: netlist_simulator_controller.NetlistSimulatorController, id: int) → hal::WaveDataGroup¶ Getter for waveform group.
Parameters: id (int) – Waveform group id. Returns: The waveform group object. Return type: hal_py.WaveDataGroup
-
get_working_directory
(self: netlist_simulator_controller.NetlistSimulatorController) → str¶ Get the working directory.
Returns: The working directory of the controller. Return type: str
-
import_csv
(self: netlist_simulator_controller.NetlistSimulatorController, filename: str, filter: netlist_simulator_controller.FilterInputFlag, timescale: int = 1000000000) → None¶ Parse CVS data as simulation input.
Parameters:
-
import_saleae
(self: netlist_simulator_controller.NetlistSimulatorController, dirname: str, lookupTable: Dict[hal_py.Net, int], timescale: int = 1000000000) → None¶ Import nets given by lookup table from SALEAE directory.
Parameters: - dirname (str) – directory to import files from.
- lookupTable (dict[hal_py.Net,int]) – mapping nets to be imported with saleae file index.
- timescale (int) – multiplication factor for time value if SALEAE data in float format.
-
import_simulation
(self: netlist_simulator_controller.NetlistSimulatorController, dirname: str, filter: netlist_simulator_controller.FilterInputFlag, timescale: int = 1000000000) → None¶ Imports nets from simulation working directory. Existing saleae directory required to nets with binary data.
Parameters:
-
import_vcd
(self: netlist_simulator_controller.NetlistSimulatorController, filename: str, filter: netlist_simulator_controller.FilterInputFlag) → bool¶ Import VCD file and convert content into SALEAE format.
Parameters: - filename (str) – filename of VCD file to be parsed.
- filter (hal_py.FilterInputFlag) – filter to select waveform data from file.
-
initialize
(self: netlist_simulator_controller.NetlistSimulatorController) → None¶ Initialize the simulation. No additional gates or clocks can be added after this point.
-
remove_waveform_group
(self: netlist_simulator_controller.NetlistSimulatorController, group_id: int) → None¶ Remove waveform group identified by group ID. Waveform for nets will still be shown but they are not bundled.
Parameters: group_id (int) – The ID of waveform group to be removed.
-
rename_waveform
(self: netlist_simulator_controller.NetlistSimulatorController, wave: hal::WaveData, name: str) → None¶ Rename waveform and emit ‘renamed’ signal.
Parameters: - wave (netlist_simulator_controller.WaveData) – Waveform to be renamed.
- name (str) – New name for waveform.
-
reset
(self: netlist_simulator_controller.NetlistSimulatorController) → None¶ Reset the simulator state, i.e., treat all signals as unknown. Does not remove gates/nets from the simulation set.
-
run_simulation
(self: netlist_simulator_controller.NetlistSimulatorController) → bool¶ Run the simulation.
Returns: True if all simulation steps could be processed successfully, False otherwise Return type: bool
-
set_input
(*args, **kwargs)¶ Overloaded function.
set_input(self: netlist_simulator_controller.NetlistSimulatorController, net: hal_py.Net, value: hal_py.BooleanFunction.Value) -> None
Set the signal for a specific wire to control input signals between simulation cycles.
param hal_py.Net net: The net to set a signal value for. param hal_py.BooleanFunction.Value value: The value to set. set_input(self: netlist_simulator_controller.NetlistSimulatorController, wd: hal::WaveData, value: hal_py.BooleanFunction.Value) -> None
Set the signal for a specific wire to control input signals between simulation cycles.
param hal_py.WaveData wd: WaveData object of the signal. param hal_py.BooleanFunction.Value value: The value to set. set_input(self: netlist_simulator_controller.NetlistSimulatorController, nets: List[hal_py.Net], values: List[hal_py.BooleanFunction.Value]) -> None
Set the signal for a group of nets to control input signals between simulation cycles.
param List[hal_py.Net] nets: The vector of nets. param List[hal_py.BooleanFunction.Value] values: The values to set. set_input(self: netlist_simulator_controller.NetlistSimulatorController, wdg: hal::WaveDataGroup, values: List[hal_py.BooleanFunction.Value]) -> None
Set the signal for a specific WaveDataGroup to control input signals between simulation cycles.
param hal_py.WaveDataGroup wdg: The WaveDataGroup. param List[hal_py.BooleanFunction.Value] values: The values to set. set_input(self: netlist_simulator_controller.NetlistSimulatorController, id: int, values: List[hal_py.BooleanFunction.Value]) -> None
Set the signal for a specific WaveDataGroup to control input signals between simulation cycles.
param int id: ID of the WaveDataGroup. param List[hal_py.BooleanFunction.Value] values: The values to set. set_input(self: netlist_simulator_controller.NetlistSimulatorController, pin_group: hal_py.ModulePinGroup, values: List[hal_py.BooleanFunction.Value]) -> None
Set the signals for a specific module pin group to control input signals between simulation cycles.
param hal_py.PinGroup[hal_py.ModulePin] pin_group: The module pin group. param List[hal_py.BooleanFunction.Value] values: The values to set.
-
set_no_clock_used
(self: netlist_simulator_controller.NetlistSimulatorController) → None¶ Prepare simulation where no net is defined as clock input.
-
set_saleae_timescale
(self: netlist_simulator_controller.NetlistSimulatorController, timescale: int = 1000000000) → None¶ Set timescale when parsing SALEAE float values.
Parameters:
-
set_timeframe
(self: netlist_simulator_controller.NetlistSimulatorController, tmin: int = 0, tmax: int = 0) → None¶ Set timeframe for viewer.
Parameters:
-
simulate
(self: netlist_simulator_controller.NetlistSimulatorController, 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_controller.
WaveEvent
¶ -
affected_net
¶ The net affected by the event.
Type: hal_py.Net
-
new_value
¶ The new value caused by the event.
Type: hal_py.BooleanFunction.Value
-
-
class
netlist_simulator_controller.
SimulationEngine
¶ The engine which does the active part of the simulation as seperate process or thread.
-
get_state
(self: netlist_simulator_controller.SimulationEngine) → int¶ Get the state of the engine.
Returns: The state of the engine (Preparing=2, Running=1, Done=0, Failed=-1) Type: int
-
get_working_directory
(self: netlist_simulator_controller.SimulationEngine) → str¶ Get the working directory.
Returns: The working directory of the engine. Return type: str
-
name
(self: netlist_simulator_controller.SimulationEngine) → str¶ Get the name of the engine.
Returns: The name of the engine. Return type: str
-
set_engine_property
(self: netlist_simulator_controller.SimulationEngine, key: str, value: str) → None¶ Set property value for engines internal use. :param str key: The property name. :param str value: The property value.
-
-
class
netlist_simulator_controller.
WaveData
¶ Waveform data.
-
get_events
(self: netlist_simulator_controller.WaveData, t0: int = 0) → List[Tuple[int, int]]¶ Get up to maximum loadable waveform events.
Parameters: t0 (int) – Optional start time, only events t>=t0 will be returned. Returns: Waveform events. Return type: list[tuple(int,int)]
-
get_id
(self: netlist_simulator_controller.WaveData) → int¶ Get the ID of waveform net.
Returns: The ID of the waveform. Return type: int
-
get_name
(self: netlist_simulator_controller.WaveData) → str¶ Get the name of waveform net.
Returns: The name of the waveform. Return type: str
-
get_triggered_events
(self: netlist_simulator_controller.WaveData, trigger: hal::WaveDataTrigger, t0: int = 0) → List[Tuple[int, int]]¶ Get waveform events for trigger time set.
Parameters: - trigger (hal_py.WaveDataTrigger) – Trigger time set.
- t0 (int) – Optional start time, only events t>=t0 will be returned.
Returns: Waveform events.
Return type:
-
-
class
netlist_simulator_controller.
WaveDataGroup
¶ Waveform data group.
-
add_waveform
(self: netlist_simulator_controller.WaveDataGroup, wave: netlist_simulator_controller.WaveData) → None¶ Add waveform to existing waveform group.
Parameters: wave (netlist_simulator_controller.WaveData) – Waveform to be added.
-
get_waveforms
(self: netlist_simulator_controller.WaveDataGroup) → List[netlist_simulator_controller.WaveData]¶ Get list of waveforms contained by group.
Return type: list[netlist_simulator_controller.WaveData]
-
remove_waveform
(self: netlist_simulator_controller.WaveDataGroup, wave: netlist_simulator_controller.WaveData) → None¶ Remove waveform from waveform group.
Parameters: wave (netlist_simulator_controller.WaveData) – Waveform to be removed.
-
-
class
netlist_simulator_controller.
WaveDataBoolean
¶ Boolean Waveform (combines several waveform by boolean operation).
-
class
netlist_simulator_controller.
WaveDataTrigger
¶ Trigger time set (derived from WaveData).
-
set_filter_wave
(self: netlist_simulator_controller.WaveDataTrigger, wave: netlist_simulator_controller.WaveData) → None¶ Add wave which works as filter allowing trigger only upon value one.
Parameters: wave (netlist_simulator_controller.WaveData) – Regular or boolean waveform as filter.
-