hwt/code_utils.py
def _mkOp(fn):
    """
    Function to create variadic operator function

    :param fn: function to perform binary operation
    """
    def op(*operands, key=None) -> RtlSignalBase:
        """
        :param operands: variadic parameter of input uperands
        :param key: optional function applied on every operand
            before processing
        """
        assert operands, operands
        top = None
        if key is not None:
            operands = map(key, operands)

        for s in operands:
            if top is None:
                top = s
            else:
                top = fn(top, s)
        return top

    return op
def _mkOp(fn):
    def op(*operands, key=None) -> RtlSignalBase:
        """
        :param operands: variadic parameter of input uperands
        :param key: optional function applied on every operand
            before processing
        """
        assert operands, operands
        top = None
        if key is not None:
            operands = map(key, operands)

        for s in operands:
            if top is None:
                top = s
            else:
                top = fn(top, s)
        return top

    return op
def _mkOp ( fn ) : def op ( * operands , key = None ) -> RtlSignalBase : """
        :param operands: variadic parameter of input uperands
        :param key: optional function applied on every operand
            before processing
        """ assert operands , operands top = None if key is not None : operands = map ( key , operands ) for s in operands : if top is None : top = s else : top = fn ( top , s ) return top return op
Function to create variadic operator function

    :param fn: function to perform binary operation
Function to create variadic operator function