How to use the pyrtl.reset_working_block function in pyrtl

To help you get started, we’ve selected a few pyrtl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UCSBarchlab / PyRTL / tests / test_transform.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
github UCSBarchlab / PyRTL / tests / test_signed.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
        # test with '101' in binary, which should be
        # 5 for an unsigned operation and should be
        # -3 for an signed operation
        self.c = pyrtl.Const(0b101,bitwidth=3)
        self.r = pyrtl.Register(bitwidth=3)
        self.o = pyrtl.Output(bitwidth=4, name='o')
        self.r.next <<= self.r+1
github UCSBarchlab / PyRTL / tests / test_core.py View on Github external
def test_undriven_net(self):
        w = pyrtl.WireVector(name='testwire', bitwidth=3)
        self.assertRaises(pyrtl.PyrtlError, pyrtl.working_block().sanity_check)
        pyrtl.reset_working_block()
        r = pyrtl.Register(3)
        self.assertRaises(pyrtl.PyrtlError, pyrtl.working_block().sanity_check)
        pyrtl.reset_working_block()
        o = pyrtl.Output(3)
        self.assertRaises(pyrtl.PyrtlError, pyrtl.working_block().sanity_check)
github UCSBarchlab / PyRTL / tests / test_inputoutput.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
github UCSBarchlab / PyRTL / tests / rtllib / test_libutils.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
        self.in1, self.in2 = (pyrtl.Input(8, "in"+str(i)) for i in range(1, 3))
        self.out = pyrtl.Output(9, "out")
github UCSBarchlab / PyRTL / tests / test_memblock.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
        self.bitwidth = 3
        self.addrwidth = 5
        self.output1 = pyrtl.Output(self.bitwidth, "output1")
        self.output2 = pyrtl.Output(self.bitwidth, "output2")
        self.mem_read_address1 = pyrtl.Input(self.addrwidth, name='mem_read_address1')
        self.mem_read_address2 = pyrtl.Input(self.addrwidth, name='mem_read_address2')
        self.mem_write_address = pyrtl.Input(self.addrwidth, name='mem_write_address')
        self.mem_write_data = pyrtl.Input(self.bitwidth, name='mem_write_data')
        self.memory = pyrtl.MemBlock(bitwidth=self.bitwidth, addrwidth=self.addrwidth,
                                     name='self.memory')
github UCSBarchlab / PyRTL / tests / test_fastsimulation.py View on Github external
def setUp(self):
        pyrtl.reset_working_block()
        self.bitwidth = 3
        self.addrwidth = 4
        self.output1 = pyrtl.Output(self.bitwidth, "o1")
        self.output2 = pyrtl.Output(self.bitwidth, "o2")
        self.read_addr1 = pyrtl.Input(self.addrwidth)
        self.read_addr2 = pyrtl.Input(self.addrwidth)
        self.write_addr = pyrtl.Input(self.addrwidth)
        self.write_data = pyrtl.Input(self.bitwidth)
        self.rom = pyrtl.MemBlock(bitwidth=self.bitwidth, addrwidth=self.addrwidth,
                                  name='rom')
        self.output1 <<= self.rom[self.read_addr1]
        self.output2 <<= self.rom[self.read_addr2]
        self.rom[self.write_addr] <<= self.write_data

        # build the actual simulation environment
        self.sim_trace = pyrtl.SimulationTrace()
github UCSBarchlab / PyRTL / tests / rtllib / test_lfsr.py View on Github external
self.assertEqual(sim_trace.trace[lfsr_out][disable_cycle + 1:],
                             [sim_trace.trace[lfsr_out][disable_cycle]]
                             * (19 - disable_cycle))

            true_val = TestLFSR.sw_galois_lfsr(seed_vals[1], bitwidth)
            sim.step({'seed': seed_vals[1], 'reset': 1, 'enable': 1})
            for cycle in range(1000 if bitwidth > 10 else 2**bitwidth - 1):
                sim.step({'seed': seed_vals[1], 'reset': 0, 'enable': 1})
                self.assertEqual(sim.value[lfsr_out], next(true_val))

            true_val = TestLFSR.sw_galois_lfsr(seed_vals[2], bitwidth)
            sim.step({'seed': seed_vals[2], 'reset': 1, 'enable': 1})
            for cycle in range(1000 if bitwidth > 10 else 2**bitwidth - 1):
                sim.step({'seed': seed_vals[2], 'reset': 0, 'enable': 1})
                self.assertEqual(sim.value[lfsr_out], next(true_val))
            pyrtl.reset_working_block()
github UCSBarchlab / PyRTL / tests / test_helperfuncs.py View on Github external
def test_wire_from_another_block(self):
        w = pyrtl.Input(1)
        pyrtl.reset_working_block()
        self.bad_rtl_assert(w, self.RTLSampleException())