def testBackupOutputFile(self, vcd_dir): p = "%s.vcd" % fun.__name__ dut = traceSignals(fun) Simulation(dut).run(1000, quiet=QUIET) _simulator._tf.close() _simulator._tracing = 0 size = path.getsize(p) pbak = p + '.' + str(path.getmtime(p)) assert not path.exists(pbak) dut = traceSignals(fun) _simulator._tf.close() _simulator._tracing = 0 assert path.exists(p) assert path.exists(pbak) assert path.getsize(pbak) == size assert path.getsize(p) < size
def testArgType1(self): try: dut = traceSignals([1, 2]) except TraceSignalsError as e: self.assertEqual(e.kind, _error.ArgType) else: self.fail()
def testReturnVal(self): from myhdl import ExtractHierarchyError from myhdl._extractHierarchy import _error try: dut = traceSignals(dummy) except ExtractHierarchyError, e: self.assertEqual(e.kind, _error.InconsistentToplevel % (2, "dummy"))
def testBackupOutputFile(self): p = "%s.vcd" % fun.func_name dut = traceSignals(fun) Simulation(dut).run(1000, quiet=QUIET) _simulator._tf.close() _simulator._tracing = 0 size = path.getsize(p) pbak = p + '.' + str(path.getmtime(p)) self.assert_(not path.exists(pbak)) dut = traceSignals(fun) _simulator._tf.close() _simulator._tracing = 0 self.assert_(path.exists(p)) self.assert_(path.exists(pbak)) self.assert_(path.getsize(pbak) == size) self.assert_(path.getsize(p) < size)
def testSetDirectory(self, vcd_dir): traceSignals.directory = 'some_vcd_dir' os.mkdir(path.join(str(vcd_dir), traceSignals.directory)) pdut = "%s.vcd" % top.__name__ psub = "%s.vcd" % fun.__name__ pdutd = path.join(traceSignals.directory, "%s.vcd" % top.__name__) psubd = path.join(traceSignals.directory, "%s.vcd" % fun.__name__) dut = traceSignals(top) assert not path.exists(pdut) assert not path.exists(psub) assert path.exists(pdutd) assert not path.exists(psubd)
def topTristate(): inst = traceSignals(tristate) return inst
def testHierarchicalTrace2(self): pdut = "%s.vcd" % top.func_name psub = "%s.vcd" % fun.func_name dut = traceSignals(top) self.assert_(path.exists(pdut)) self.assert_(not path.exists(psub))
def topTristate(): inst = traceSignals(tristate()) return inst
def testArgType1(self): try: dut = traceSignals([1, 2]) except TraceSignalsError, e: self.assertEqual(e.kind, _error.ArgType)
def testArgType1(self, vcd_dir): with raises_kind(TraceSignalsError, _error.ArgType): dut = traceSignals([1, 2])
def testHierarchicalTrace2(self): pdut = "%s.vcd" % top.__name__ psub = "%s.vcd" % fun.__name__ dut = traceSignals(top) self.assertTrue(path.exists(pdut)) self.assertTrue(not path.exists(psub))
def testHierarchicalTrace2(self, vcd_dir): pdut = "%s.vcd" % top.__name__ psub = "%s.vcd" % fun.__name__ dut = traceSignals(top()) assert path.exists(pdut) assert not path.exists(psub)
def testHierarchicalTrace2(self, vcd_dir): pdut = "%s.vcd" % top.__name__ psub = "%s.vcd" % fun.__name__ dut = traceSignals(top) assert path.exists(pdut) assert not path.exists(psub)
def testReturnVal(self, vcd_dir): from myhdl import ExtractHierarchyError from myhdl._extractHierarchy import _error kind = _error.InconsistentToplevel % (2, "dummy") with raises_kind(ExtractHierarchyError, kind): dut = traceSignals(dummy)
def top2(): inst = [{} for i in range(4)] j = 3 inst[j-2]['key'] = traceSignals(fun) return inst
def top(): inst = traceSignals(fun) return inst
def top2(): inst = [{} for i in range(4)] j = 3 inst[j - 2]['key'] = traceSignals(fun) return inst
def top3(): inst_1 = traceSignals(fun) inst_2 = traceSignals(fun) return inst_1, inst_2