From c30a46d6d843456e0823b5ef32de0cb5eba254b1 Mon Sep 17 00:00:00 2001 From: Michele Date: Fri, 4 Mar 2022 21:11:34 +0100 Subject: [PATCH] I think the encoder2D compiles now --- dataflow_neuro/coders.act | 67 +++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/dataflow_neuro/coders.act b/dataflow_neuro/coders.act index 922887f..205d695 100644 --- a/dataflow_neuro/coders.act +++ b/dataflow_neuro/coders.act @@ -284,67 +284,69 @@ namespace tmpl { } - template + export template defproc encoder2D(a1of1 x[N]; a1of1 y[M] ;avMx1of2 addr; power supply; bool reset_B) { // Reset buffers + pint H = 10; //Reset strength? to be investigated 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,.vdd=supply.vdd,.vss=supply.vss); + sigbuf<2*address_size+3> reset_bufarray(.in=_reset_BX, .out=_reset_BXX,.supply=supply); // Arbiters a1of1 _out_arb_x,_out_arb_y; - a1of1 _x_temp[N]; + a1of1 _x_temp[N],_y_temp[M]; (i:N: _x_temp[i].r = x[i].r; ) (i:M: _y_temp[i].r = y[i].r; ) - arbtree Xarb(.in = _x_temp,.out = _out_arb_X,.supply = supply); - arbtree Yarb(.in = _y_temp,.out = _out_arb_Y,.supply = supply); + arbtree Xarb(.in = _x_temp,.out = _out_arb_x,.supply = supply); + arbtree Yarb(.in = _y_temp,.out = _out_arb_y,.supply = supply); // Sigbufs for strong ackowledge signals sigbuf_1output x_ack_arb[N]; sigbuf_1output 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].out = 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].out = y[i].a; 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; + bool _x_v,_in_x_v,_in_y_v,_x_a_B,_x_a; 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.c1 = _out_arb_y.r; Y_ack_confirm.c2 = _x_a_B; - Y_ack_confirm.y = _out_arb_Y.a; + 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]; + Y_ack_confirm.reset_B = _reset_BX; // 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; + A_2C_RB_X1 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_ack_confirm.pr_B = _reset_BX; + X_ack_confirm.sr_B = _reset_BX; //X_REQ validation - bool _x_req_array[N],_x_v,_x_v_B; + bool _x_req_array[N],_x_v_B, _en; (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); + INV_X1 not_x_req_ortree(.a = _x_v,.y = _x_v_B); // A_1C3P2P2N_R_X1 x_ack(); // NEEDS BUFFERING TO X4 @@ -356,28 +358,31 @@ namespace tmpl { x_ack.p4 = _in_y_v; x_ack.p5 = _x_v; // - x_ack.c1 = _en - x_ack.n1 = addr.v + x_ack.c1 = _en; + x_ack.n1 = addr.v; x_ack.n2 = _in_x_v; // x_ack.y = _x_a_B; // x_ack.vdd = supply.vdd; x_ack.vss = supply.vss; - x_ack.reset_B = _reset_BXX[2]; + x_ack.pr_B = _reset_BX; + x_ack.sr_B = _reset_BX; - INV_X1 not_x_ack(.out = _x_a,.in = _x_a_B); + INV_X1 not_x_ack(.y = _x_a,.a = _x_a_B,.vdd = supply.vdd, .vss = supply.vss); - A_1C2P enabling(.p1 = addr.a, .p2 = addr.v, .c1 = _x_a, .y = _en, .vdd = supply.vdd, .vss = supply.vss) + A_1C2P_X1 enabling(.p1 = addr.a, .p2 = addr.v, .c1 = _x_a, .y = _en, .vdd = supply.vdd, .vss = supply.vss); - avMx1of2 _in_x; - dualrail _in; - _in_x.d = _in.d; + avMx1of2 _in_x; + dualrail _in[N]; + (i:N:_in_x.d.d[i] = _in[i];) _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]; + bool _en_X_t[address_size],_en_X_f[address_size],_out_a_BX_f[address_size],_out_a_BX_t[address_size]; + bool _out_a_B; + A_2C2N_RB_X1 buffer_func_s_f[address_size]; + A_2C2N_RB_X1 buffer_func_s_t[address_size]; sigbuf en_buf_t(.in=_en, .out=_en_X_t, .supply=supply); sigbuf en_buf_f(.in=_en, .out=_en_X_f, .supply=supply); INV_X1 out_a_inv(.a=addr.a,.y=_out_a_B); @@ -395,9 +400,9 @@ namespace tmpl { 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].c1 = _en_X_t[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.d.d[i].t; 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; @@ -405,8 +410,10 @@ namespace tmpl { 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); + bool _addr_v; + Mx1of2 addr_temp; + (i:address_size:addr_temp.d[i] = addr.d.d[i];) + vtree addr_validity(.in = addr_temp,.out = _addr_v); sigbuf_1output<4> addr_validity_x(.in = _addr_v,.out = addr.v); addr_validity.supply = supply; addr_validity_x.supply = supply;