monitors module

Record and display output signals.

Used in the Logic Simulator project to record and display specified output signals.

Classes

Monitors - records and displays specified output signals.

class monitors.Monitors(names: names.Names, devices: devices.Devices, network: network.Network)

Bases: object

Record and display output signals.

This class contains functions for recording and displaying the signal state of outputs specified by their device and port IDs.

Parameters
  • names – instance of the names.Names() class.

  • devices – instance of the devices.Devices() class.

  • network – instance of the network.Network() class.

make_monitor(self, device_id, output_id):

Sets a specified monitor on the specified output.

remove_monitor(self, device_id, output_id):

Removes a monitor from the specified output.

get_monitor_signal(self, device_id, output_id):

Returns the signal level of the specified monitor.

record_signals(self):

Records the current signal level of all monitors.

get_signal_names(self):

Returns two lists of signal names: monitored and not monitored.

reset_monitors(self):

Clears the memory of all monitors.

get_margin(self):

Returns the length of the longest monitor’s name.

display_signals(self):

Displays signal trace(s) in the text console.

display_signals()

Display the signal trace(s) in the text console.

get_margin()

Return the length of the longest monitor’s name.

Return None if no signals are being monitored. This is useful for finding out how much space to leave after each monitor’s name before starting to draw the signal trace.

get_monitor_signal(device_id, output_id)

Return the signal level of the specified monitor.

If the monitor does not exist, return None.

get_signal_names()

Return two signal name lists: monitored and not monitored.

make_monitor(device_id: int, output_id: Optional[int], cycles_completed: int = 0)

Add the specified signal to the monitors dictionary.

Return NO_ERROR if successful, or the corresponding error if not.

record_signals()

Record the current signal level for every monitor.

This function is called at every simulation cycle.

remove_monitor(device_id, output_id)

Remove the specified signal from the monitors dictionary.

Return True if successful.

reset_monitors()

Clear the memory of all the monitors.

The list of stored signal levels for each monitor is deleted.