Make-Net¶
make-net is another way to create connection between components. It creates the exact same type of connection that the net statement makes.
However, make-net allows us to name nets with strings. This tends to be useful when constructing nets inside for loops or in recursive functions.
Signature¶
defn make-net (name:Symbol, refs:Seqable<JITXObject>) :
...
defn make-net (name:Symbol, type:PortType|False, refs:Seqable<JITXObject>) :
...
defn make-net (name:Symbol, type:PortType|False, refs:Seqable<JITXObject>, public?:True|False) :
...
name- Name as aSymbolfor this nettype- Constructs a net of a particular port type likeSinglePin,Bundle, orPortArray.FalseimpliesSinglePinrefs- Object capable of generating a sequence ofJITXObjects like ports or nets - same list of refs you would pass to thenetstatement.public?- Flag to make this net publicly accessible outside the module. By default this value isfalse.
Example usage¶
pcb-module top-level:
inst host : mcu
inst sensor : temp-sensor
val name = to-string("alert-%_" % [1])
val symb = to-symbol(name)
make-net(symb, [host.GPIO[0], sensor.ALERT])
In this example, we connect a GPIO pin on the host to the ALERT output of a sensor using the make-net function. This is a contrived example and only intended to show
the mechanics of the make-net function.