def test(): """ c = a+b; """ handle_a = pyvpi.handleByName("top.a") val_a = pyvpi.Value(cons.vpiIntVal) val_a.value = 5 pyvpi.putValue(handle_a, val_a) time = pyvpi.Time() pyvpi.getTime(time) print('py: hello world at %d'%time.time)
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
#! 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))
def value(self): pyvpi.getTime(self._time) return self._time.real
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))