disentangled neurons and pull downs

This commit is contained in:
alexmadison 2022-04-20 19:21:55 +02:00
parent 351b3ea151
commit bb63182694
2 changed files with 78 additions and 81 deletions

View File

@ -116,13 +116,16 @@ defproc texel_core (avMx1of2<N_IN> in, out;
// Neurons + encoder
pint NC_NRN;
NC_NRN = NC_NRN_X + NC_NRN_Y;
nrn_hs_2d_array<N_NRN_X,N_NRN_Y,N_LINE_PD_DLY> nrn_grid(.in = neurons,
encoder2d_simple<NC_NRN_X, NC_NRN_Y, N_NRN_X, N_NRN_Y, N_LINE_PD_DLY> encoder(
.reset_B = _reset_BX, .supply = supply);
// Neuron handshake circuits, to be removed for innovus
nrn_hs_2d_array<N_NRN_X,N_NRN_Y> 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<NC_NRN_X, NC_NRN_Y, N_NRN_X, N_NRN_Y> encoder(
.inx = nrn_grid.outx,
.iny = nrn_grid.outy,
.reset_B = _reset_BX, .supply = supply
);
fifo<NC_NRN, N_BUFFERS> fifo_enc2mrg(.in = encoder.out,
.reset_B = _reset_BX, .supply = supply);
@ -139,7 +142,6 @@ defproc texel_core (avMx1of2<N_IN> 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);

View File

@ -752,7 +752,7 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; bool! out_req_x[Nx], out_req_y[
export template<pint NxC, NyC, Nx, Ny, ACK_STRENGTH>
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<NxC+NyC> in; bool! out_req_x[Nx], out_req_y[
}
export template<pint NxC, NyC, Nx, Ny>
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<pint NxC, NyC, Nx, Ny, N_dly>
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<NxC+NyC> 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<N_dly> dly_x[Nx];
delay_chain<N_dly> dly_y[Ny];
// Create x line req pull downs
nrn_line_end_pull_down pd_x[Nx];
sigbuf<Nx> 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<Ny> 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<pint Nc, N>
@ -1025,30 +1086,6 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> 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<NxC+NyC> 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<pint Nx, Ny, N_dly>
export template<pint Nx, Ny>
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<NxC+NyC> 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<NxC+NyC> 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<N_dly> dly_x[Nx];
delay_chain<N_dly> dly_y[Ny];
// Create x line req pull downs
nrn_line_end_pull_down pd_x[Nx];
sigbuf<Nx> 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<Ny> 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;
)
}