-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandshaking_busy.txt
49 lines (46 loc) · 1.27 KB
/
handshaking_busy.txt
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# To add a busy into AXI
# handshaking, you AND the upstream READY !BUSY, and AND the
# downstream valid with !BUSY
>>> ready_prev = []
>>> for ready in range(2):
... for busy in range(2):
... ready_prev.append(
{"ready_prev": ready & ~busy, "ready": ready, "busy": busy}
)
...
>>> for item in ready_prev:
... print(item)
...
{'ready_prev': 0, 'ready': 0, 'busy': 0}
{'ready_prev': 0, 'ready': 0, 'busy': 1}
{'ready_prev': 1, 'ready': 1, 'busy': 0}
{'ready_prev': 0, 'ready': 1, 'busy': 1}
>>> valid_next = []
>>> for valid in range(2):
... for busy in range(2):
... valid_next.append(
{"valid_next": valid & ~busy, "valid": valid, "busy": busy}
)
...
>>> for item in valid_next:
... print(item)
...
{'valid_next': 0, 'valid': 0, 'busy': 0}
{'valid_next': 0, 'valid': 0, 'busy': 1}
{'valid_next': 1, 'valid': 1, 'busy': 0}
{'valid_next': 0, 'valid': 1, 'busy': 1}
# Old stuff, not working:
#>>> ready_prev = []
#>>> for ready in range(2):
#... for busy in range(2):
#... ready_prev.append(
# {"ready_prev": ready | busy, "ready": ready, "busy": busy}
#)
#...
#>>> for item in ready_prev:
#... print(item)
#...
#{'ready_prev': 0, 'ready': 0, 'busy': 0}
#{'ready_prev': 1, 'ready': 0, 'busy': 1}
#{'ready_prev': 1, 'ready': 1, 'busy': 0}
#{'ready_prev': 1, 'ready': 1, 'busy': 1}