Compare commits
3 Commits
382714d11e
...
a4889ae844
Author | SHA1 | Date | |
---|---|---|---|
|
a4889ae844 | ||
|
d64afd8c50 | ||
|
ba096bf6b2 |
@ -226,9 +226,14 @@ 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)
|
||||
{
|
||||
template<pint N, pint M,pint address_size, pint ACK_STRENGTH>
|
||||
defproc encoder2D(a1of1 x[N]; a1of1 y[M] ;avMx1of2<address_size> addr; power supply; bool reset_B) {
|
||||
// Reset buffers
|
||||
bool _reset_BX,_reset_BXX[H];
|
||||
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
sigbuf<2*address_size+3> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
|
||||
|
||||
|
||||
// Arbiters
|
||||
a1of1 _out_arb_x,_out_arb_y;
|
||||
a1of1 _x_temp[N];
|
||||
@ -241,6 +246,7 @@ namespace tmpl {
|
||||
arbtree<N> Xarb(.in = _x_temp,.out = _out_arb_X,.supply = supply);
|
||||
arbtree<M> Yarb(.in = _y_temp,.out = _out_arb_Y,.supply = supply);
|
||||
|
||||
// Sigbufs for strong ackowledge signals (note that the sigbuf needs to be changed)
|
||||
sigbuf<ACK_STRENGTH> x_ack_arb[N];
|
||||
sigbuf<ACK_STRENGTH> y_ack_arb[M];
|
||||
(i:N:
|
||||
@ -254,6 +260,100 @@ namespace tmpl {
|
||||
y_ack_arb[i].supply = supply;
|
||||
)
|
||||
|
||||
// This block checks that the input is valid and that the arbiter made a choice
|
||||
// Then activates the ack of the arbiter
|
||||
bool _x_v,_in_x_v;
|
||||
A_2C2P_RB_X1 Y_ack_confirm();
|
||||
Y_ack_confirm.p1 = _x_v;
|
||||
Y_ack_confirm.p2 =_in_x_v;
|
||||
Y_ack_confirm.c1 = _out_arb_Y.r;
|
||||
Y_ack_confirm.c2 = _x_a_B;
|
||||
Y_ack_confirm.y = _out_arb_Y.a;
|
||||
Y_ack_confirm.vdd = supply.vdd;
|
||||
Y_ack_confirm.vss = supply.vss;
|
||||
Y_ack_confirm.reset_B = _reset_BXX[0];
|
||||
|
||||
// This block checks that the input is valid and that the arbiter made a choice
|
||||
// Then activates the ack of the arbiter
|
||||
A_2C_RB X_ack_confirm();
|
||||
X_ack_confirm.c1 = _out_arb_X.r;
|
||||
X_ack_confirm.c2 = _x_a_B;
|
||||
X_ack_confirm.vdd = supply.vdd;
|
||||
X_ack_confirm.vss = supply.vss;
|
||||
X_ack_confirm.reset_B = _reset_BXX[1];
|
||||
|
||||
//X_REQ validation
|
||||
bool _x_req_array[N],_x_v,_x_v_B;
|
||||
(i:N:_x_req_array[i] = x[i].r;)
|
||||
ortree x_req_ortree(.in = _x_req_array,.out = _x_v,.supply = supply);
|
||||
INV_X1 not_x_req_ortree(.in = _x_v,.out = _x_v_B);
|
||||
|
||||
//
|
||||
A_2P3P1C2N_RB_X4 x_ack();
|
||||
//branch1
|
||||
x_ack.p1 = _in_x_v;
|
||||
x_ack.p2 = _x_v_B;
|
||||
//branch2
|
||||
x_ack.p3 = _in_x_v;
|
||||
x_ack.p4 = _in_y_v;
|
||||
x_ack.p5 = _x_v;
|
||||
//
|
||||
x_ack.c1 = _en
|
||||
x_ack.n1 = addr.v
|
||||
x_ack.n2 = _in_x_v;
|
||||
//
|
||||
x_ack.y = _x_a;
|
||||
//
|
||||
x_ack.vdd = supply.vdd;
|
||||
x_ack.vss = supply.vss;
|
||||
x_ack.reset_B = _reset_BXX[2];
|
||||
|
||||
INV_X1 not_x_ack(.in = _x_a,.out = _x_a_B);
|
||||
|
||||
A_1C2P enabling(.p1 = addr.a, .p2 = addr.v, .c1 = _x_a, .y = _en, .vdd = supply.vdd, .vss = supply.vss)
|
||||
|
||||
avMx1of2<N> _in_x;
|
||||
dualrail<N> _in;
|
||||
_in_x.d = _in.d;
|
||||
_in_x.v = _in_x_v;
|
||||
|
||||
//buffer_func_s
|
||||
A_2C2N_RB buffer_func_s_f[address_size];
|
||||
A_2C2N_RB buffer_func_s_t[address_size];
|
||||
sigbuf<address_size> en_buf_t(.in=_en, .out=_en_X_t, .supply=supply);
|
||||
sigbuf<address_size> en_buf_f(.in=_en, .out=_en_X_f, .supply=supply);
|
||||
INV_X1 out_a_inv(.a=addr.a,.y=_out_a_B);
|
||||
sigbuf<address_size> out_a_B_buf_f(.in=_out_a_B,.out=_out_a_BX_t, .supply=supply);
|
||||
sigbuf<address_size> out_a_B_buf_t(.in=_out_a_B,.out=_out_a_BX_f, .supply=supply);
|
||||
|
||||
(i:address_size:
|
||||
buffer_func_s_f[i].c1 = _en_X_f[i];
|
||||
buffer_func_s_f[i].c2 = _out_a_BX_f[i];
|
||||
buffer_func_s_f[i].n1 = _in_x.d.d[i].f;
|
||||
buffer_func_s_f[i].n1 = _in_x.v;
|
||||
buffer_func_s_f[i].vdd=supply.vdd;
|
||||
buffer_func_s_f[i].vss=supply.vss;
|
||||
buffer_func_s_f[i].pr_B = _reset_BXX[i+3];
|
||||
buffer_func_s_f[i].sr_B = _reset_BXX[i+3];
|
||||
buffer_func_s_f[i].y = addr.d.d[i].f;
|
||||
|
||||
buffer_func_s_t[i].c1 = _en_X_r[i];
|
||||
buffer_func_s_t[i].c2 = _out_a_BX_t[i];
|
||||
buffer_func_s_t[i].n1 = _in_x.d.d[i].r;
|
||||
buffer_func_s_t[i].n1 = _in_x.v;
|
||||
buffer_func_s_t[i].vdd=supply.vdd;
|
||||
buffer_func_s_t[i].vss=supply.vss;
|
||||
buffer_func_s_t[i].pr_B = _reset_BXX[i+3+address_size];
|
||||
buffer_func_s_t[i].sr_B = _reset_BXX[i+3+address_size];
|
||||
buffer_func_s_t[i].y = addr.d.d[i].t;
|
||||
)
|
||||
bool _addr_v
|
||||
vtree addr_validity(.in = addr,.out = _addr_v);
|
||||
sigbuf<4> addr_validity_x(.in = _addr_v,.out = addr.v);
|
||||
addr_validity.supply = supply;
|
||||
addr_validity_x.supply = supply;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user