adding sigbufs

This commit is contained in:
alexmadison 2022-04-10 18:18:11 +02:00
parent 067b2645ee
commit 3bf7c21c48
1 changed files with 36 additions and 56 deletions

View File

@ -91,15 +91,16 @@ defproc decoder_dualrail (Mx1of2<Nc> in; bool? out[N]; power supply) {
* Be careful of out[] indexing. * Be careful of out[] indexing.
*/ */
export template<pint Nc, N, OUT_STRENGTH> export template<pint Nc, N, OUT_STRENGTH>
defproc decoder_dualrail_x(Mx1of2<Nc> in; bool? out[N*OUT_STRENGTH]; power supply) { defproc decoder_dualrail_x(Mx1of2<Nc> in; bool? out[N]; power supply) {
decoder_dualrail<Nc, N> decoder(.in = in, .supply = supply); decoder_dualrail<Nc, N> decoder(.in = in, .supply = supply);
sigbuf<OUT_STRENGTH> sb[N]; sigbuf<OUT_STRENGTH> sb[N];
(i:N: (i:N:
sb[i].in = decoder.out[i]; sb[i].in = decoder.out[i];
sb[i].supply = supply; sb[i].supply = supply;
(j:OUT_STRENGTH: sb[i].out[0] = out[i];
sb[i].out[j] = out[j + i*OUT_STRENGTH]; // (j:OUT_STRENGTH:
) // sb[i].out[j] = out[j + i*OUT_STRENGTH];
// )
) )
} }
@ -126,40 +127,6 @@ defproc decoder_dualrail_en(Mx1of2<Nc> in; bool? en, out[N]; power supply) {
} }
/**
* Dualrail decoder with on/off switch.
* Outputs are buffered.
*/
// export template<pint Nc, N, OUT_STRENGTH>
// defproc decoder_dualrail_en_x(Mx1of2<Nc> in; bool? en, out[N]; power supply) {
// decoder_dualrail<Nc, N> decoder(.in = in, .supply = supply);
// sigbuf<N> sb_en(.in = en, .supply = supply);
// sigbuf<OUT_STRENGTH> 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<pint NxC, NyC, Nx, Ny> export template<pint NxC, NyC, Nx, Ny>
defproc decoder_2d_hs (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? reset_B; power supply) { defproc decoder_2d_hs (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? reset_B; power supply) {
bool _reset_BX[Nx];
sigbuf<Nx> reset_sb(.in = reset_B, .out = _reset_BX, .supply = supply);
// Buffer to recieve concat(x,y) address packet // Buffer to recieve concat(x,y) address packet
buffer<NxC+NyC> addr_buf(.in = in, .reset_B = reset_B, .supply = supply); buffer<NxC+NyC> addr_buf(.in = in, .reset_B = reset_B, .supply = supply);
@ -303,7 +273,7 @@ defproc decoder_2d_hs (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? reset_B; po
pu[i].vdd = supply.vdd; pu[i].vdd = supply.vdd;
pu[i].vss = supply.vss; 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].y = _out_acksB[i];
pu_reset[i].vdd = supply.vdd; pu_reset[i].vdd = supply.vdd;
pu_reset[i].vss = supply.vss; pu_reset[i].vss = supply.vss;
@ -345,6 +315,9 @@ export template<pint NxC, NyC, Nx, Ny, N_dly_cfg>
defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg[N_dly_cfg], hs_en, defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg[N_dly_cfg], hs_en,
reset_B; power supply) { reset_B; power supply) {
bool _reset_BX[Nx];
sigbuf<Nx> reset_sb(.in = reset_B, .out = _reset_BX, .supply = supply);
bool hs_enB; bool hs_enB;
INV_X4 hs_inv(.a = hs_en, .y = hs_enB, .vdd = supply.vdd, .vss = supply.vss); 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<NxC+NyC> 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];) (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. // sig buf for reqx lines, since they go to synapse pull down gates.
// Signals to the and-grid are buffered therein.
sigbuf<Ny+1> d_dr_xX[Nx]; sigbuf<Ny+1> d_dr_xX[Nx];
(i:Nx: (i:Nx:
d_dr_xX[i].in = d_dr_x.out[i]; d_dr_xX[i].in = d_dr_x.out[i];
@ -410,7 +384,7 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
pu[i].vdd = supply.vdd; pu[i].vdd = supply.vdd;
pu[i].vss = supply.vss; 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].y = _out_acksB[i];
pu_reset[i].vdd = supply.vdd; pu_reset[i].vdd = supply.vdd;
pu_reset[i].vss = supply.vss; pu_reset[i].vss = supply.vss;
@ -570,10 +544,15 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> 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_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;) (i:Nc:ors_f[i].supply = supply; ors_f[i].out = out.d[i].f;)
bool _inX[N];
sigbuf_boolarray<N, Nc> 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_t; // Number of guys already connected to the current OR tree
pint num_connected_f; 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; pint bitval;
(i:0..Nc-1: // For each output line (i:0..Nc-1: // For each output line
num_connected_t = 0; num_connected_t = 0;
@ -581,16 +560,16 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
(j:0.. _N-1: (j:0.. _N-1:
bitval = (j & ( 1 << i )) >> i; // Get binary digit of integer j, column i bitval = (j & ( 1 << i )) >> i; // Get binary digit of integer j, column i
[bitval = 1 & j <= N-1-> [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; num_connected_t = num_connected_t + 1;
[] bitval = 0 & j <= N-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; num_connected_f = num_connected_f + 1;
[] bitval = 1 & j > N-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; num_connected_t = num_connected_t + 1;
[] bitval = 0 & j > N-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; num_connected_f = num_connected_f + 1;
] ]
@ -604,11 +583,11 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
/** /**
* Buffer function code. * Buffer function code.
* Is the function block ripped from the buffer_s. * Is the function block ripped from the buffer_s.
* Used in the encoder2d. * Used in the encoder2d.
*/ */
export template<pint N> export template<pint N>
defproc buffer_s_func (Mx1of2<N> in; avMx1of2<N> out; bool? in_v, en, reset_B; power supply) { defproc buffer_s_func (Mx1of2<N> in; avMx1of2<N> out; bool? in_v, en, reset_B; power supply) {
//function //function
@ -619,9 +598,9 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
A_2C2N_RB_X4 t_buf_func[N]; A_2C2N_RB_X4 t_buf_func[N];
// reset buffers // 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); BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
sigbuf<N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX, .supply=supply); sigbuf<N*2> reset_bufarray(.in=_reset_BX, .out=_reset_BXX, .supply=supply);
// Enable signal buffers // Enable signal buffers
sigbuf<N> en_buf_t(.in=en, .out=_en_X_t, .supply=supply); sigbuf<N> en_buf_t(.in=en, .out=_en_X_t, .supply=supply);
@ -654,8 +633,8 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
t_buf_func[i].vss=supply.vss; t_buf_func[i].vss=supply.vss;
t_buf_func[i].pr_B = _reset_BXX[i]; t_buf_func[i].pr_B = _reset_BXX[i];
t_buf_func[i].sr_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].pr_B = _reset_BXX[i+N];
f_buf_func[i].sr_B = _reset_BXX[i]; f_buf_func[i].sr_B = _reset_BXX[i+N];
) )
} }
@ -665,9 +644,10 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> 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) { defproc encoder2d(a1of1 inx[Nx]; a1of1 iny[Ny]; avMx1of2<(NxC + NyC)> out; power supply; bool reset_B) {
// Reset buffers // Reset buffers
pint H = 2*(NxC + NyC); //Reset strength? to be investigated pint H = 2*(NxC + NyC); //Reset strength? to be investigated
bool _reset_BX,_reset_BXX[H]; bool _reset_BX,_reset_BXX[H];
BUF_X4 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss); 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); sigbuf<2*(NxC + NyC)> reset_bufarray(.in=_reset_BX, .out=_reset_BXX,.supply=supply);
// Arbiters // Arbiters
a1of1 _arb_out_x, _arb_out_y; a1of1 _arb_out_x, _arb_out_y;