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


Python pyrtl.working_block函数代码示例

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


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

示例1: test_memblock_with_write_enable_with_equalsign

 def test_memblock_with_write_enable_with_equalsign(self):
     we = pyrtl.Const(1, bitwidth=1)
     self.output1 <<= self.memory[self.mem_read_address1]
     self.output2 <<= self.memory[self.mem_read_address2]
     self.memory[self.mem_write_address] <<= \
         pyrtl.MemBlock.EnabledWrite(self.mem_write_data, enable=we)
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:7,代码来源:test_memblock.py

示例2: test_with_block_exception

 def test_with_block_exception(self):
     pyrtl.set_working_block(self.block_a)
     with self.assertRaises(pyrtl.PyrtlInternalError):
         with pyrtl.set_working_block(self.block_b):
             self.assertIs(pyrtl.working_block(), self.block_b)
             raise pyrtl.PyrtlInternalError()
     self.assertIs(pyrtl.working_block(), self.block_a)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:7,代码来源:test_core.py

示例3: test_unknown_wires

 def test_unknown_wires(self):
     inp = pyrtl.Input(8, 'inp')
     out = pyrtl.Output(8, 'out')
     out <<= inp
     pyrtl.working_block().wirevector_set.discard(inp)
     with self.assertRaises(pyrtl.PyrtlInternalError):  # sanity_check_net()
         self.sanity_error("Unknown wires")
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:7,代码来源:test_core.py

示例4: test_async_check_should_pass_with_select

 def test_async_check_should_pass_with_select(self):
     memory = pyrtl.MemBlock(
                 bitwidth=self.bitwidth, 
                 addrwidth=self.addrwidth-1,
                 name='memory')
     self.output1 <<= memory[self.mem_read_address1[0:-1]]
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:7,代码来源:test_core.py

示例5: test_memblock_assign_with_extention

 def test_memblock_assign_with_extention(self):
     big_output = pyrtl.Output(self.bitwidth+1, "big_output")
     big_output <<= self.memory[self.mem_read_address1]
     self.output1 <<= 1
     self.output2 <<= 2
     self.memory[self.mem_write_address] <<= self.mem_write_data
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:7,代码来源:test_memblock.py

示例6: test_async_check_should_pass

 def test_async_check_should_pass(self):
     memory = pyrtl.MemBlock(
                 bitwidth=self.bitwidth, 
                 addrwidth=self.addrwidth,
                 name='memory')
     self.output1 <<= memory[self.mem_read_address1]
     memory[self.mem_write_address] <<= self.mem_write_data
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:8,代码来源:test_core.py

示例7: 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

示例8: test_async_check_should_pass_with_cat

 def test_async_check_should_pass_with_cat(self):
     memory = pyrtl.MemBlock(
                 bitwidth=self.bitwidth, 
                 addrwidth=self.addrwidth,
                 name='memory')
     addr = pyrtl.concat(self.mem_read_address1[0], self.mem_read_address2[0:-1])
     self.output1 <<= memory[addr]
     memory[self.mem_write_address] <<= self.mem_write_data
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:9,代码来源:test_core.py

示例9: test_const_different_bitwidth_1

    def test_const_different_bitwidth_1(self):
        in_w = pyrtl.Input(5)
        const = pyrtl.Const(23, 5)
        const_2 = pyrtl.Const(23, 6)
        wire_1 = in_w + const
        wire_2 = in_w + const_2

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

示例10: test_const_values_2

    def test_const_values_2(self):
        in_w = pyrtl.Input(5)
        const = pyrtl.Const(23, 5)
        const_2 = pyrtl.Const(23, 5)
        wire_1 = in_w + const
        wire_2 = in_w + const_2

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

示例11: test_2read_1write

    def test_2read_1write(self):
        small_memory = pyrtl.MemBlock(bitwidth=self.bitwidth, addrwidth=self.addrwidth,
                                      name='small_memory', max_read_ports=2, max_write_ports=1)
        temp = small_memory[self.mem_read_address1]  # read
        temp2 = small_memory[self.mem_read_address2]  # read

        self.output1 <<= temp
        self.output2 <<= temp2
        small_memory[self.mem_write_address] <<= pyrtl.Const(6)  # write
        pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:10,代码来源:test_memblock.py

示例12: test_valid_slices

 def test_valid_slices(self):
     self.valid_slice(8, slice(6))
     self.valid_slice(8, slice(1, 4))
     self.valid_slice(8, slice(1, 8))  # Yes, supplying a end index out of bounds is valid python
     self.valid_slice(8, slice(1, 2, 2))
     self.valid_slice(8, slice(1, 4, 2))
     self.valid_slice(8, slice(7, 1, -2))
     self.valid_slice(8, slice(-2))
     self.valid_slice(8, slice(-6, -2, 3))
     pyrtl.working_block().sanity_check()
开发者ID:DivyaJanaswamy,项目名称:PyRTL,代码行数:10,代码来源:test_wire.py

示例13: test_invalid_set_wb

 def test_invalid_set_wb(self):
     x = pyrtl.WireVector()
     y = 1
     pyrtl.set_working_block(self.block_a)
     with self.assertRaises(pyrtl.PyrtlError):
         pyrtl.set_working_block(x)
     self.assertEqual(pyrtl.working_block(), self.block_a)
     with self.assertRaises(pyrtl.PyrtlError):
         pyrtl.set_working_block(y)
     self.assertEqual(pyrtl.working_block(), self.block_a)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:10,代码来源:test_core.py

示例14: test_with_block_nested

 def test_with_block_nested(self):
     self.block_c = pyrtl.Block()
     pyrtl.set_working_block(self.block_a)
     self.assertIs(pyrtl.working_block(), self.block_a)
     with pyrtl.set_working_block(self.block_b):
         self.assertIs(pyrtl.working_block(), self.block_b)
         with pyrtl.set_working_block(self.block_c):
             self.assertIs(pyrtl.working_block(), self.block_c)
         self.assertIs(pyrtl.working_block(), self.block_b)
     self.assertIs(pyrtl.working_block(), self.block_a)
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:10,代码来源:test_core.py

示例15: test_async_check_should_notpass_with_add

 def test_async_check_should_notpass_with_add(self):
     memory = pyrtl.MemBlock(
                 bitwidth=self.bitwidth, 
                 addrwidth=self.addrwidth,
                 name='memory')
     addr = pyrtl.WireVector(self.bitwidth)
     addr <<= self.mem_read_address1 + self.mem_read_address2
     self.output1 <<= memory[addr]
     print(pyrtl.working_block())
     with self.assertRaises(pyrtl.PyrtlError):
         pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:11,代码来源:test_core.py


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