started encoder on the coders.act

This commit is contained in:
Michele 2022-03-03 15:10:31 +01:00
parent e53fc88054
commit 0e9f2ae506
1 changed files with 30 additions and 0 deletions

View File

@ -212,6 +212,36 @@ namespace tmpl {
} }
template<pint N, pint M, pint ACK_STRENGTH>
defproc encoder2D(a1of1 x[N]; a1of1 y[M] ;avMx1of2<X> addr; bool! out_a; power supply)
{
// Arbiters
a1of1 _out_arb_x,_out_arb_y;
a1of1 _x_temp[N];
(i:N:
_x_temp[i].r = x[i].r;
)
(i:M:
_y_temp[i].r = y[i].r;
)
arbtree<N> Xarb(.in = _x_temp,.out = _out_arb_X,.supply = supply);
arbtree<M> Yarb(.in = _y_temp,.out = _out_arb_Y,.supply = supply);
sigbuf<ACK_STRENGTH> x_ack_arb[N];
sigbuf<ACK_STRENGTH> y_ack_arb[M];
(i:N:
x_ack_arb[i].in = _x_temp[i].a;
x_ack_arb[i].out[0] = x[i].a;
x_ack_arb[i].supply = supply;
)
(i:M:
y_ack_arb[i].in = _y_temp[i].a;
y_ack_arb[i].out[0] = y[i].a;
y_ack_arb[i].supply = supply;
)
}