continued arbitrer_handshake test (still doesn't work)

This commit is contained in:
Michele
2022-02-24 16:47:24 +01:00
parent 739aadbc4d
commit 4819635e35
6 changed files with 263 additions and 126 deletions

View File

@ -150,92 +150,92 @@ namespace tmpl {
)
}
export template<pint N>
defproc demux (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<N> out2; bool? reset_B, c_t, c_f; power supply) {
//control
bool _en, _reset_BX,_reset_BXX[N], _out_v;
// export template<pint N>
// defproc demux (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<N> out2; bool? reset_B, c_t, c_f; power supply) {
// //control
// bool _en, _reset_BX,_reset_BXX[N], _out_v;
OR2_X1 out_or(.a=out1.v, .b=out2.v, .y=_out_v,.vdd=supply.vdd,.vss=supply.vss);
A_3C_RB_X4 inack_ctl(.c1=_en,.c2=_in_c_v_,.c3= _out_v,.y=in.a,.pr_B=_reset_BXX,.sr_B=_reset_BXX,.vdd=supply.vdd,.vss=supply.vss);
A_1C1P_X1 en_ctl(.c1=in.a,.p1=_out_v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
sigbuf<2*N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
A_1C1P_X1 en_ctl(.c1=in.a,.p1=out.v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
// OR2_X1 out_or(.a=out1.v, .b=out2.v, .y=_out_v,.vdd=supply.vdd,.vss=supply.vss);
// A_3C_RB_X4 inack_ctl(.c1=_en,.c2=_in_c_v_,.c3= _out_v,.y=in.a,.pr_B=_reset_BXX,.sr_B=_reset_BXX,.vdd=supply.vdd,.vss=supply.vss);
// A_1C1P_X1 en_ctl(.c1=in.a,.p1=_out_v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
// BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
// sigbuf<2*N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
// A_1C1P_X1 en_ctl(.c1=in.a,.p1=out.v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
//validity
bool _in_v, _c_f_buf, _c_t_buf, _c_v, _in_c_v_;
// //validity
// bool _in_v, _c_f_buf, _c_t_buf, _c_v, _in_c_v_;
sigbuf<N> c_buf_t(.in=c_t, .out=_c_t_buf);
sigbuf<N> c_buf_f(.in=c_f, .out=_c_f_buf);
// sigbuf<N> c_buf_t(.in=c_t, .out=_c_t_buf);
// sigbuf<N> c_buf_f(.in=c_f, .out=_c_f_buf);
OR2_X1 c_f_c_t_or(.a=c_t, .b=c_f, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss);
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
// OR2_X1 c_f_c_t_or(.a=c_t, .b=c_f, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss);
// ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
A_2C_RB_X4 c_el(.c1=_c_v, .c2=_in_v, .y=_in_c_v_,.vdd=supply.vdd,.vss=supply.vss);
BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
// A_2C_RB_X4 c_el(.c1=_c_v, .c2=_in_v, .y=_in_c_v_,.vdd=supply.vdd,.vss=supply.vss);
// BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
//function
//func buffer out1
bool _out1_a_BX_t[N],_out1_a_BX_f[N],_out1_a_B,_en1_X_t[N],_en1_X_f[N];
A_2C2N_RB_X4 out1_f_buf_func[N];
A_2C2N_RB_X4 out1_t_buf_func[N];
sigbuf<N> out1_en_buf_t(.in=_en, .out=_en1_X_t, .supply=supply);
sigbuf<N> out1_en_buf_f(.in=_en, .out=_en1_X_f, .supply=supply);
INV_X1 out1_a_inv(.a=out1.a,.y=_out1_a_B);
sigbuf<N> out1_a_B_buf_f(.in=_out1_a_B,.out=_out1_a_BX_t);
sigbuf<N> out1_a_B_buf_t(.in=_out1_a_B,.out=_out1_a_BX_f);
(i:N:
out1_f_buf_func[i].y=out1.d.d[i].f;
out1_t_buf_func[i].y=out1.d.d[i].t;
out1_f_buf_func[i].c1=_en1_X_f[i];
out1_t_buf_func[i].c1=_en1_X_t[i];
out1_f_buf_func[i].c2=_out1_a_BX_f[i];
out1_t_buf_func[i].c2=_out1_a_BX_t[i];
out1_f_buf_func[i].n1=in.d.d[i].f;
out1_t_buf_func[i].n1=in.d.d[i].t;
out1_f_buf_func[i].vdd=supply.vdd;
out1_t_buf_func[i].vdd=supply.vdd;
out1_f_buf_func[i].vss=supply.vss;
out1_t_buf_func[i].vss=supply.vss;
out1_t_buf_func[i].pr_B = _reset_BXX[i];
out1_t_buf_func[i].sr_B = _reset_BXX[i];
out1_f_buf_func[i].pr_B = _reset_BXX[i];
out1_f_buf_func[i].sr_B = _reset_BXX[i];
out1_f_buf_func[i].n2=_c_t_buf;
out1_t_buf_func[i].n2=_c_t_buf;
)
//func buffer out2
bool _out2_a_BX_t[N],_out2_a_BX_f[N],_out2_a_B,_en2_X_t[N],_en2_X_f[N];
A_2C2N_RB_X4 out2_f_buf_func[N];
A_2C2N_RB_X4 out2_t_buf_func[N];
sigbuf<N> out2_en_buf_t(.in=_en, .out=_en2_X_t, .supply=supply);
sigbuf<N> out2_en_buf_f(.in=_en, .out=_en2_X_f, .supply=supply);
INV_X1 out2_a_inv(.a=out2.a,.y=_out2_a_B);
sigbuf<N> out2_a_B_buf_f(.in=_out2_a_B,.out=_out2_a_BX_t);
sigbuf<N> out2_a_B_buf_t(.in=_out2_a_B,.out=_out2_a_BX_f);
(i:N:
out2_f_buf_func[i].y=out2.d.d[i].f;
out2_t_buf_func[i].y=out2.d.d[i].t;
out2_f_buf_func[i].c1=_en2_X_f[i];
out2_t_buf_func[i].c1=_en2_X_t[i];
out2_f_buf_func[i].c2=_out2_a_BX_f[i];
out2_t_buf_func[i].c2=_out2_a_BX_t[i];
out2_f_buf_func[i].n1=in.d.d[i].f;
out2_t_buf_func[i].n1=in.d.d[i].t;
out2_f_buf_func[i].vdd=supply.vdd;
out2_t_buf_func[i].vdd=supply.vdd;
out2_f_buf_func[i].vss=supply.vss;
out2_t_buf_func[i].vss=supply.vss;
out2_t_buf_func[i].pr_B = _reset_BXX[i+N-1];
out2_t_buf_func[i].sr_B = _reset_BXX[i+N-1];
out2_f_buf_func[i].pr_B = _reset_BXX[i+N-1];
out2_f_buf_func[i].sr_B = _reset_BXX[i+N-1];
out2_f_buf_func[i].n2=_c_f_buf;
out2_t_buf_func[i].n2=_c_f_buf;
)
// //function
// //func buffer out1
// bool _out1_a_BX_t[N],_out1_a_BX_f[N],_out1_a_B,_en1_X_t[N],_en1_X_f[N];
// A_2C2N_RB_X4 out1_f_buf_func[N];
// A_2C2N_RB_X4 out1_t_buf_func[N];
// sigbuf<N> out1_en_buf_t(.in=_en, .out=_en1_X_t, .supply=supply);
// sigbuf<N> out1_en_buf_f(.in=_en, .out=_en1_X_f, .supply=supply);
// INV_X1 out1_a_inv(.a=out1.a,.y=_out1_a_B);
// sigbuf<N> out1_a_B_buf_f(.in=_out1_a_B,.out=_out1_a_BX_t);
// sigbuf<N> out1_a_B_buf_t(.in=_out1_a_B,.out=_out1_a_BX_f);
// (i:N:
// out1_f_buf_func[i].y=out1.d.d[i].f;
// out1_t_buf_func[i].y=out1.d.d[i].t;
// out1_f_buf_func[i].c1=_en1_X_f[i];
// out1_t_buf_func[i].c1=_en1_X_t[i];
// out1_f_buf_func[i].c2=_out1_a_BX_f[i];
// out1_t_buf_func[i].c2=_out1_a_BX_t[i];
// out1_f_buf_func[i].n1=in.d.d[i].f;
// out1_t_buf_func[i].n1=in.d.d[i].t;
// out1_f_buf_func[i].vdd=supply.vdd;
// out1_t_buf_func[i].vdd=supply.vdd;
// out1_f_buf_func[i].vss=supply.vss;
// out1_t_buf_func[i].vss=supply.vss;
// out1_t_buf_func[i].pr_B = _reset_BXX[i];
// out1_t_buf_func[i].sr_B = _reset_BXX[i];
// out1_f_buf_func[i].pr_B = _reset_BXX[i];
// out1_f_buf_func[i].sr_B = _reset_BXX[i];
// out1_f_buf_func[i].n2=_c_t_buf;
// out1_t_buf_func[i].n2=_c_t_buf;
// )
// //func buffer out2
// bool _out2_a_BX_t[N],_out2_a_BX_f[N],_out2_a_B,_en2_X_t[N],_en2_X_f[N];
// A_2C2N_RB_X4 out2_f_buf_func[N];
// A_2C2N_RB_X4 out2_t_buf_func[N];
// sigbuf<N> out2_en_buf_t(.in=_en, .out=_en2_X_t, .supply=supply);
// sigbuf<N> out2_en_buf_f(.in=_en, .out=_en2_X_f, .supply=supply);
// INV_X1 out2_a_inv(.a=out2.a,.y=_out2_a_B);
// sigbuf<N> out2_a_B_buf_f(.in=_out2_a_B,.out=_out2_a_BX_t);
// sigbuf<N> out2_a_B_buf_t(.in=_out2_a_B,.out=_out2_a_BX_f);
// (i:N:
// out2_f_buf_func[i].y=out2.d.d[i].f;
// out2_t_buf_func[i].y=out2.d.d[i].t;
// out2_f_buf_func[i].c1=_en2_X_f[i];
// out2_t_buf_func[i].c1=_en2_X_t[i];
// out2_f_buf_func[i].c2=_out2_a_BX_f[i];
// out2_t_buf_func[i].c2=_out2_a_BX_t[i];
// out2_f_buf_func[i].n1=in.d.d[i].f;
// out2_t_buf_func[i].n1=in.d.d[i].t;
// out2_f_buf_func[i].vdd=supply.vdd;
// out2_t_buf_func[i].vdd=supply.vdd;
// out2_f_buf_func[i].vss=supply.vss;
// out2_t_buf_func[i].vss=supply.vss;
// out2_t_buf_func[i].pr_B = _reset_BXX[i+N-1];
// out2_t_buf_func[i].sr_B = _reset_BXX[i+N-1];
// out2_f_buf_func[i].pr_B = _reset_BXX[i+N-1];
// out2_f_buf_func[i].sr_B = _reset_BXX[i+N-1];
// out2_f_buf_func[i].n2=_c_f_buf;
// out2_t_buf_func[i].n2=_c_f_buf;
// )
}
// }
export template<pint N>
@ -327,17 +327,27 @@ namespace tmpl {
// sigbuf<N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
// //validity
// //function
// bool _in1_v,_in2_v;
// a1of1 _in1_temp,_in2_temp,_out_temp;
// ctree<N> vc1(.in=in1.d,.out=in1.v,.supply=supply);
// ctree<N> vc2(.in=in2.d,.out=in2.v,.supply=supply);
// arbiter_handshake validity_arb(.in1 = _in1_temp,.in2 = _in2_temp,.out =_out_temp)
// _in1_temp.r = in1.v
// _in2_temp.r = in2.v
// _in1_temp.a =
// _in1_temp.a =
// _out_temp.r = _out_temp.a
//function
// }
export
defproc arbiter_handshake(a1of1 in1; a1of1 in2; a1of1 out; power supply)
{
bool _y1_arb,_y2_arb;
// defproc arbiter_handshake(a1of1 in1; a1of1 in2; a1of1 out; power supply)
// {
// bool _y1_arb,_y2_arb;
// A_2C_B_X1 cel1(.c1 = out.a,.c2 = _y1_arb,.y = in2.a,.vdd = supply.vdd, .vss = supply.vss);
// A_2C_B_X1 cel2(.c1 = out.a,.c2 = _y2_arb,.y = in1.a,.vdd = supply.vdd, .vss = supply.vss);
// OR2_X1 or_cell(.a = _y1_arb, .b = _y2_arb, .y = out.r,.vdd = supply.vdd, .vss = supply.vss);
// ARBITER arbiter(.a = in1.r, .b = in2.r, .c = in2.a, .d = in1.a, .y1 = _y1_arb, .y2 = _y2_arb, .vdd = supply.vdd, .vss = supply.vss);
// }
A_2C_B_X1 ack_cel1(.c1 = out.a,.c2 = _y1_arb,.y = in1.a,.vdd = supply.vdd, .vss = supply.vss);
A_2C_B_X1 ack_cel2(.c1 = out.a,.c2 = _y2_arb,.y = in2.a,.vdd = supply.vdd, .vss = supply.vss);
OR2_X1 or_cell(.a = _y1_arb, .b = _y2_arb, .y = out.r,.vdd = supply.vdd, .vss = supply.vss);
ARBITER arbiter(.a = in1.r, .b = in2.r, .c = in2.a, .d = in1.a, .y1 = _y1_arb, .y2 = _y2_arb, .vdd = supply.vdd, .vss = supply.vss);
}
}}