コード例 #1
0
def aes_ecb_enc():
    """
    >>> cipher = AES.new('2b7e151628aed2a6abf7158809cf4f3c'.decode('hex'))
    >>> crypted = cipher.encrypt('6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51'.decode('hex'))
    >>> crypted.encode('hex')
    '3ad77bb40d7a3660a89ecaf32466ef97f5d3d58503b9699de785895a96fdbaaf'
    """

    text = pyvpi.handleByName("top.u_pyAESECBenc.text")
    key = pyvpi.handleByName("top.u_pyAESECBenc.key")
    enc = pyvpi.handleByName("top.u_pyAESECBenc.enc")

    # if val > 32 use HexStr as string type
    val_text = pyvpi.Value(cons.vpiHexStrVal)
    val_key  = pyvpi.Value(cons.vpiHexStrVal)
    val_enc  = pyvpi.Value(cons.vpiHexStrVal)

    pyvpi.getValue(text,val_text)
    pyvpi.getValue(key, val_key)
    pyvpi.getValue(enc, val_enc)

    try:
        cipher = AES.new(str(val_key.value).decode('hex'))
        crypted = cipher.encrypt(str(val_text.value).decode('hex'))
        val_enc.value = str(crypted.encode('hex'))
        pyvpi.putValue(enc, val_enc)
        pyvpi.printf("py key:{} + text:{} = enc:{}\n".format(val_key.value, val_text.value, val_enc.value))
    except:
        print traceback.print_exc()
        # skip if value is unknown
        pass
コード例 #2
0
ファイル: test.py プロジェクト: burt0927/pyvpi
def test_iterate():
    m = pyvpi.handleByName("test")
    iter = pyvpi.iterate(cons.vpiReg, m)
    reg = pyvpi.scan(iter)
    while (reg):
        pyvpi.printf("reg : %s\n" % pyvpi.getStr(cons.vpiName, reg))
        reg = pyvpi.scan(iter)
コード例 #3
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
def test_iterate():
    m = pyvpi.handleByName("test")
    iter = pyvpi.iterate(cons.vpiReg,m)
    reg = pyvpi.scan(iter)
    while(reg) :
        pyvpi.printf("reg : %s\n" % pyvpi.getStr(cons.vpiName,reg))
        reg = pyvpi.scan(iter)
コード例 #4
0
ファイル: aes_ecb_dec.py プロジェクト: hbhbts/pyvpi_example
def aes_ecb_dec():
    """
    ECB EXAMPLE:
    -------------
    NIST Special Publication 800-38A http://cryptome.org/bcm/sp800-38a.htm#F
    >>> decipher = AES.new('2b7e151628aed2a6abf7158809cf4f3c'.decode('hex'))
    >>> decipher.decrypt(crypted).encode('hex')
    '6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51'
    """

    dec = pyvpi.handleByName("top.u_pyAESECBdec.dec")
    key = pyvpi.handleByName("top.u_pyAESECBdec.key")
    text = pyvpi.handleByName("top.u_pyAESECBdec.text")

    # if val > 32 use HexStr as string type
    val_key  = pyvpi.Value(cons.vpiHexStrVal)
    val_dec  = pyvpi.Value(cons.vpiHexStrVal)
    val_text = pyvpi.Value(cons.vpiHexStrVal)

    pyvpi.getValue(text,val_text)
    pyvpi.getValue(key, val_key)
    pyvpi.getValue(dec, val_dec)

    try:
        decipher = AES.new(str(val_key.value).decode('hex'))
        decrypted = decipher.decrypt(str(val_dec.value).decode('hex'))
        val_text.value = str(decrypted.encode('hex'))
        pyvpi.putValue(text, val_text)
        pyvpi.printf("py key:{} + dec:{} = text:{}\n".format(val_key.value, val_dec.value, val_text.value))
    except:
        print traceback.print_exc()
        # skip if value is unknown
        pass
コード例 #5
0
def aes_ecb_enc():
    """
    >>> cipher = AES.new('2b7e151628aed2a6abf7158809cf4f3c'.decode('hex'))
    >>> crypted = cipher.encrypt('6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51'.decode('hex'))
    >>> crypted.encode('hex')
    '3ad77bb40d7a3660a89ecaf32466ef97f5d3d58503b9699de785895a96fdbaaf'
    """

    text = pyvpi.handleByName("top.u_pyAESECBenc.text")
    key = pyvpi.handleByName("top.u_pyAESECBenc.key")
    enc = pyvpi.handleByName("top.u_pyAESECBenc.enc")

    # if val > 32 use HexStr as string type
    val_text = pyvpi.Value(cons.vpiHexStrVal)
    val_key = pyvpi.Value(cons.vpiHexStrVal)
    val_enc = pyvpi.Value(cons.vpiHexStrVal)

    pyvpi.getValue(text, val_text)
    pyvpi.getValue(key, val_key)
    pyvpi.getValue(enc, val_enc)

    try:
        cipher = AES.new(bytes.fromhex(val_key.value))
        crypted = cipher.encrypt(bytes.fromhex(val_text.value))
        val_enc.value = crypted.hex()
        pyvpi.putValue(enc, val_enc)
        pyvpi.printf("py key:{} + text:{} = enc:{}\n".format(
            val_key.value, val_text.value, val_enc.value))
    except:
        #        print(traceback.print_exc())
        # skip if value is unknown
        pass
コード例 #6
0
def callback(self):
    try:
        getValue(self.a, self.av)
        getValue(self.b, self.bv)
        printf("%s : %s(a) + %s(b) = %s(o)\n" %
               (self.time.time, self.av.value, self.bv.value,
                self.value.value.vec))
    except Exception, e:
        printf("%s\n%s\n" % (e, traceback.print_exc()))
コード例 #7
0
ファイル: 4.py プロジェクト: GeneKong/pyvpi
def callback(self) :
    try :
        getValue(self.a,self.av)
        getValue(self.b,self.bv)
        printf("%s : %s(a) + %s(b) = %s(o)\n" % (self.time.time,
            self.av.value,
            self.bv.value,
            self.value.value.vec))
    except Exception,e :
        printf("%s\n%s\n" % (e,traceback.print_exc()))
コード例 #8
0
def _pyinteractive_cb(self):
    pyinteractive_lock = sys.modules['__main__'].__dict__['pyinteractive_lock']
    pyinteractive_lock.clear()
    if sys.modules['__main__'].__dict__['pyinteractive_mode']:
        pyvpi.printf("Enter Pyinteractive @ %d\n" % Simtime.value)
        pyinteractive_lock.wait()
    else:
        pyinteractive_lock.clear()
    time.sleep(0.1)
    pyvpi.removeCb(self)
コード例 #9
0
 def log(self, info='CALL', ex=None, ts=1):
     if DEBUG==1:
         timestr = ': at Sim:%d  CPU %f'%(Simtime.value, time.time())
         s = '{:10}: '.format(self.name)
         s += '{:15}: '.format(info)
         s += '{} '.format(ex)
         if ts:
             s += timestr
         s += '\n'
         pyvpi.printf(s)
コード例 #10
0
 def __init__(self, dt, **kwargs):
     super().__init__()
     self.reason = cons.cbAfterDelay
     self.time = pyvpi.Time(cons.vpiSimTime)
     self.dxt = dt / 10**(Simtime.unit)
     pyvpi.printf("dxt is %f \n" % self.dxt)
     self.time.low = int(self.dxt % 2**32)
     self.time.high = int(self.dxt // 2**32)
     for name, val in kwargs.items():
         setattr(self, name, val)
コード例 #11
0
def run_sim(t, unit=None):
    cbdata = pyvpi.CbData()
    cbdata.reason = cons.cbAfterDelay
    cbdata.callback = _pyinteractive_cb
    setAbsTime(cbdata, t, unit)
    pyvpi.registerCb(cbdata)
    pyvpi.printf("Register runtime = %d\n" % cbdata.time.time)
    time.sleep(0.1)
    pyinteractive_lock = sys.modules['__main__'].__dict__['pyinteractive_lock']
    pyinteractive_lock.set()
    time.sleep(0.1)
コード例 #12
0
 async def SWHeader(self, AnD=DP, WnR=READ, Addr=DPIDR):
     self.log('SWHeader AnD=%d, WnR=%d, Addr = %d' % (AnD, WnR, Addr))
     # await self._idle(12)
     self.APnDP = AnD
     self.RnW = WnR
     self.Address = Addr
     # await self._idle(4)
     self.DAPSTATUS.ack = 0
     await self.SerialWireClockOut(self.SW_HEADER, 8)
     ack = await self.SerialWireClockIn(4)
     ack = (ack >> (29)) & 0x7
     pyvpi.printf('ACK for HEADER = 0x%x\n' % ack)
     # assert ack==1, 'Error in ACK'
     self.DAPSTATUS.ack = 1
     return ack
コード例 #13
0
 def _myfunc(self, arg):
     try:
         self.myfunc(arg)
     except Exception as e:
         pyvpi.printf("\n")
         pyvpi.printf("#" * 25 + "Python Exception Found : %s" % self.name +
                      "#" * 25 + '\n')
         pyvpi.printf(repr(type(e)) + "\n")
         pyvpi.printf(repr(e) + "\n")
コード例 #14
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
def test_normal() :
    """
    """  
    global call
    pyvpi.printf("error start!\n")
    cb = pyvpi.CbData(cons.cbValueChange,
                      trgobj = pyvpi.handleByName("test.o",0),
                      value  = pyvpi.Value(cons.vpiBinStrVal))
    cb.user_data = 1
    def callback(arg):
        pyvpi.printf("%s : " % arg.time.low)
        pyvpi.printf("%s : " % arg.value.value)        
        pyvpi.printf("%s\n" % "callback is run...")
        if cb.user_data == 3 :
            pyvpi.removeCb(arg)
        cb.user_data += 1
    cb.callback = callback
    pyvpi.registerCb(cb)
コード例 #15
0
 def __init__(self):
     self.swclk = pyvpi_tools.Reg('main.swdclk')
     self.swdio = pyvpi_tools.Reg('main.swdio')
     self.swclk_net = pyvpi_tools.Reg('main.swdclk_net')
     self.swdio_net = pyvpi_tools.Reg('main.swdio_net')
     self.freq = 10e6
     self.vl = 0
     self.vh = 1.2
     self.pose_trig_w = True
     self.pose_trig_r = False
     self.APnDP = 1  # 1=Ap  0=Dp
     self.RnW = 0  # 0=write 1= read
     self.Address = 0  # Ap or DP reg address
     pyvpi.printf('SWD created\n')
     self.trig = Edge(self.swclk)
     self.hclk = Timer(1 / 2 / self.freq, 's')
     self.swclk.value = 0
     self.DAPSTATUS = DAPSTATUS()
     self._log = pyvpi_tools.Reg('main.cmd')
     self._log2 = pyvpi_tools.Reg('main.ack')
コード例 #16
0
ファイル: test.py プロジェクト: burt0927/pyvpi
def test_normal():
    """
    """
    global call
    pyvpi.printf("error start!\n")
    cb = pyvpi.CbData(cons.cbValueChange,
                      trgobj=pyvpi.handleByName("test.o", 0),
                      value=pyvpi.Value(cons.vpiBinStrVal))
    cb.user_data = 1

    def callback(arg):
        pyvpi.printf("%s : " % arg.time.low)
        pyvpi.printf("%s : " % arg.value.value)
        pyvpi.printf("%s\n" % "callback is run...")
        if cb.user_data == 3:
            pyvpi.removeCb(arg)
        cb.user_data += 1

    cb.callback = callback
    pyvpi.registerCb(cb)
コード例 #17
0
def test():
    """
    c = a+b;
    """
    time = pyvpi.Time()
    pyvpi.getTime(time)
    pyvpi.printf('py: hello world at %d\n' % time.time)

    handle_a = pyvpi.handleByName("top.a")
    val_a = pyvpi.Value(cons.vpiIntVal)

    pyvpi.getValue(handle_a, val_a)
    print(val_a.format)
    try:
        val_a.value += 1
        pyvpi.putValue(handle_a, val_a)
        print('py:      a = %d' % val_a.value)
    except:
        #
        pass
コード例 #18
0
def test():
    """
    c = a+b;
    """

    a = pyvpi.handleByName("top.u_pyadaptor.a")
    b = pyvpi.handleByName("top.u_pyadaptor.b")
    c = pyvpi.handleByName("top.u_pyadaptor.c")
    p = pyvpi.handleByName("top.p")
    s = pyvpi.getStr(cons.vpiName, p)
    pyvpi.printf('p is {}\n'.format(s))
    st = pyvpi.getStr(cons.vpiType, p)
    pyvpi.printf('p type = {}\n'.format(st))

    it = pyvpi.iterate(cons.vpiMember, p)
    xt = pyvpi.scan(it)
    while (xt):
        st = pyvpi.getStr(cons.vpiFullName, xt)
        pyvpi.printf('P Member name = {} \n'.format(st))
        xt = pyvpi.scan(it)

    ph = pyvpi.handle(cons.vpiTypespec, p)
    p_name = pyvpi.getStr(cons.vpiName, ph)
    pyvpi.printf('p type name = {}\n'.format(p_name))

    val_a = pyvpi.Value(cons.vpiIntVal)
    val_b = pyvpi.Value(cons.vpiIntVal)
    val_c = pyvpi.Value(cons.vpiIntVal)

    pyvpi.getValue(a, val_a)
    pyvpi.getValue(b, val_b)
    pyvpi.getValue(c, val_c)

    try:
        val_c.value = val_a.value + val_b.value
        pyvpi.putValue(c, val_c)
        pyvpi.printf("py a:{} + b:{} = c:{}\n".format(val_a.value, val_b.value,
                                                      val_c.value))
    except:
        # skip if value is unknown
        pass
コード例 #19
0
ファイル: test.py プロジェクト: burt0927/pyvpi
 def callback(arg):
     pyvpi.printf("%s : " % arg.time.low)
     pyvpi.printf("%s : " % arg.value.value)
     pyvpi.printf("%s\n" % "callback is run...")
     if cb.user_data == 3:
         pyvpi.removeCb(arg)
     cb.user_data += 1
コード例 #20
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
 def callback(arg):
     pyvpi.printf("%s : " % arg.time.low)
     pyvpi.printf("%s : " % arg.value.value)        
     pyvpi.printf("%s\n" % "callback is run...")
     if cb.user_data == 3 :
         pyvpi.removeCb(arg)
     cb.user_data += 1
コード例 #21
0
ファイル: tt.py プロジェクト: funningboy/pyvpi_example
def test():
    """
    c = a+b;
    """

    a = pyvpi.handleByName("top.u_pyadaptor.a")
    b = pyvpi.handleByName("top.u_pyadaptor.b")
    c = pyvpi.handleByName("top.u_pyadaptor.c")

    val_a = pyvpi.Value(cons.vpiIntVal)
    val_b = pyvpi.Value(cons.vpiIntVal)
    val_c = pyvpi.Value(cons.vpiIntVal)

    pyvpi.getValue(a,val_a)
    pyvpi.getValue(b,val_b)
    pyvpi.getValue(c,val_c)

    try:
        val_c.value = val_a.value + val_b.value
        pyvpi.putValue(c, val_c)
        pyvpi.printf("py a:{} + b:{} = c:{}\n".format(val_a.value, val_b.value, val_c.value))
    except:
        # skip if value is unknown
        pass
コード例 #22
0
from pyvpi import CbData,registerCb,removeCb,handleByName,Value,getValue,printf
import pyvpi_cons as cons
import traceback

c = handleByName("top.c")
a = handleByName("top.a")
b = handleByName("top.b")
def callback(self) :
    try :
        getValue(self.a,self.av)
        getValue(self.b,self.bv)
        printf("%s : %s(a) + %s(b) = %s(o)\n" % (self.time.time,
            self.av.value,
            self.bv.value,
            self.value.value.vec))
    except Exception as e :
        printf("%s\n%s\n" % (e,traceback.print_exc()))
        
cb = CbData(trgobj = c,callback = callback, value = Value(cons.vpiVectorVal))
cb.a = a
cb.b = b
cb.av = Value()
cb.bv = Value()
printf("%s\n"  % (hasattr(cb,"a")))
registerCb(cb)
コード例 #23
0
def print_mem():
    GMEM=process.memory_info()[0]
    pyvpi.printf("MEM: %d\n"%GMEM)
コード例 #24
0
def start_info(s):
    pyvpi.printf("\n")
    pyvpi.printf("******** Start of Python ********\n")
    pyvpi.printf(s + "\n")
コード例 #25
0
ファイル: load.py プロジェクト: burt0927/pyvpi
#! python
import pyvpi
import pyvpi_cons as cons
pyvpi.printf("do something at load lib(+pyvpi+load).\n")
コード例 #26
0
 async def __gt__(self,val):
     while(1):
         pyvpi.printf("current value is %d\n"%self.reg.value)
         await self.wait()
         if self.reg.value > val:
             return 1      
コード例 #27
0
ファイル: 2.py プロジェクト: burt0927/pyvpi
#! python
import pyvpi
import pyvpi_cons as cons

pyvpi.setDebugLevel(30)
a = pyvpi.handleByName("test.a")
b = pyvpi.handleByName("test.b")
o = pyvpi.handleByName("test.o")
val_a = pyvpi.Value(cons.vpiVectorVal)
val_b = pyvpi.Value(cons.vpiVectorVal)
val_o = pyvpi.Value(cons.vpiVectorVal)
pyvpi.getValue(a, val_a)
pyvpi.getValue(b, val_b)
pyvpi.getValue(o, val_o)
pyvpi.printf("a{} + b{} = o{}\n".format(val_a.value.vec, val_b.value.vec,
                                        val_o.value.vec))
pyvpi.putValue(b, val_o)
コード例 #28
0
ファイル: test.py プロジェクト: burt0927/pyvpi
def test_pyeda():
    #print "???"
    pyvpi.printf("1\n")
    pyvpi.handleByName("test")
    pyvpi.printf("2\n")
    a = pyvpi.handleByName("o")
    pyvpi.printf("3\n")
    pyvpi.printf(
        "module name : %s\n" %
        pyvpi.getStr(cons.vpiFullName, pyvpi.handle(cons.vpiModule, a)))
    pyvpi.printf("4\n")
    val = pyvpi.Value(cons.vpiVectorVal)
    vec = pyvpi.Vector(9, [(0, 0)])
    val.value = vec
    #pyvpi.putValue(a,val)
    pyvpi.printf("%s %s\n" % (val.value.vec, val.value.size))
コード例 #29
0
ファイル: test.py プロジェクト: burt0927/pyvpi
def test_vector():
    vec = pyvpi.Vector()
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
    vec = pyvpi.Vector(8)
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
    vec = pyvpi.Vector(8, [(511, 125465)])
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
    vec = pyvpi.Vector(8, [511])
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
    vec.vec = [5156]
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
    vec.size = 30
    pyvpi.printf("%s %s\n" % (vec.vec, vec.size))
コード例 #30
0
ファイル: 4.py プロジェクト: GeneKong/pyvpi
#! python
from pyvpi import CbData,registerCb,removeCb,handleByName,Value,getValue,printf
import pyvpi_cons as cons
import traceback

o = handleByName("test.o")
a = handleByName("test.a")
b = handleByName("test.b")
def callback(self) :
    try :
        getValue(self.a,self.av)
        getValue(self.b,self.bv)
        printf("%s : %s(a) + %s(b) = %s(o)\n" % (self.time.time,
            self.av.value,
            self.bv.value,
            self.value.value.vec))
    except Exception,e :
        printf("%s\n%s\n" % (e,traceback.print_exc()))
        
cb = CbData(trgobj = o,callback = callback, value = Value(cons.vpiVectorVal))
cb.a = a
cb.b = b
cb.av = Value()
cb.bv = Value()
printf("%s\n"  % (hasattr(cb,"a")))
registerCb(cb)

コード例 #31
0
ファイル: 3.py プロジェクト: antiface/pyvpi
#! python
import pyvpi
import pyvpi_cons as cons
def getAllHandles(handle,type) :
    ans = []
    iter = pyvpi.iterate(type,handle)
    while True :
        h = pyvpi.scan(iter)
        if not h :
            break
        ans.append(h)
    return ans
    
mod = pyvpi.handleByName("test")

pyvpi.printf("All regs are blew here :\n")    
for reg in getAllHandles(mod,cons.vpiReg) :
    pyvpi.printf("%s\n" % (pyvpi.getStr(cons.vpiName,reg)))
pyvpi.printf("All nets are blew here :\n")    
for net in getAllHandles(mod,cons.vpiNet) :
    pyvpi.printf("%s\n" % (pyvpi.getStr(cons.vpiFullName,net)))

time = pyvpi.Time()
pyvpi.getTime(time)
pyvpi.printf("%s\n" %(time.low))
コード例 #32
0
#! python
import pyvpi
import pyvpi_cons as cons
pyvpi.printf("do something at start sim.\n")
コード例 #33
0
import pyvpi
import pyvpi_cons as cons
# from scipy import signal
#from IPython import embed
import os
import sys

try:
    pyvpi.gd
except Exception:
    pyvpi.gd = dict()
    pyvpi.gd['Registered_event'] = []
    pyvpi.printf("Global Dict created\n")

INT_VAL = [
    cons.vpiIntVal, cons.vpiReg, cons.vpiIntNet, cons.vpiIntVar,
    cons.vpiIntegerNet, cons.vpiIntegerVar
]
REAL_VAL = [cons.vpiRealVal, cons.vpiRealVar, cons.vpiRealNet]
STR_VAL = [cons.vpiStringVal, cons.vpiStringVar]


class Reg(object):
    '''
    access to registers in verilog.
    >>>freq = Reg("tb_r_adpll880_nl01.dut.DCO.fout")
    >>>freq.format(cons.vpiRealVal)
    >>>pyvpi.printf("Get frequency = %s \n"%(freq.get()))

    newly added: format using the default property defined
    '''
コード例 #34
0
ファイル: 1.py プロジェクト: PDFxy/my_pyvpi
import pyvpi

pyvpi.printf("hello this is python")
コード例 #35
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
def test_index():
    o = pyvpi.handleByName("test.o")
    o_0 = pyvpi.handleByIndex(o,0)
    pyvpi.printf("index : %s\n" % o_0)
    o1 = pyvpi.handleByName("test.o[0]")
    pyvpi.printf("index : %s\n" % o1)
コード例 #36
0
ファイル: test.py プロジェクト: burt0927/pyvpi
def test_index():
    o = pyvpi.handleByName("test.o")
    o_0 = pyvpi.handleByIndex(o, 0)
    pyvpi.printf("index : %s\n" % o_0)
    o1 = pyvpi.handleByName("test.o[0]")
    pyvpi.printf("index : %s\n" % o1)
コード例 #37
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
def test_pyeda() :            
    #print "???"
    pyvpi.printf("1\n")
    pyvpi.handleByName("test")
    pyvpi.printf("2\n")
    a = pyvpi.handleByName("o")
    pyvpi.printf("3\n")    
    pyvpi.printf("module name : %s\n" %
                 pyvpi.getStr(cons.vpiFullName,
                              pyvpi.handle(cons.vpiModule, a)
                              )
                 )
    pyvpi.printf("4\n")
    val = pyvpi.Value(cons.vpiVectorVal)
    vec = pyvpi.Vector(9,[(0,0)])
    val.value = vec
    #pyvpi.putValue(a,val)
    pyvpi.printf("%s %s\n" %  (val.value.vec,val.value.size))
コード例 #38
0
ファイル: 3.py プロジェクト: PDFxy/my_pyvpi
import pyvpi
import pyvpi_cons as cons
def getAllHandles(handle,type) :
    ans = []
    iter = pyvpi.iterate(type,handle)
    while True :
        h = pyvpi.scan(iter)
        if not h :
            break
        ans.append(h)
    return ans
    
mod = pyvpi.handleByName("top")

pyvpi.printf("All regs are blew here :\n")    
for reg in getAllHandles(mod,cons.vpiReg) :
    pyvpi.printf("%s\n" % (pyvpi.getStr(cons.vpiName,reg)))
pyvpi.printf("All nets are blew here :\n")    
for net in getAllHandles(mod,cons.vpiNet) :
    pyvpi.printf("%s\n" % (pyvpi.getStr(cons.vpiFullName,net)))

time = pyvpi.Time()
pyvpi.getTime(time)
pyvpi.printf("%s\n" %(time.low))
コード例 #39
0
ファイル: test.py プロジェクト: GeneKong/pyvpi
def test_vector() :
    vec = pyvpi.Vector()
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
    vec = pyvpi.Vector(8)
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
    vec = pyvpi.Vector(8,[(511,125465)])
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
    vec = pyvpi.Vector(8,[511])
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
    vec.vec = [5156]
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
    vec.size = 30
    pyvpi.printf("%s %s\n" % (vec.vec,vec.size))
コード例 #40
0
import pyvpi_tools
from pyvpi_tools import AtTime, _get_unit, get_simtime_unit, setAbsTime
import sys
import os
import time
import threading
from threading import Thread, current_thread, Event
from pyvpi_tools import Simtime
import asyncio
import IPython
import uuid
import psutil
import gc
import inspect

pyvpi.printf("************************\n")
pyvpi.printf("PYVPI_COROUTINE         \n")
pyvpi.printf("************************\n")


def public(f):
    """Use a decorator to avoid retyping function/class names.
    * Based on an idea by Duncan Booth:
    http://groups.google.com/group/comp.lang.python/msg/11cbb03e09611b8a
    * Improved via a suggestion by Dave Angel:
    http://groups.google.com/group/comp.lang.python/msg/3d400fb22d8a42e1
    Take this fuction from COCOTB
    """
    all = sys.modules['__main__'].__dict__
    if f.__name__ not in all.keys():  # Prevent duplicates if run from an IDE.
        all[f.__name__] = f
コード例 #41
0
ファイル: 1.py プロジェクト: GeneKong/pyvpi
#! python
import pyvpi
import pyvpi_cons as cons
pyvpi.setDebugLevel(30)
a = pyvpi.handleByName("test.a")
b = pyvpi.handleByName("test.b")
o = pyvpi.handleByName("test.o")
val_a = pyvpi.Value()
val_b = pyvpi.Value(cons.vpiVectorVal)
val_o = pyvpi.Value(cons.vpiVectorVal)
pyvpi.getValue(a,val_a)
pyvpi.getValue(b,val_b)
pyvpi.getValue(o,val_o)
pyvpi.printf("a[{}] + b{} = o{}\n".format(val_a.value,val_b.value.vec,val_o.value.vec))
コード例 #42
0
def end_info():
    pyvpi.printf('******** End of Python ********\n')
    pyvpi.printf("\n")