code: def addInputPort(self, node, name,
                       i: Union[Value, RtlSignalBase],
                       side=PortSide.WEST):
          
          root = self.node
          port = node.addPort(name, PortType.INPUT, side)
          netCtxs = self.netCtxs
  
          if isinstance(i, LPort):
              root.addEdge(i, port)
          elif isConst(i):
              i = i.staticEval()
              c, wasThereBefore = self.netCtxs.getDefault(i)
              if not wasThereBefore:
                  v = ValueAsLNode(root, i).east[0]
                  c.addDriver(v)
              c.addEndpoint(port)
          elif i.hidden:
              # later connect driver of this signal to output port
              ctx, wasThereBefore = netCtxs.getDefault(i)
              if not wasThereBefore:
                  self.lazyLoadNet(i)
              ctx.addEndpoint(port)
          else:
              portCtx = self.portCtx
              rootCtx, _ = self.rootNetCtxs.getDefault(i)
  
              if self.isVirtual:
                  # later connect signal in root to input port or input port of
                  # wrap node
                  rootCtx.addEndpoint(port)
              else:
                  # spot input port on this wrap node if required
                  isNewlySpotted = (i, PortType.INPUT) not in portCtx.data
                  src = portCtx.register(i, PortType.INPUT)
                  # connect input port on wrap node with specified output port
                  ctx, _ = netCtxs.getDefault(i)
                  ctx.addDriver(src)
                  ctx.addEndpoint(port)
  
                  if isNewlySpotted:
                      # get input port from parent view
                      _port = portCtx.getOutside(i, PortType.INPUT)
                      rootCtx.addEndpoint(_port)
docs: Add and connect input port on subnode
  
          :param node: node where to add input port
          :param name: name of newly added port
          :param i: input value
          :param side: side where input port should be added