def _always_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysError(_error.ArgType)
     if func.__code__.co_argcount > 0:
         raise AlwaysError(_error.NrOfArgs)
     return _Always(func, args, callinfo=callinfo, sigdict=sigdict)
示例#2
0
 def _always_seq_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysSeqError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysSeqError(_error.ArgType)
     if func.__code__.co_argcount > 0:
         raise AlwaysSeqError(_error.NrOfArgs)
     return _AlwaysSeq(func, edge, reset)
示例#3
0
 def _always_seq_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysSeqError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysSeqError(_error.ArgType)
     if func.func_code.co_argcount > 0:
         raise AlwaysSeqError(_error.NrOfArgs)
     return _AlwaysSeq(func, edge, reset)
示例#4
0
def instance(genFunc):
    if not isinstance(genFunc, FunctionType):
        raise InstanceError(_error.ArgType)
    if not _isGenFunc(genFunc):
        raise InstanceError(_error.ArgType)
    if genFunc.func_code.co_argcount > 0:
        raise InstanceError(_error.NrOfArgs)
    return _Instantiator(genFunc)
示例#5
0
def instance(genFunc):
    if not isinstance(genFunc, FunctionType):
        raise InstanceError(_error.ArgType)
    if not _isGenFunc(genFunc):
        raise InstanceError(_error.ArgType)
    if genFunc.func_code.co_argcount > 0:
        raise InstanceError(_error.NrOfArgs)
    return _Instantiator(genFunc)
示例#6
0
 def _always_seq_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysSeqError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysSeqError(_error.ArgType)
     if func.__code__.co_argcount > 0:
         raise AlwaysSeqError(_error.NrOfArgs)
     return _AlwaysSeq(func, edge, reset, callinfo=callinfo, sigdict=sigdict)
示例#7
0
 def _always_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysError(_error.ArgType)
     if func.__code__.co_argcount > 0:
         raise AlwaysError(_error.NrOfArgs)
     return _Always(func, args)
示例#8
0
 def _always_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysError(_error.ArgType)
     if func.func_code.co_argcount > 0:
         raise AlwaysError(_error.NrOfArgs)
     return _Always(func, args)
示例#9
0
def instance(genfunc):
    callinfo = _getCallInfo()
    if not isinstance(genfunc, FunctionType):
        raise InstanceError(_error.ArgType)
    if not _isGenFunc(genfunc):
        raise InstanceError(_error.ArgType)
    if genfunc.__code__.co_argcount > 0:
        raise InstanceError(_error.NrOfArgs)
    return _Instantiator(genfunc, callinfo=callinfo)
示例#10
0
def always_comb(func):
    if not isinstance( func, FunctionType):
        raise AlwaysCombError(_error.ArgType)
    if _isGenFunc(func):
        raise AlwaysCombError(_error.ArgType)
    if func.__code__.co_argcount > 0:
        raise AlwaysCombError(_error.NrOfArgs)
    c = _AlwaysComb(func)
    return c
示例#11
0
def always_comb(func):
    if not isinstance(func, FunctionType):
        raise AlwaysCombError(_error.ArgType)
    if _isGenFunc(func):
        raise AlwaysCombError(_error.ArgType)
    if func.__code__.co_argcount > 0:
        raise AlwaysCombError(_error.NrOfArgs)
    c = _AlwaysComb(func)
    return c
示例#12
0
def instance(genfunc):
    callinfo = _getCallInfo()
    if not isinstance(genfunc, FunctionType):
        raise InstanceError(_error.ArgType)
    if not _isGenFunc(genfunc):
        raise InstanceError(_error.ArgType)
    if genfunc.__code__.co_argcount > 0:
        raise InstanceError(_error.NrOfArgs)
    return _Instantiator(genfunc, callinfo=callinfo)
示例#13
0
 def comb_logic(func):
     '''Decorator for combinational logic functions in PygMyHDL.
        Create a combinational logic block and store it on the instance list.'''
     callinfo = myhdlinst._getCallInfo()
     if not isinstance(func, FunctionType):
         raise myhdlcomb.AlwaysCombError(myhdlcomb._error.ArgType)
     if myhdlutil._isGenFunc(func):
         raise myhdlcomb.AlwaysCombError(myhdlcomb._error.ArgType)
     if func.__code__.co_argcount > 0:
         raise myhdlcomb.AlwaysCombError(myhdlcomb._error.NrOfArgs)
     c = myhdlcomb._AlwaysComb(func, callinfo=callinfo)
     _instances.append(c)
     return c
示例#14
0
 def _always_seq_decorator(func):
     if not isinstance(func, FunctionType):
         raise myhdlseq.AlwaysSeqError(myhdlseq._error.ArgType)
     if myhdlutil._isGenFunc(func):
         raise myhdlseq.AlwaysSeqError(myhdlseq._error.ArgType)
     if func.__code__.co_argcount > 0:
         raise myhdlseq.AlwaysSeqError(myhdlseq._error.NrOfArgs)
     c = myhdlseq._AlwaysSeq(func,
                             edge,
                             reset,
                             callinfo=callinfo,
                             sigdict=sigdict)
     _instances.append(c)
     return c
def always_comb(func):
    if not isinstance( func, FunctionType):
        raise AlwaysCombError(_error.ArgType)
    if _isGenFunc(func):
        raise AlwaysCombError(_error.ArgType)
    if func.func_code.co_argcount > 0:
        raise AlwaysCombError(_error.NrOfArgs)
    varnames = func.func_code.co_varnames
    symdict = {}
    for n, v in func.func_globals.items():
        if n not in varnames:
            symdict[n] = v
    # handle free variables
    if func.func_code.co_freevars:
        for n, c in zip(func.func_code.co_freevars, func.func_closure):
            obj = _cell_deref(c)
            symdict[n] = obj
    c = _AlwaysComb(func, symdict)
    return c
示例#16
0
def always_comb(func):
    if not isinstance(func, FunctionType):
        raise AlwaysCombError(_error.ArgType)
    if _isGenFunc(func):
        raise AlwaysCombError(_error.ArgType)
    if func.__code__.co_argcount > 0:
        raise AlwaysCombError(_error.NrOfArgs)
    varnames = func.__code__.co_varnames
    symdict = {}
    for n, v in func.__globals__.items():
        if n not in varnames:
            symdict[n] = v
    # handle free variables
    if func.__code__.co_freevars:
        for n, c in zip(func.__code__.co_freevars, func.__closure__):
            try:
                obj = _cell_deref(c)
                symdict[n] = obj
            except NameError:
                raise NameError(n)
    c = _AlwaysComb(func, symdict)
    return c