Project-Bonfire / Bonfire_legacy

A Fault Tolerant NoC Architecture
GNU General Public License v3.0
7 stars 8 forks source link

arbiter_in and arbiter_out are almost identical #23

Open AlexDaniel opened 7 years ago

AlexDaniel commented 7 years ago

Took a while to realize, but it finally came to me when I was looking at the tests…

Part arbiter_out arbiter_in
Requests X_N_Y, X_E_Y, X_W_Y, X_S_Y, X_L_Y | req_X_N, req_X_E, req_X_W, req_X_S, req_X_L
Grants grant_Y_N, grant_Y_E, grant_Y_W, grant_Y_S, grant_Y_L | X_N, X_E, X_W, X_S, X_L
States IDLE, North, East, West, South, Local | IDLE, North, East, West, South, Local
Credit input credit Always 1 (constant)
? “Default” state IDLE Same as before (sticky)
Grant is given When preserving the state Always (unless no requests)

So everything except last two points can be done with arbiter_out, and of course last two points can be implemented in arbiter_out using parameterization. In fact, I'm not sure if the default state matters at all, but I don't understand that part of the behavior fully.

I think arbiter_in should be removed and arbiter_out can be renamed to just arbiter.

Somewhat related issue: #12

AlexDaniel commented 7 years ago

Oh, another option would be to reuse just the state machine (and keep two different modules), but that would still leave us with copy-pasted unit tests (or worse, a parameterizable test bench…).