ControlSignal

class NetworkSim.architecture.signal.ControlSignal(id_length=7, control_length=2, abstract=True)[source]

Constructor for control signals.

The user defines the bit lengths of both the Source/Destination ID and the Control bits

Parameters
  • id_length (int, optional) – The bit length of the source and destination IDs. Default is 7 for 100 nodes.

  • control_length (int, optional) – The bit length of the control bits. Default is 2.

  • abstract (bool) – Abstract mode of the control signals. If True, the control packets will be abstract as a list of source_id, destination_id and control_code in decimal form. If False, the control packets will be the same as the actual packets as strings in binary form. Default is True.

Variables

control_info (dictionary) – A dictionary containing information about the control bits.

generate_packet(source, destination, control_code)[source]

Control packet generation.

Parameters
  • source (int) – Source node ID.

  • destination (int) – Destination node ID.

  • control_code (int) – Control code in decimal.

Returns

  • control_packet (str (If self.abstract == True)) – The control packet string in binary.

  • control_packet (list (If self.abstract == False)) – The control packet list in decimal, containing the following:

    • Source ID

    • Destination ID

    • Control Code

get_code(code)[source]

Obtain information about control code.

Parameters

code (int) – Control code in decimal.

Returns

control_info – Control code corresponding representation.

Return type

str

get_info()[source]

Obtain information about the control signals.

Returns

info – A pandas DataFrame containing control signal’s decimal code, binary code, and respective representations, containing the columns:

  • Decimal

  • Binary

  • Representation

Return type

pandas DataFrame

set_info(new_info)[source]

Set information about the control signals.

Parameters

new_info (dict) – New information of the control signals.