1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from cocotb.types import LogicArray
from cocotb.types import Range
r = Range(-2, 3)
print('r.left, r.right, len(r) : ', r.left, r.right, len(r))
print('r : ', r)
print('r : ', end=' ')
for i in r:
print(i, end=' ')
print()
s = Range(8, 'downto', 1)
print('s.left, s.right, len(s) : ', s.left, s.right, len(s))
print('s : ', s)
print('s : ', end=' ')
for i in s:
print(i, end=' ')
print()
la = LogicArray(-4, Range(0, "to", 3))
la = LogicArray(-4, Range(3, "downto", 0))
print('la : ', la)
print('la : ', end=' ')
for i in la:
print(i, end=' ')
print()
la = LogicArray('x10z', Range(-2, 'to', 1))
print("la[-2], la[-1], la[0], la[1] : ", la[-2], la[-1], la[0], la[1])
|