• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyrtl.working_block函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_memblock_to_memblock_direct_operation

 def test_memblock_to_memblock_direct_operation(self):
     temp = (self.memory[self.mem_read_address1] == self.memory[self.mem_read_address2])
     temp = (self.memory[self.mem_read_address1] != self.memory[self.mem_read_address2])
     temp = (self.memory[self.mem_read_address1] & self.memory[self.mem_read_address2])
     temp = (self.memory[self.mem_read_address1] | self.memory[self.mem_read_address2])
     temp = (self.memory[self.mem_read_address1] + self.memory[self.mem_read_address2])
     temp = (self.memory[self.mem_read_address1] - self.memory[self.mem_read_address2])
     temp2 = (self.memory[self.mem_read_address1] * self.memory[self.mem_read_address2])
     self.output1 <<= temp
     self.output2 <<= temp2
     pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:11,代码来源:test_memblock.py


示例17: test_invalid_with_set_wb

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


示例18: test_multiple_elimination

    def test_multiple_elimination(self):
        ins = [pyrtl.Input(5) for i in range(3)]
        out_1 = pyrtl.Output(5)
        a = ins[0] ^ ins[1]
        b = ins[0] ^ ins[1]
        c = ins[0] ^ ins[1]

        out_1 <<= a | b | c
        pyrtl.common_subexp_elimination()
        self.num_net_of_type('^', 1)
        self.num_net_of_type('|', 2)
        pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:12,代码来源:test_passes.py


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


示例20: test_different_arg_order

    def test_different_arg_order(self):
        ins = [pyrtl.Input(5) for i in range(2)]
        outs = [pyrtl.Output(5) for i in range(2)]
        outs[0] <<= ins[1] & ins[0]
        outs[1] <<= ins[0] & ins[1]

        pyrtl.common_subexp_elimination()
        self.num_net_of_type('&', 1)
        self.num_net_of_type('w', 2)
        self.assert_num_net(3)
        self.assert_num_wires(5)
        pyrtl.working_block().sanity_check()
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:12,代码来源:test_passes.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python meta.DBSession类代码示例发布时间:2022-05-27
下一篇:
Python pyrtl.synthesize函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap