!Connect¶
The !Connect tag defines a connection between ports of a block, as well as providing a mechanism to tie ports to a constant value. It is used within the connections section of the !Mod tag to define the interconnectivity of the boundary ports of the module and the ports of any child blocks.
When using the tag to describe interconnectivity, it is possible to express fan-ins, fan-outs, as well as 1-to-1 connections. It is important to understand the steps that the elaboration engine uses to build interconnections:
First it separates out all of the ports that are initiators (those that drive a value) and those that are targets (those that are driven).
Then it walks through the list of targets and assigns the next initiator in the sequence.
When it runs out of initiators, the engine wraps back to the first one in the list and begins allocating all over again.
The engine takes account of the number of instances of each port - so if the
countparameter has been set to a number greater than 1, it will work through each target consecutively assigning the next available initiator before moving onto the next !Point in the list. The same goes where thecountfor a specific initiator is greater than 1.
In the example shown in the usage section, ‘switch_on’ is a single signal that is being fanned out to four separate target ports (‘inverter’, ‘and’, and two instances of ‘or’). Equally ‘output’ is a fan-in from four separate initiator ports on the same blocks.
If in a different example ‘switch_on’ instance had its count parameter set to 4, then one signal would have been uniquely connected to each of the sub-blocks.
Note
The order of the declaration is very important - as the first initiator will be assigned to the first target, the second initiator to the second target, and so on. Changing the order of !Point tags in the list will alter the resultant connectivity!
Warning
Only compatible signal types may be fanned-out or fanned-in - if you have a signal with bidirectional components (i.e. a !His containing both master and slave components) then it is not possible to fan-in or fan-out, only 1-to-1 connections are allowed as otherwise the drivers of each component would be unclear. The elaborator will raise an error if it encounters a mapping that it cannot comprehend.
When tying a port to a constant value, only one !Const tag may be present in the list, but multiple !Point tags may exist. Be aware that the constant value will only apply to any signal components driven by the parent block (i.e. those that will have a role of master relative to the block).
Usage¶
The !Connect tag can either be used to express interconnectivity between ports or to tie a port to a constant value - examples of both modes are given below:
- !Mod
name : my_mod
ports :
- !HisRef [switch_on, enable, "Control to switch on blocks", 1, Slave]
- !HisRef [output, wire, "Output signals from each block", 4, Master]
modules:
- !ModInst [block_a, inverter, "Inverts value", 1]
- !ModInst [block_b, and, "ANDs values", 1]
- !ModInst [or_blocks, or, "ORs values", 2]
connections:
- !Connect
points:
- !Point [switch_on]
- !Point [enable, block_a]
- !Point [enable, block_b]
- !Point [enable, or_blocks]
- !Connect
const:
- !Point [input, block_a]
- !Const [1]
- !Connect
const:
- !Point [output, block_a]
- !Point [output, block_b]
- !Point [output, or_blocks]
- !Point [output]
...
-
class
blade.schema.ph_connect.Conect(points=[], name='unknown', sd='', ld='', options=[], constants=[])¶ Provide legacy support for the ‘!Conect’ tag - this is just an alias over the ‘!Connect’ tag class for backwards compatibility.
-
class
blade.schema.ph_connect.Connect(points=[], name='unknown', sd='', ld='', options=[], constants=[])¶ The !Connect tag represents an interconnection between ports of different blocks, it can also be used to tie-off signals to a constant value.
-
__init__(points=[], name='unknown', sd='', ld='', options=[], constants=[])¶ Initialisation for the Connect tag.
- Parameters
points – List of !Point tags to connect.
name – Optional for the connection.
sd – Short description - maximum 150 characters.
ld – Long description - no maximum length.
options – List of options in the form ‘KEY=VAL’ or just ‘KEY’ if a value is not required.
constants – List containing !Points and a single !Const tag in order to tie a signal to a specific value.
-
set_source_file(file)¶ Set the source file of this object and propagate it to children.
- Parameters
file – The source file path or object
-
validate()¶ Check that this tag agrees with our YAML schema
-