From 3bf7c21c4812316bde7a6e598c174e346536dd4c Mon Sep 17 00:00:00 2001 From: alexmadison Date: Sun, 10 Apr 2022 18:18:11 +0200 Subject: [PATCH] adding sigbufs --- dataflow_neuro/coders.act | 92 +++++++++++++++------------------------ 1 file changed, 36 insertions(+), 56 deletions(-) diff --git a/dataflow_neuro/coders.act b/dataflow_neuro/coders.act index 9af8b63..85d8e49 100644 --- a/dataflow_neuro/coders.act +++ b/dataflow_neuro/coders.act @@ -91,15 +91,16 @@ defproc decoder_dualrail (Mx1of2 in; bool? out[N]; power supply) { * Be careful of out[] indexing. */ export template -defproc decoder_dualrail_x(Mx1of2 in; bool? out[N*OUT_STRENGTH]; power supply) { +defproc decoder_dualrail_x(Mx1of2 in; bool? out[N]; power supply) { decoder_dualrail decoder(.in = in, .supply = supply); sigbuf sb[N]; (i:N: sb[i].in = decoder.out[i]; sb[i].supply = supply; - (j:OUT_STRENGTH: - sb[i].out[j] = out[j + i*OUT_STRENGTH]; - ) + sb[i].out[0] = out[i]; + // (j:OUT_STRENGTH: + // sb[i].out[j] = out[j + i*OUT_STRENGTH]; + // ) ) } @@ -126,40 +127,6 @@ defproc decoder_dualrail_en(Mx1of2 in; bool? en, out[N]; power supply) { } -/** - * Dualrail decoder with on/off switch. - * Outputs are buffered. - */ -// export template -// defproc decoder_dualrail_en_x(Mx1of2 in; bool? en, out[N]; power supply) { -// decoder_dualrail decoder(.in = in, .supply = supply); - -// sigbuf sb_en(.in = en, .supply = supply); -// sigbuf sb[N]; -// AND2_X1 en_ands[N]; -// (i:N: -// en_ands[i].a = decoder.out[i]; -// en_ands[i].b = sb_en.out[i]; - -// en_ands[i].vdd = supply.vdd; -// en_ands[i].vss = supply.vss; - -// sb[i].in = en_ands[i].y; -// sb[i].supply = supply; - -// // (j:OUT_STRENGTH: -// // sb[i].out[j] = out[j + i*OUT_STRENGTH]; -// // ) - -// sb[i].out[0] = out[i]; - -// ) - -// } - - - - /** @@ -242,6 +209,9 @@ defproc and_grid(bool! out[Nx*Ny]; bool? inx[Nx], iny[Ny]; power supply) { export template defproc decoder_2d_hs (avMx1of2 in; a1of1 out[Nx*Ny]; bool? reset_B; power supply) { + bool _reset_BX[Nx]; + sigbuf reset_sb(.in = reset_B, .out = _reset_BX, .supply = supply); + // Buffer to recieve concat(x,y) address packet buffer addr_buf(.in = in, .reset_B = reset_B, .supply = supply); @@ -303,7 +273,7 @@ defproc decoder_2d_hs (avMx1of2 in; a1of1 out[Nx*Ny]; bool? reset_B; po pu[i].vdd = supply.vdd; pu[i].vss = supply.vss; - pu_reset[i].a = reset_B; + pu_reset[i].a = _reset_BX[i]; pu_reset[i].y = _out_acksB[i]; pu_reset[i].vdd = supply.vdd; pu_reset[i].vss = supply.vss; @@ -345,6 +315,9 @@ export template defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg[N_dly_cfg], hs_en, reset_B; power supply) { + bool _reset_BX[Nx]; + sigbuf reset_sb(.in = reset_B, .out = _reset_BX, .supply = supply); + bool hs_enB; INV_X4 hs_inv(.a = hs_en, .y = hs_enB, .vdd = supply.vdd, .vss = supply.vss); @@ -358,6 +331,7 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg (i:0..NyC-1:d_dr_y.in.d[i] = addr_buf.out.d.d[i+NxC];) // sig buf for reqx lines, since they go to synapse pull down gates. + // Signals to the and-grid are buffered therein. sigbuf d_dr_xX[Nx]; (i:Nx: d_dr_xX[i].in = d_dr_x.out[i]; @@ -410,7 +384,7 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg pu[i].vdd = supply.vdd; pu[i].vss = supply.vss; - pu_reset[i].a = reset_B; + pu_reset[i].a = _reset_BX[i]; pu_reset[i].y = _out_acksB[i]; pu_reset[i].vdd = supply.vdd; pu_reset[i].vss = supply.vss; @@ -570,10 +544,15 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg (i:Nc:ors_t[i].supply = supply; ors_t[i].out = out.d[i].t;) (i:Nc:ors_f[i].supply = supply; ors_f[i].out = out.d[i].f;) + bool _inX[N]; + sigbuf_boolarray sb_in(.in = in, .out = _inX, .supply = supply); + pint num_connected_t; // Number of guys already connected to the current OR tree pint num_connected_f; - TIELO_X1 tielo(.vdd = supply.vdd, .vss = supply.vss); // I'm sorry + TIELO_X1 tielo[Nc]; // I'm sorry + (i:Nc:tielo[i].vdd = supply.vdd; tielo[i].vss = supply.vss;) + pint bitval; (i:0..Nc-1: // For each output line num_connected_t = 0; @@ -581,16 +560,16 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg (j:0.. _N-1: bitval = (j & ( 1 << i )) >> i; // Get binary digit of integer j, column i [bitval = 1 & j <= N-1-> - ors_t[i].in[num_connected_t] = in[j]; + ors_t[i].in[num_connected_t] = _inX[j]; num_connected_t = num_connected_t + 1; [] bitval = 0 & j <= N-1-> - ors_f[i].in[num_connected_f] = in[j]; + ors_f[i].in[num_connected_f] = _inX[j]; num_connected_f = num_connected_f + 1; [] bitval = 1 & j > N-1-> - ors_t[i].in[num_connected_t] = tielo.y; + ors_t[i].in[num_connected_t] = tielo[i].y; num_connected_t = num_connected_t + 1; [] bitval = 0 & j > N-1-> - ors_f[i].in[num_connected_f] = tielo.y; + ors_f[i].in[num_connected_f] = tielo[i].y; num_connected_f = num_connected_f + 1; ] @@ -604,11 +583,11 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg - /** - * Buffer function code. - * Is the function block ripped from the buffer_s. - * Used in the encoder2d. - */ + /** + * Buffer function code. + * Is the function block ripped from the buffer_s. + * Used in the encoder2d. + */ export template defproc buffer_s_func (Mx1of2 in; avMx1of2 out; bool? in_v, en, reset_B; power supply) { //function @@ -619,9 +598,9 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg A_2C2N_RB_X4 t_buf_func[N]; // reset buffers - bool _reset_BX,_reset_BXX[N]; + bool _reset_BX,_reset_BXX[N*2]; BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss); - sigbuf reset_bufarray(.in=_reset_BX, .out=_reset_BXX, .supply=supply); + sigbuf reset_bufarray(.in=_reset_BX, .out=_reset_BXX, .supply=supply); // Enable signal buffers sigbuf en_buf_t(.in=en, .out=_en_X_t, .supply=supply); @@ -654,8 +633,8 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg t_buf_func[i].vss=supply.vss; t_buf_func[i].pr_B = _reset_BXX[i]; t_buf_func[i].sr_B = _reset_BXX[i]; - f_buf_func[i].pr_B = _reset_BXX[i]; - f_buf_func[i].sr_B = _reset_BXX[i]; + f_buf_func[i].pr_B = _reset_BXX[i+N]; + f_buf_func[i].sr_B = _reset_BXX[i+N]; ) } @@ -665,9 +644,10 @@ defproc decoder_2d_hybrid (avMx1of2 in; a1of1 out[Nx*Ny]; bool? dly_cfg defproc encoder2d(a1of1 inx[Nx]; a1of1 iny[Ny]; avMx1of2<(NxC + NyC)> out; power supply; bool reset_B) { // Reset buffers pint H = 2*(NxC + NyC); //Reset strength? to be investigated + bool _reset_BX,_reset_BXX[H]; - BUF_X4 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss); - sigbuf<2*(NxC + NyC)> reset_bufarray(.in=_reset_BX, .out=_reset_BXX,.supply=supply); + BUF_X4 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss); + sigbuf<2*(NxC + NyC)> reset_bufarray(.in=_reset_BX, .out=_reset_BXX,.supply=supply); // Arbiters a1of1 _arb_out_x, _arb_out_y;