Trapped in this problem for several days, I feel I can't think of a proper solution on myself. The problem is as below.
Say, a source-input is streaming a sequence of A
, denoted by A0
, A1
, A2
, ..., Ai
, ..., An
.
Now I'd like to do some action on A
, denoted by B_{i+1} = act_on(Ai, Op(Bi) )
, e.g.
B2 = act_on(A1, Op(B1) )
B3 = act_on(A2, Op(B2) )
B4 = act_on(A3, Op(B3) )
....
But neither act_on()
nor Op()
can be done in a single clock of A
.
I've tried to pipeline A
and B
, but it failed. Take an example as explanation: Suppose A0_at_stage_3
and Op(B0)_at_stage_2
are pipelined for act_on()
at Clock T, and thus B1
can be obtained. It is fine. But unluckily, at Clock T+1, we cannot use Op(B1)_at_stage_2
as what we just do at Clock T, because B1
is not ready yet when calculating Op(B1)
or Op(B1)_at_stage_1
(which should be done at Clock T-2 and T-1).
This problem really confused me much. What is the correct way to solve it? Thank you very much.
Edit
For my particular case, B
actually stands for three lookup tables and an index, say list_1
, list_2
, list_3
, and idx
, which are all possibly expected to be dynamically updated by act_on()
. That means, e.g. act_on() may update list_1[2]
, list_2[4]
, list_3[6]
, none of them or all of them, depending on its result.
The Op(B)
is cross-looking-up operations between these tables, such as idx2 = list_1[idx]
, idx3 = list_2[idx3]
, idx4 = list_3[idx3]
.
The difficulty I met with is that after act_on()
updating these tables, the pipelined tables would immediately become out-of-date. But if using a chain looking-up like list_3[ list_2[ list_1[ 6 ] ] ]
in a single clock, the time performance could be very bad (I didn't try but just to imagine). Is it possible to have a workaround? Thank you.