コード例 #1
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, callinfo=callinfo, sigdict=sigdict)
コード例 #2
0
ファイル: _always_seq.py プロジェクト: Thomasb81/myhdl
 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
ファイル: _always_seq.py プロジェクト: forrestv/myhdl
 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
ファイル: _instance.py プロジェクト: Alisa-lisa/uni-stuff
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
ファイル: _always_seq.py プロジェクト: cpeppenster/myhdl
 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
ファイル: _always.py プロジェクト: Thomasb81/myhdl
 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
ファイル: _always.py プロジェクト: Alisa-lisa/uni-stuff
 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
ファイル: _instance.py プロジェクト: unornate/myhdl
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
ファイル: _always_comb.py プロジェクト: krypto94/myhdl
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
ファイル: _instance.py プロジェクト: StudentESE/myhdl
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
ファイル: pygmyhdl.py プロジェクト: xesscorp/pygmyhdl
 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
ファイル: pygmyhdl.py プロジェクト: xesscorp/pygmyhdl
 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
コード例 #15
0
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