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

Python pyrtl.synthesize函数代码示例

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

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



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

示例1: make_example_graph_2

def make_example_graph_2():
    in1, in2 = pyrtl.Input(16, 'in1'), pyrtl.Input(16, 'in2')
    out = pyrtl.Output(17, 'output')
    out <<= adders.cla_adder(in1, in2)

    pyrtl.synthesize()
    pyrtl.optimize()
开发者ID:Gamrix,项目名称:PyRTL-Scripts,代码行数:7,代码来源:exampleGraph.py


示例2: make_example_graph

def make_example_graph():
    in1, in2 = pyrtl.Input(8, 'in1'), pyrtl.Input(8, 'in2')
    out = pyrtl.Output(9, 'output')
    out <<= adders.kogge_stone(in1, in2)

    pyrtl.synthesize()
    pyrtl.optimize()
开发者ID:Gamrix,项目名称:PyRTL-Scripts,代码行数:7,代码来源:exampleGraph.py


示例3: test_function_RomBlock_with_optimization

    def test_function_RomBlock_with_optimization(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]

        pyrtl.synthesize()
        pyrtl.optimize()
        # build the actual simulation environment
        self.sim_trace = pyrtl.SimulationTrace()
        self.sim = self.sim(tracer=self.sim_trace)

        input_signals = {}
        for i in range(0, 5):
            input_signals[i] = {self.read_addr1: i, self.read_addr2: 2*i}
            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) - 1),
        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:UCSBarchlab,项目名称:PyRTL,代码行数:34,代码来源:test_simulation.py


示例4: test_longer_wires

 def test_longer_wires(self):
     a = pyrtl.Input(3, 'a')
     b = pyrtl.Input(2, 'b')
     out = pyrtl.Output(name='out')
     out <<= a + b
     pyrtl.synthesize()
     self.assertTrue(simulators.circuit_equivalence(lambda i, j: i + j, in_wires=(a, b)))
开发者ID:Gamrix,项目名称:PyRTL-Scripts,代码行数:7,代码来源:test_simulators.py


示例5: check_trace

 def check_trace(self, correct_string):
     pyrtl.synthesize()
     sim_trace = pyrtl.SimulationTrace()
     sim = pyrtl.Simulation(tracer=sim_trace)
     for i in range(8):
         sim.step({})
     output = io.StringIO()
     sim_trace.print_trace(output)
     self.assertEqual(output.getvalue(), correct_string)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:9,代码来源:test_passes.py


示例6: check_op

 def check_op(self, op):
     ina, inb = pyrtl.Input(bitwidth=4, name='a'), pyrtl.Input(bitwidth=4, name='b')
     self.output <<= op(ina, inb)
     pyrtl.synthesize()
     sim_trace = pyrtl.SimulationTrace()
     sim = pyrtl.Simulation(tracer=sim_trace)
     for a in range(16):
         for b in range(16):
             sim.step({'a': a, 'b': b})
     result = sim_trace.trace['r']
     self.assertEqual(result, [op(a, b) for a in range(16) for b in range(16)])
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:11,代码来源:test_passes.py


示例7: test_single_mul

 def test_single_mul(self):
     ina, inb = pyrtl.Input(bitwidth=4, name='a'), pyrtl.Input(bitwidth=4, name='b')
     self.output <<= ina * inb
     pyrtl.synthesize()
     sim_trace = pyrtl.SimulationTrace()
     sim = pyrtl.Simulation(tracer=sim_trace)
     for a in range(16):
         for b in range(16):
             sim.step({'a': a, 'b': b})
     result = sim_trace.trace['r']
     self.assertEqual(result, [a*b for a in range(16) for b in range(16)])
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:11,代码来源:test_passes.py


示例8: test_wire_net_removal_1

    def test_wire_net_removal_1(self):
        inwire = pyrtl.Input(bitwidth=3)
        tempwire = pyrtl.WireVector()
        outwire = pyrtl.Output()
        tempwire <<= inwire
        outwire <<= tempwire

        pyrtl.synthesize()
        pyrtl.optimize()
        block = pyrtl.working_block(None)
        # should remove the middle wire but keep the input
        self.assertEqual(len(block.logic), 5)
        self.assertEqual(len(block.wirevector_set), 6)
开发者ID:LinChai,项目名称:PyRTL,代码行数:13,代码来源:test_passes.py


示例9: test_wire_net_removal_1

    def test_wire_net_removal_1(self):
        inwire = pyrtl.Input(bitwidth=3)
        tempwire = pyrtl.WireVector()
        outwire = pyrtl.Output()
        tempwire <<= inwire
        outwire <<= tempwire

        pyrtl.synthesize()
        pyrtl.optimize()
        block = pyrtl.working_block()
        # should remove the middle wire but keep the input
        self.assert_num_net(5, block)
        self.assert_num_wires(6, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:13,代码来源:test_passes.py


示例10: test_basic_one_var_op_1

    def test_basic_one_var_op_1(self):
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()

        outwire <<= ~constwire
        pyrtl.synthesize()
        pyrtl.optimize()

        block = pyrtl.working_block()
        self.num_net_of_type('~', 0, block)
        self.num_net_of_type('w', 1, block)
        self.assertEqual(len(block.logic), 1)
        self.assertEqual(len(block.wirevector_set), 2)
        self.num_wire_of_type(Const, 1, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:14,代码来源:test_passes.py


示例11: test_chained_mul

 def test_chained_mul(self):
     ina, inb, inc = (
         pyrtl.Input(bitwidth=2, name='a'),
         pyrtl.Input(bitwidth=2, name='b'),
         pyrtl.Input(bitwidth=2, name='c'))
     self.output <<= ina * inb * inc
     pyrtl.synthesize()
     sim_trace = pyrtl.SimulationTrace()
     sim = pyrtl.Simulation(tracer=sim_trace)
     for a in range(4):
         for b in range(4):
             for c in range(4):
                 sim.step({'a': a, 'b': b, 'c': c})
     result = sim_trace.trace['r']
     self.assertEqual(result, [a*b*c for a in range(4) for b in range(4) for c in range(4)])
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:15,代码来源:test_passes.py


示例12: test_timing_error

    def test_timing_error(self):
        inwire, inwire2 = pyrtl.Input(bitwidth=1), pyrtl.Input(bitwidth=1)
        tempwire, tempwire2 = pyrtl.WireVector(1), pyrtl.WireVector(1)
        outwire = pyrtl.Output()

        tempwire <<= ~(inwire & tempwire2)
        tempwire2 <<= ~(inwire2 & tempwire)
        outwire <<= tempwire

        with self.assertRaises(pyrtl.PyrtlError):
            pyrtl.synthesize()
            pyrtl.optimize()
            block = pyrtl.working_block()
            timing = estimate.TimingAnalysis(block)
            timing_max_length = timing.max_length()
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:15,代码来源:test_passes.py


示例13: test_basic_two_var_op_1

    def test_basic_two_var_op_1(self):
        inwire = pyrtl.Input(bitwidth=1)
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()

        outwire <<= inwire & constwire
        pyrtl.synthesize()
        pyrtl.optimize()
        # should remove the and block and replace it with a
        # wire net (to separate the const from the output)
        block = pyrtl.working_block(None)
        self.num_net_of_type('&', 0, block)
        self.num_net_of_type('w', 1, block)
        self.assert_num_net(1, block)
        self.assert_num_wires(3, block)
        self.num_wire_of_type(Const, 1, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:16,代码来源:test_passes.py


示例14: test_basic_two_var_op_3

    def test_basic_two_var_op_3(self):
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()

        # playing with edge cases
        outwire <<= constwire ^ constwire
        pyrtl.synthesize()
        pyrtl.optimize()
        # should remove the and block and replace it with a
        # wirevector (to separate the input from the output)
        block = pyrtl.working_block(None)
        self.num_net_of_type('^', 0, block)
        self.num_net_of_type('w', 1, block)
        self.assert_num_net(1, block)
        self.assert_num_wires(2, block)
        self.num_wire_of_type(Const, 1, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:16,代码来源:test_passes.py


示例15: test_const_folding_basic_two_var_op_1

    def test_const_folding_basic_two_var_op_1(self):
        inwire = pyrtl.Input(bitwidth=1)
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()

        outwire <<= inwire & constwire
        pyrtl.synthesize()
        pyrtl.optimize()
        # should remove the or block and replace it with a
        # wire net (to separate the const from the output)
        block = pyrtl.working_block(None)
        self.assertEqual(self.num_net_of_type('&', block), 0)
        self.assertEqual(self.num_net_of_type('w', block), 1)
        self.assertEqual(len(block.logic), 2)
        self.assertEqual(len(block.wirevector_set), 4)
        self.assertEqual(self.num_wire_of_type(pyrtl.wire.Const, block), 1)
开发者ID:LinChai,项目名称:PyRTL,代码行数:16,代码来源:test_passes.py


示例16: test_const_folding_basic_two_var_op_3

    def test_const_folding_basic_two_var_op_3(self):
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()

        # playing with edge cases
        outwire <<= constwire ^ constwire
        pyrtl.synthesize()
        pyrtl.optimize()
        # should remove the and block and replace it with a
        # wirevector (to separate the input from the output)
        block = pyrtl.working_block(None)
        self.assertEqual(self.num_net_of_type('|', block), 0)
        self.assertEqual(self.num_net_of_type('w', block), 1)
        self.assertEqual(len(block.logic), 1)
        self.assertEqual(len(block.wirevector_set), 2)
        self.assertEqual(self.num_wire_of_type(pyrtl.wire.Const, block), 1)
开发者ID:LinChai,项目名称:PyRTL,代码行数:16,代码来源:test_passes.py


示例17: test_synth_simple_memblock

    def test_synth_simple_memblock(self):
        pyrtl.synthesize()
        pyrtl.optimize()
        self.sim_trace = pyrtl.SimulationTrace()
        sim = self.sim(tracer=self.sim_trace)
        input_signals = [[0, 1, 4, 5],
                         [4, 1, 0, 5],
                         [0, 4, 1, 6],
                         [1, 1, 0, 0],
                         [6, 0, 6, 7]]
        for signals in input_signals:
            sim.step({self.read_addr1: signals[0], self.read_addr2: signals[1],
                      self.write_addr: signals[2], self.write_data: signals[3]})

        output = six.StringIO()
        self.sim_trace.print_trace(output, compact=True)
        self.assertEqual(output.getvalue(), 'o1 05560\no2 00560\n')
开发者ID:UCSBarchlab,项目名称:PyRTL,代码行数:17,代码来源:test_simulation.py


示例18: test_two_var_op_produce_not

    def test_two_var_op_produce_not(self):
        constwire = pyrtl.Const(1, 1)
        inwire = pyrtl.Input(bitwidth=1)
        outwire = pyrtl.Output()

        # playing with edge cases
        outwire <<= constwire ^ inwire
        pyrtl.synthesize()
        pyrtl.optimize()
        # should remove the and block and replace it with a
        # wirevector (to separate the input from the output)
        block = pyrtl.working_block(None)
        self.num_net_of_type('~', 1, block)
        self.num_net_of_type('w', 1, block)
        self.num_net_of_type('s', 1, block)  # due to synthesis
        self.assert_num_net(3, block)
        self.assert_num_wires(4, block)
        self.num_wire_of_type(Const, 0, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:18,代码来源:test_passes.py


示例19: test_adv_one_var_op_1

    def test_adv_one_var_op_1(self):
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()
        tempwire = pyrtl.WireVector()
        reg = pyrtl.Register(1, 'test register')

        tempwire <<= ~constwire
        reg.next <<= tempwire
        outwire <<= reg
        pyrtl.synthesize()
        pyrtl.optimize()

        block = pyrtl.working_block(None)
        self.num_net_of_type('w', 1, block)
        self.assert_num_net(1, block)
        self.assert_num_wires(2, block)
        self.num_wire_of_type(Const, 1, block)
        self.num_wire_of_type(Output, 1, block)
开发者ID:faical-yannick-congo,项目名称:PyRTL,代码行数:18,代码来源:test_passes.py


示例20: test_const_folding_adv_one_var_op_1

    def test_const_folding_adv_one_var_op_1(self):
        constwire = pyrtl.Const(0, 1)
        outwire = pyrtl.Output()
        tempwire = pyrtl.WireVector()
        reg = pyrtl.Register(1, 'test register')

        tempwire <<= ~constwire
        reg.next <<= tempwire
        outwire <<= reg
        pyrtl.synthesize()
        pyrtl.optimize()

        block = pyrtl.working_block(None)
        self.assertEqual(self.num_net_of_type('w', block), 1)
        self.assertEqual(len(block.logic), 1)
        self.assertEqual(len(block.wirevector_set), 2)
        self.assertEqual(self.num_wire_of_type(pyrtl.wire.Const, block), 1)
        self.assertEqual(self.num_wire_of_type(pyrtl.wire.Output, block), 1)
开发者ID:LinChai,项目名称:PyRTL,代码行数:18,代码来源:test_passes.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pyrtl.working_block函数代码示例发布时间:2022-05-27
下一篇:
Python pyrtl.reset_working_block函数代码示例发布时间: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