当前位置: 首页>>代码示例>>Python>>正文


Python pyrtl.reset_working_block函数代码示例

本文整理汇总了Python中pyrtl.reset_working_block函数的典型用法代码示例。如果您正苦于以下问题:Python reset_working_block函数的具体用法?Python reset_working_block怎么用?Python reset_working_block使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reset_working_block函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: example_t

def example_t(file):
    print("testing file: " + file)
    pyrtl.reset_working_block()
    try:
        output = subprocess.check_output(['python', file])
    except subprocess.CalledProcessError as e:
        raise e
开发者ID:LinChai,项目名称:PyRTL,代码行数:7,代码来源:test_examples.py

示例2: test_function_RomBlock

    def test_function_RomBlock(self):

        def rom_data_function(add):
            return int((add + 5)/2)

        pyrtl.reset_working_block()
        self.bitwidth = 4
        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.rom = pyrtl.RomBlock(bitwidth=self.bitwidth, addrwidth=self.addrwidth,
                                  name='rom', romdata=rom_data_function)
        self.output1 <<= self.rom[self.read_addr1]
        self.output2 <<= self.rom[self.read_addr2]
        # build the actual simulation environment
        self.sim_trace = pyrtl.SimulationTrace()
        self.sim = pyrtl.FastSimulation(tracer=self.sim_trace)

        input_signals = {}
        for i in range(0, 5):
            input_signals[i] = {self.read_addr1: i, self.read_addr2: 2*i}
            self.sim.step(input_signals[i])

        exp_out = self.generate_expected_output((("o1", lambda x: rom_data_function(x)),
                                                 ("o2", lambda x: rom_data_function(2*x))), 6)
        self.compareIO(self.sim_trace, exp_out)
开发者ID:LinChai,项目名称:PyRTL,代码行数:28,代码来源:test_fastsimulation.py

示例3: test_undriven_net

 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)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:9,代码来源:test_core.py

示例4: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     self.bitwidth = 3
     self.addrwidth = 5
     self.output1 = pyrtl.Output(self.bitwidth, "output1")
     self.in1 = pyrtl.Input(self.addrwidth, name='mem_write_address')
     self.in2 = pyrtl.Input(self.addrwidth, name='mem_write_address')
     self.memory = pyrtl.RomBlock(bitwidth=self.bitwidth, addrwidth=self.addrwidth,
                                  name='self.memory', romdata=self.data, max_read_ports=None)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:9,代码来源:test_memblock.py

示例5: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     self.bitwidth = 3
     self.addrwidth = 5
     self.output1 = pyrtl.Output(self.bitwidth, "output1")
     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')
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:9,代码来源:test_core.py

示例6: test_complete_adders

    def test_complete_adders(self):
        for bitwidth in range(9, 10):
            r = pyrtl.Register(bitwidth=bitwidth, name='r')
            const_one = pyrtl.Const(1)
            addby = const_one.zero_extended(bitwidth)
            sum, cout = generate_full_adder(r, addby)
            r.next <<= sum

            self.assertTrue(isinstance(r, pyrtl.Register))
            self.assertTrue(isinstance(cout, pyrtl.WireVector))
            pyrtl.reset_working_block()
开发者ID:DivyaJanaswamy,项目名称:PyRTL,代码行数:11,代码来源:test_wire.py

示例7: test_net_odd_wires

    def test_net_odd_wires(self):
        wire = pyrtl.WireVector(2, 'wire')
        net = self.new_net(args=(wire, wire))
        other_block = pyrtl.Block()
        wire._block = other_block
        self.invalid_net("net references different block", net)

        pyrtl.reset_working_block()
        wire = pyrtl.WireVector(2, 'wire')
        net = self.new_net(args=(wire,))
        pyrtl.working_block().remove_wirevector(wire)
        self.invalid_net("net with unknown source", net)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:12,代码来源:test_core.py

示例8: test_minus_sim_overflow

    def test_minus_sim_overflow(self):
        pyrtl.reset_working_block()
        i = pyrtl.Input(8, 'i')
        o = pyrtl.Output(name='o')
        o <<= i - 1

        tracer = pyrtl.SimulationTrace()
        sim = self.sim(tracer=tracer)
        sim.step({i: 1})
        self.assertEqual(sim.inspect(o), 0)
        sim.step({i: 0})
        self.assertEqual(sim.inspect(o), 0x1ff)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:12,代码来源:test_simulation.py

示例9: setUp

    def setUp(self):
        pyrtl.reset_working_block()
        bitwidth = 3
        self.a = pyrtl.Input(bitwidth=bitwidth)
        self.b = pyrtl.Input(bitwidth=bitwidth)
        self.sel = pyrtl.Input(bitwidth=1)
        self.muxout = pyrtl.Output(bitwidth=bitwidth, name='muxout')
        self.muxout <<= generate_full_mux(self.a, self.b, self.sel)

        # build the actual simulation environment
        self.sim_trace = pyrtl.SimulationTrace()
        self.sim = pyrtl.FastSimulation(tracer=self.sim_trace)
开发者ID:LinChai,项目名称:PyRTL,代码行数:12,代码来源:test_fastsimulation.py

示例10: test_partition_sim

    def test_partition_sim(self):
        pyrtl.reset_working_block()
        wires, vals = utils.make_wires_and_values(exact_bitwidth=32, num_wires=1)
        out_wires = [pyrtl.Output(8, "o" + str(i)) for i in range(4)]
        partitioned_w = libutils.partition_wire(wires[0], 8)
        for p_wire, o_wire in zip(partitioned_w, out_wires):
            o_wire <<= p_wire

        out_vals = utils.sim_and_ret_outws(wires, vals)
        partitioned_vals = [[(val >> i) & 0xFF for i in (0, 8, 16, 24)] for val in vals[0]]
        true_vals = tuple(zip(*partitioned_vals))
        for index, wire in enumerate(out_wires):
            self.assertEqual(tuple(out_vals[wire]), true_vals[index])
开发者ID:DivyaJanaswamy,项目名称:PyRTL,代码行数:13,代码来源:test_libutils.py

示例11: test_order_dependent_ops

    def test_order_dependent_ops(self):
        # subtract, lt, gt simarlarly are order dependent.
        # therefore we need to check that we aren't mangling them
        for op, opcode in ((operator.sub, '-'), (operator.gt, '>'), (operator.lt, '<')):
            pyrtl.reset_working_block()
            ins = [pyrtl.Input(5) for i in range(2)]
            outs = [pyrtl.Output(10) for i in range(2)]
            outs[0] <<= op(ins[1], ins[0])
            outs[1] <<= op(ins[0], ins[1])

            pyrtl.common_subexp_elimination()
            self.num_net_of_type(opcode, 2)
            self.num_net_of_type('w', 2)
            pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:14,代码来源:test_passes.py

示例12: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     bitwidth = 3
     self.r = pyrtl.Register(bitwidth=bitwidth, name='r')
     self.result = _basic_add(self.r, pyrtl.Const(1).zero_extended(bitwidth))
     self.r.next <<= self.result
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:6,代码来源:test_simulation.py

示例13: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     self.inp_val = pyrtl.Input(8, 'inp_val')
     self.inp_shift = pyrtl.Input(2, 'inp_shift')
     self.out_zeros = pyrtl.Output(18, 'out_zeros')
     self.out_ones = pyrtl.Output(18, 'out_ones')
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:6,代码来源:test_barrel.py

示例14: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     self.vnames = inputoutput._VerilogSanitizer("_sani_test")
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:3,代码来源:test_inputoutput.py

示例15: setUp

 def setUp(self):
     pyrtl.reset_working_block()
     self.aes = aes.AES()
     self.in_vector = pyrtl.Input(bitwidth=128, name='in_vector')
     self.out_vector = pyrtl.Output(bitwidth=128, name='out_vector')
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:5,代码来源:test_aes.py


注:本文中的pyrtl.reset_working_block函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。