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.


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 a Symbol for this net
  • type - Constructs a net of a particular port type like SinglePin, Bundle, or PortArray. False implies SinglePin
  • refs - Object capable of generating a sequence of JITXObjects like ports or nets - same list of refs you would pass to the net statement.
  • public? - Flag to make this net publicly accessible outside the module. By default this value is false.

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.