mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
bin spec and usage
This commit is contained in:
parent
2abe0c675a
commit
e4e0389375
@ -25,7 +25,7 @@ def testBench(width):
|
||||
for i in range(2**width):
|
||||
B.next = intbv(i)
|
||||
yield delay(10)
|
||||
print "B: %s | G: %s" % (bin(B.val, width), bin(G.val, width))
|
||||
print "B: " + bin(B.val, width) + "| G: " + bin(G.val, width)
|
||||
|
||||
return (dut, stimulus())
|
||||
|
||||
|
@ -77,5 +77,9 @@ separate type.
|
||||
addition, literal bit strings are accepted in concatenations, just as
|
||||
they are in intbv constructors.
|
||||
|
||||
* intbv has a bin(width) method that returns a binary string
|
||||
representation. The optional width specifies the desired string
|
||||
width: padding of the sign-bit is used.
|
||||
|
||||
* intbv supports the iterator protocol to iterate on its bits; again,
|
||||
this requires a known length.
|
||||
|
Loading…
x
Reference in New Issue
Block a user