From bb6318269453294619fee2b521b1a35f87aac390 Mon Sep 17 00:00:00 2001 From: alexmadison Date: Wed, 20 Apr 2022 19:21:55 +0200 Subject: [PATCH] disentangled neurons and pull downs --- dataflow_neuro/chips.act | 16 +++-- dataflow_neuro/coders.act | 143 ++++++++++++++++++-------------------- 2 files changed, 78 insertions(+), 81 deletions(-) diff --git a/dataflow_neuro/chips.act b/dataflow_neuro/chips.act index f03be1f..6555332 100644 --- a/dataflow_neuro/chips.act +++ b/dataflow_neuro/chips.act @@ -116,13 +116,16 @@ defproc texel_core (avMx1of2 in, out; // Neurons + encoder pint NC_NRN; NC_NRN = NC_NRN_X + NC_NRN_Y; - nrn_hs_2d_array nrn_grid(.in = neurons, + encoder2d_simple encoder( + .reset_B = _reset_BX, .supply = supply); + + // Neuron handshake circuits, to be removed for innovus + nrn_hs_2d_array nrn_grid(.in = neurons, + .outx = encoder.inx, .outy = encoder.iny, + .to_pd_x = encoder.to_pd_x, .to_pd_y = encoder.to_pd_y, .supply = supply, .reset_B = _reset_BX); - encoder2d_simple encoder( - .inx = nrn_grid.outx, - .iny = nrn_grid.outy, - .reset_B = _reset_BX, .supply = supply - ); + + fifo fifo_enc2mrg(.in = encoder.out, .reset_B = _reset_BX, .supply = supply); @@ -139,7 +142,6 @@ defproc texel_core (avMx1of2 in, out; .reset_B = _reset_BX, .supply = supply); - // Neuron/synapse monitor targeters pint NC_NRN_MON_X = std::ceil_log2(N_NRN_MON_X); pint NC_NRN_MON_Y = std::ceil_log2(N_NRN_MON_Y); diff --git a/dataflow_neuro/coders.act b/dataflow_neuro/coders.act index 1176f7b..35ce519 100644 --- a/dataflow_neuro/coders.act +++ b/dataflow_neuro/coders.act @@ -752,7 +752,7 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ export template - defproc encoder2d(a1of1 inx[Nx]; a1of1 iny[Ny]; avMx1of2<(NxC + NyC)> out; power supply; bool reset_B) { + 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 @@ -882,8 +882,20 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ } - export template + export + defproc nrn_line_end_pull_down (bool? in; bool? reset_B; power supply; bool! out) + { + INV_X1 inv(.a = reset_B, .vdd=supply.vdd,.vss =supply.vss); + + A_1N_U_X4 pull_down(.n1=in, .y=out); + A_1N_U_X4 pull_downR(.n1=inv.y, .y=out); + } + + + + export template defproc encoder2d_simple(a1of1 inx[Nx]; a1of1 iny[Ny]; avMx1of2<(NxC + NyC)> out; + a1of1 to_pd_x[Nx], to_pd_y[Ny]; // Ports for the line end pull downs to tap into power supply; bool reset_B) { bool _a_x, _a_y; @@ -933,6 +945,55 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ Yenc.out.d[i] = buf.in.d.d[i+NxC]; ) + + // Line pull down stuff + // Create delay fifos to emulate the fact that the line pull downs + // are at the end of the line, and thus slow. + // Note that if N_dly = 0, delay fifo is just a pipe. + delay_chain dly_x[Nx]; + delay_chain dly_y[Ny]; + + // Create x line req pull downs + nrn_line_end_pull_down pd_x[Nx]; + sigbuf rsb_pd_x(.in = reset_B, .supply = supply); + (i:0..Nx-1: + dly_x[i].supply = supply; + dly_x[i].in = to_pd_x[i].a; + pd_x[i].in = dly_x[i].out; + + pd_x[i].out = to_pd_x[i].r; + pd_x[i].reset_B = rsb_pd_x.out[i]; + pd_x[i].supply = supply; + ) + + // Create y line req pull downs + nrn_line_end_pull_down pd_y[Ny]; + sigbuf rsb_pd_y(.in = reset_B, .supply = supply); + (j:0..Ny-1: + dly_y[j].supply = supply; + dly_y[j].in = to_pd_y[j].a; + pd_y[j].in = dly_y[j].out; + + pd_y[j].out = to_pd_y[j].r; + pd_y[j].reset_B = rsb_pd_y.out[j]; + pd_y[j].supply = supply; + ) + + // Add keeps + KEEP keep_x[Nx]; + (i:Nx: + keep_x[i].vdd = supply.vdd; + keep_x[i].vss = supply.vss; + keep_x[i].y = inx[i].r; + ) + + KEEP keep_y[Ny]; + (j:Ny: + keep_y[j].vdd = supply.vdd; + keep_y[j].vss = supply.vss; + keep_y[j].y = iny[j].r; + ) + } export template @@ -1025,30 +1086,6 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ } - // export - // defproc nrn_line_end_pull_down (bool? in; bool? reset_B; power supply; bool! out) - // { - // bool _out, __out, nand_out; - // BUF_X1 buf1(.a=in, .y=_out, .vdd=supply.vdd,.vss=supply.vss); - // BUF_X1 buf2(.a=_out, .y=__out, .vdd=supply.vdd,.vss=supply.vss); - // INV_X1 inv(.a = __out, .vdd=supply.vdd,.vss =supply.vss); - - // NAND2_X1 aenor(.a=inv.y, .b=reset_B, .y = nand_out, .vdd=supply.vdd,.vss=supply.vss); - - // A_1N_U_X4 pull_down(.a=nand_out, .y=out); - // } - - export - defproc nrn_line_end_pull_down (bool? in; bool? reset_B; power supply; bool! out) - { - INV_X1 inv(.a = reset_B, .vdd=supply.vdd,.vss =supply.vss); - - A_1N_U_X4 pull_down(.n1=in, .y=out); - A_1N_U_X4 pull_downR(.n1=inv.y, .y=out); - } - - - /** * A 2d grid of neuron handshakers. * Should then slot into the encoder. @@ -1057,8 +1094,9 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ * for the purpose of running ACT sims. * It should probably be set to 0 though. */ - export template + export template defproc nrn_hs_2d_array(a1of1 in[Nx*Ny]; a1of1 outx[Nx], outy[Ny]; + a1of1 to_pd_x[Nx], to_pd_y[Ny]; power supply; bool reset_B) { // Make hella signal buffers @@ -1085,10 +1123,8 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ out_req_buf_y[i].a = _outy[i].r; out_req_buf_y[i].y = outy[i].r; ) + // Add buffers on output ack lines - // Note that this should be generalised. - // And probably won't even be done by ACT/innovus anwyay - // TODO: do it properly with sigbufs? BUF_X12 out_ack_buf_x[Nx]; (i:Nx: out_ack_buf_x[i].vss = supply.vss; @@ -1120,52 +1156,11 @@ defproc decoder_2d_hybrid (avMx1of2 in; bool! out_req_x[Nx], out_req_y[ ) ) - // Create delay fifos to emulate the fact that the line pull downs - // are at the end of the line, and thus slow. - // Note that if N_dly = 0, delay fifo is just a pipe. - delay_chain dly_x[Nx]; - delay_chain dly_y[Ny]; - - // Create x line req pull downs - nrn_line_end_pull_down pd_x[Nx]; - sigbuf rsb_pd_x(.in = reset_B, .supply = supply); - (i:0..Nx-1: - dly_x[i].supply = supply; - dly_x[i].in = _outx[i].a; - pd_x[i].in = dly_x[i].out; - - pd_x[i].out = _outx[i].r; - pd_x[i].reset_B = rsb_pd_x.out[i]; - pd_x[i].supply = supply; - ) + // Pipe the ack/req lines through to the pulldowns + to_pd_x = _outx; + to_pd_y = _outy; - // Create y line req pull downs - nrn_line_end_pull_down pd_y[Ny]; - sigbuf rsb_pd_y(.in = reset_B, .supply = supply); - (j:0..Ny-1: - dly_y[j].supply = supply; - dly_y[j].in = _outy[j].a; - pd_y[j].in = dly_y[j].out; - - pd_y[j].out = _outy[j].r; - pd_y[j].reset_B = rsb_pd_y.out[j]; - pd_y[j].supply = supply; - ) - // Add keeps - KEEP keep_x[Nx]; - (i:Nx: - keep_x[i].vdd = supply.vdd; - keep_x[i].vss = supply.vss; - keep_x[i].y = _outx[i].r; - ) - - KEEP keep_y[Ny]; - (j:Ny: - keep_y[j].vdd = supply.vdd; - keep_y[j].vss = supply.vss; - keep_y[j].y = _outy[j].r; - ) }