vcBooleanSignalMap

vcBooleanSignalMap allows you to map Boolean signals to ports in a continuous IO space.

Inherits: vcBehaviour

Properties

Name Type Access Description
Listeners List of vcBehaviour RW Defines a list of behaviors using the signal map.
Direction Enumeration RW

Defines the direction of ports in the signal map. Ports can be set as inputs, outputs or undefined. If ports are defined as inputs, they cannot be used as outputs or vice versa. To set the direction it is recommended to use the trySetDirection Method instead.

See Signal Map Constants for more information

Name String RW Defines the name of the signal map.
StartIndex Integer RW Defines the start index of ports in the signal map. It can be used in conjunction with EndIndex to define the amount of ports in the signal map.
EndIndex Integer RW Defines the end index of ports in the signal map. Its value is updated automatically when setting Ports or PortCount.
PortCount Integer RW Same as Ports, defines the number of ports in map.
Ports Integer RW Same as PortCount, defines the number of ports in the signal map.

Methods

Name Return Type Parameters Description
addPort None Integer index, vcBoolSignal signal Connects a port at a given index to a given signal.

The port index starts from 0. The PortCount property should have enough ports. In other words, to add a boolean signal to port 3 the PortCount value should be at least 4 (ports 0-3), otherwise calling this method will return an error.

connect None Integer indexPort1, vcBooleanSignalMap SignalMap2, Integer indexPort2

or

Integer indexPort1, vcBoolSignal signal  

Creates a remote connection with another signal map or signal.

If a port is connected to a signal, refer to the abstract interface of the connection to disconnect only that signal. Otherwise, the disconnect() method will disconnect all signals connected to the port.

Signals in components can act as abstract interfaces between ports, sending and receiving information via signal maps.  

See vcBoolSignal for more information.

disconnect None Integer index Disconnects a port at a given index from its connections.
getAllConnectedPorts List of Integer None Returns a list of all connected ports in the signal map.
getPortName String Integer index Returns the name of a port at a given index.

Note: If the port has no signal then its name is an empty string.

getInternalPortSignal vcBoolSignal Integer index Returns the signal connected to a port at given index; otherwise returns None.
getConnectedExternalSignals List of vcBoolSignal Integer index Returns a list of all signals in other components connected to a local port at the given index in the signal map; otherwise returns an empty list.
getConnectedExternalPorts List of 2-tuple (vcBooleanSignalMap map, Integer port) Integer index Returns a list of all ports in other components connected to a local port at a given index in the signal map; otherwise returns an empty list.
input Boolean Integer index Returns the value of a port at a given index.
output None Integer index, Boolean value Sets the value of a port at a given index to a given value.  
setPortName None Integer index, String name Sets the name of a port at a given index to a given name.

Note: The port must have a signal in order to be assigned a name.

setPortSignal None Integer index, [vcBoolSignal signal] Sets the signal of a port at a given index.

An optional signal argument can be given to assign the port a signal in its component. Otherwise, the port is assigned a dynamic, application signal.

trySetDirection Boolean Enumeration type Tries to set a direction for the Boolean Signal Map.
If setting the direction was successful, returns True. Otherwise, returns False.   To see the valid string options for this method, see Signal Map Constants.

Events

Name Parameters Description
OnDirectionChanged vcBooleanSignalMap signal_map, Integer oldValue, Boolean newValue Triggered when the value of the Direction property is changed.
OnSignalTrigger vcBooleanSignalMap signal_map, Integer port, Boolean value Triggered when the value of a signal mapped to a port has a new value.