if __name__ == "__main__": doVCD = False proc, elffile = argv[1].split(":") sim = SimulavrAdapter() sim.dmanSingleDeviceApplication() dev = sim.loadDevice(proc, elffile) #dev.SetClockFreq(100) if doVCD: print "all registrered trace values:\n ", print "\n ".join(sim.getAllRegisteredTraceValues()) sigs = ("IRQ.VECTOR9", "PORTA.PORT") sim.setVCDDump(splitext(basename(argv[0]))[0] + ".vcd", sigs) print "-" * 20 xpin = XPin("port A.0") # watch out, that this Net instance will not be deleted until simulation is # done (for example, if you create this in a subfunction and do not save # this instance too, before you leave this subfunction) net = pysimulavr.Net() net.Add(xpin) net.Add(dev.GetPin("A0")) sim.dmanStart() print "simulation start: (t=%dns)" % sim.getCurrentTime() sim.doRun(15000000) print "simulation end: (t=%dns)" % sim.getCurrentTime()
baudrate = 9600 etu = 1000000000 / baudrate print "ETU =", etu, "ns" freq = 3579000 period = 1000000000 / freq print "1/Freq =", period, "ns" sim = SimulavrAdapter() sim.dmanSingleDeviceApplication() dev = sim.loadDevice('at90s8515', 'pintaros') dev.SetClockFreq(period) sim.setVCDDump("atr.vcd", ["PORTB.B6-Out", "PORTB.DDR", "PORTB.PIN", "PORTB.PORT"]) io_pin = dev.GetPin("B6") io_val = io_pin.toChar sim.dmanStart() getATR() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte()
if __name__ == "__main__": doVCD = False proc, elffile = argv[1].split(":") sim = SimulavrAdapter() sim.dmanSingleDeviceApplication() dev = sim.loadDevice(proc, elffile) #dev.SetClockFreq(100) if doVCD: print "all registrered trace values:\n ", print "\n ".join(sim.getAllRegisteredTraceValues()) sigs = ("IRQ.VECTOR9", "PORTA.PORT") sim.setVCDDump(splitext(basename(argv[0]))[0] + ".vcd", sigs) print "-" * 20 xpin = XPin("port A.0") # watch out, that this Net instance will not be deleted until simulation is # done (for example, if you create this in a subfunction and do not save # this instance too, before you leave this subfunction) net = pysimulavr.Net() net.Add(xpin) net.Add(dev.GetPin("A0")) sim.dmanStart() print "simulation start: (t=%dns)" % sim.getCurrentTime() sim.doRun(15000000) print "simulation end: (t=%dns)" % sim.getCurrentTime()
baudrate = 9600 etu = 1000000000/baudrate print "ETU =", etu, "ns" freq = 3579000 period = 1000000000/freq print "1/Freq =", period, "ns" sim = SimulavrAdapter() sim.dmanSingleDeviceApplication() dev = sim.loadDevice('at90s8515','pintaros') dev.SetClockFreq(period) sim.setVCDDump("atr.vcd", ["PORTB.B6-Out","PORTB.DDR","PORTB.PIN","PORTB.PORT"]) io_pin = dev.GetPin("B6") io_val = io_pin.toChar sim.dmanStart() getATR() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte() # readbyte()