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

Python _always_comb.always_comb函数代码示例

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

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



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

示例1: testArgIsNormalFunction

 def testArgIsNormalFunction(self):
     def h():
         yield None
     try:
         always_comb(h)
     except AlwaysCombError, e:
         self.assertEqual(e.kind, _error.ArgType)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:7,代码来源:test_always_comb.py


示例2: testArgHasNoArgs

 def testArgHasNoArgs(self):
     def h(n):
         return n
     try:
         always_comb(h)
     except AlwaysCombError, e:
         self.assertEqual(e.kind, _error.NrOfArgs)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:7,代码来源:test_always_comb.py


示例3: testArgIsFunction

 def testArgIsFunction(self):
     h = 5
     try:
         always_comb(h)
     except AlwaysCombError as e:
         self.assertEqual(e.kind, _error.ArgType)
     else:
         self.fail()
开发者ID:Cadavis8,项目名称:myhdl,代码行数:8,代码来源:test_always_comb.py


示例4: testInfer6

    def testInfer6(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next = a
            x.next = c
        with raises_kind(AlwaysCombError, _error.SignalAsInout % set('c')):
            g = always_comb(h).gen
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:8,代码来源:test_always_comb.py


示例5: testInfer9

 def testInfer9(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     def h():
         c.next[a-1] = x[b-1]
     g = always_comb(h).gen
     i = g.gi_frame.f_locals['self']
     expected = Set(['a', 'b', 'x'])
     self.assertEqual(i.inputs, expected)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:8,代码来源:test_always_comb.py


示例6: testInfer5

    def testInfer5(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next += 1
            a += 1
        with raises_kind(AlwaysCombError, _error.SignalAsInout % "c"):
            g = always_comb(h).gen
开发者ID:jmgc,项目名称:myhdl-numeric,代码行数:8,代码来源:test_always_comb.py


示例7: testInfer7

    def testInfer7(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next[a:0] = x[b:0]
        g = always_comb(h).gen
        i = g.gi_frame.f_locals['self']
        expected = set(['a', 'b', 'x'])
        assert i.inputs == expected
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:9,代码来源:test_always_comb.py


示例8: testInfer6

 def testInfer6(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     def h():
         c.next = a
         x.next = c
     try:
         g = always_comb(h).gen
     except AlwaysCombError, e:
         self.assertEqual(e.kind, _error.SignalAsInout)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:9,代码来源:test_always_comb.py


示例9: testInfer1

 def testInfer1(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     u = 1
     def h():
         c.next = a
         v = u
     g = always_comb(h).gen
     i = g.gi_frame.f_locals['self']
     expected = Set(['a'])
     self.assertEqual(i.inputs, expected)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:10,代码来源:test_always_comb.py


示例10: testInfer10

 def testInfer10(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     def f(x, y, z):
         return 0
     def h():
         c.next = f(a, 2*b, d*x)
     g = always_comb(h).gen
     i = g.gi_frame.f_locals['self']
     expected = Set(['a', 'b', 'd', 'x'])
     self.assertEqual(i.inputs, expected)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:10,代码来源:test_always_comb.py


示例11: testInfer8

 def testInfer8(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     u = 1
     def h():
         v = 2
         c.next[8:1+a+v] = x[4:b*3+u]
     g = always_comb(h).gen
     i = g.gi_frame.f_locals['self']
     expected = Set(['a', 'b', 'x'])
     self.assertEqual(i.inputs, expected)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:10,代码来源:test_always_comb.py


示例12: testInfer3

    def testInfer3(self):
        a, b, c, d = [Signal(0) for i in range(4)]
        u = 1

        def h():
            c.next = a + x + u
            a = 1
        g = always_comb(h).gen
        i = g.gi_frame.f_locals['self']
        expected = set(['x'])
        assert i.inputs == expected
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:11,代码来源:test_always_comb.py


示例13: testInfer5

 def testInfer5(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     def h():
         c.next += 1
         a += 1
     try:
         g = always_comb(h).gen
     except AlwaysCombError as e:
         self.assertEqual(e.kind, _error.SignalAsInout % "c")
     else:
         self.fail()
开发者ID:Cadavis8,项目名称:myhdl,代码行数:11,代码来源:test_always_comb.py


示例14: testEmbeddedFunction

    def testEmbeddedFunction(self):
        a, b, c, d = [Signal(0) for i in range(4)]
        u = 1

        def h():
            def g():
                e = b
                return e
            c.next = x
            g = a
        with raises_kind(AlwaysCombError, _error.EmbeddedFunction):
            g = always_comb(h)
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:12,代码来源:test_always_comb.py


示例15: testEmbeddedFunction

 def testEmbeddedFunction(self):
     a, b, c, d = [Signal(0) for i in range(4)]
     u = 1
     def h():
         def g():
             e = b
             return e
         c.next = x
         g = a
     try:
         g = always_comb(h)
     except AlwaysCombError, e:
         self.assertEqual(e.kind, _error.EmbeddedFunction)
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:13,代码来源:test_always_comb.py


示例16: bench

    def bench(self, function):

        clk = Signal(0)
        a = Signal(0)
        b = Signal(0)
        c = Signal(0)
        d = Signal(0)
        z = Signal(0)
        vectors = [intbv(j) for i in range(32) for j in range(16)]
        random.shuffle(vectors)

        
        def combFunc():
            if __debug__:
                f = x
            x.next = function(a, b, c, d)

        comb = always_comb(combFunc)

        def clkGen():
            while 1:
                yield delay(10)
                clk.next ^= 1

        def logic():
            while 1:
                z.next = function(a, b, c, d)
                yield a, b, c, d

        def stimulus():
            for v in vectors:
                a.next = v[0]
                b.next = v[1]
                c.next = v[2]
                d.next = v[3]
                yield clk.posedge
                yield clk.negedge
                self.assertEqual(x, z)
            raise StopSimulation, "always_comb simulation test"

        return instances()
开发者ID:BackupTheBerlios,项目名称:osocgen-svn,代码行数:41,代码来源:test_always_comb.py


示例17: testArgIsFunction

 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:4,代码来源:test_always_comb.py


示例18: testArgIsNormalFunction

 def testArgIsNormalFunction(self):
     def h():
         yield None
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:5,代码来源:test_always_comb.py


示例19: testArgHasNoArgs

 def testArgHasNoArgs(self):
     def h(n):
         return n
     with raises_kind(AlwaysCombError, _error.NrOfArgs):
         always_comb(h)
开发者ID:Aravind-Suresh,项目名称:myhdl,代码行数:5,代码来源:test_always_comb.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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