本文整理汇总了Python中myhdl._always_comb.always_comb函数的典型用法代码示例。如果您正苦于以下问题:Python always_comb函数的具体用法?Python always_comb怎么用?Python always_comb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了always_comb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testArgIsNormalFunction
def testArgIsNormalFunction(self):
def h():
yield None
try:
always_comb(h)
except AlwaysCombError, e:
self.assertEqual(e.kind, _error.ArgType)
示例2: testArgHasNoArgs
def testArgHasNoArgs(self):
def h(n):
return n
try:
always_comb(h)
except AlwaysCombError, e:
self.assertEqual(e.kind, _error.NrOfArgs)
示例3: testArgIsFunction
def testArgIsFunction(self):
h = 5
try:
always_comb(h)
except AlwaysCombError as e:
self.assertEqual(e.kind, _error.ArgType)
else:
self.fail()
示例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
示例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)
示例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
示例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
示例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)
示例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)
示例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)
示例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)
示例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
示例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()
示例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)
示例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)