@@ -28,11 +28,9 @@ def __init__(self, depth):
28
28
self ._value = CSRStorage (aw + lw )
29
29
self ._we = CSR ()
30
30
self ._loop_prog_n = CSRStorage ()
31
- self ._index = CSRStatus (log2_int ( depth ) )
31
+ self ._loop_status = CSRStatus (32 )
32
32
self ._level = CSRStatus (log2_int (depth ))
33
- self ._loop = CSRStatus (16 )
34
33
self ._flush = CSR ()
35
-
36
34
self .irq = Signal ()
37
35
38
36
# # #
@@ -41,8 +39,8 @@ def __init__(self, depth):
41
39
value = self ._value .storage
42
40
we = self ._we .r & self ._we .re
43
41
loop_prog_n = self ._loop_prog_n .storage
44
- index = self ._index .status
45
- loop = self ._loop .status
42
+ loop_index = self ._loop_status .status [: log2_int ( depth )]
43
+ loop_count = self ._loop_status .status [ 16 :]
46
44
level = self ._level .status
47
45
flush = self ._flush .r & self ._flush .re
48
46
@@ -83,19 +81,19 @@ def __init__(self, depth):
83
81
source .length .eq (fifo .dout .length )
84
82
]
85
83
86
- # index
84
+ # loop_index, loop_count
87
85
# used by the software for synchronization in
88
86
# "loop" mode
89
87
self .sync += \
90
88
If (flush ,
91
- index .eq (0 ),
92
- loop .eq (0 ),
89
+ loop_index .eq (0 ),
90
+ loop_count .eq (0 ),
93
91
).Elif (source .stb & source .ack ,
94
92
If (fifo .dout .start ,
95
- index .eq (0 ),
96
- loop .eq (loop + 1 )
93
+ loop_index .eq (0 ),
94
+ loop_count .eq (loop_count + 1 )
97
95
).Else (
98
- index .eq (index + 1 )
96
+ loop_index .eq (loop_index + 1 )
99
97
)
100
98
)
101
99
0 commit comments