Fork template done (basic simulation works)

This commit is contained in:
M. Mastella 2022-02-23 11:26:11 +01:00
parent 432163035d
commit 864460a68a
6 changed files with 2758 additions and 2 deletions

View File

@ -115,7 +115,7 @@ namespace tmpl {
}
export defcell A_1C2P (bool! y; bool? c1, p1, p2; bool vdd, vss)
export defcell A_1C2P_X1 (bool! y; bool? c1, p1, p2; bool vdd, vss)
{
prs{
~p1 & ~p2 & ~c1 -> y+

View File

@ -109,13 +109,16 @@ namespace tmpl {
bool _en, _reset_BX,_reset_BXX[N];
A_3C_RB_X4 inack_ctl(.c1=_en,.c2=in.v,.c3=out.v,.y=in.a,.pr_B=reset_B,.sr_B=reset_B,.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);
//reset_buffers
sigbuf<N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
//validity
bool _in_v;
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
//function
bool _out_a_BX_t[N],_out_a_BX_f[N],_out_a_B,_en_X_t[N],_en_X_f[N];
A_2C1N_RB_X4 f_buf_func[N];
@ -146,5 +149,78 @@ namespace tmpl {
f_buf_func[i].sr_B = _reset_BXX[i];
)
}
export template<pint N>
defproc fork (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<N> out2 ; bool? reset_B; power supply) {
// control
bool _en, _reset_BX,_reset_BXX[N*2];
A_4C_RB_X4 inack_ctl(.c1=_en,.c2=in.v,.c3=out1.v,.c4=out2.v,.y=in.a,.pr_B=reset_B,.sr_B=reset_B,.vdd=supply.vdd,.vss=supply.vss);
A_1C2P_X1 en_ctl(.c1=in.a,.p1=out1.v,.p2=out2.v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
//reset_buffers
sigbuf<N*2> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
//validity
bool _in_v;
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
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_2C1N_RB_X4 out1_f_buf_func[N];
A_2C1N_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];
)
//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_2C1N_RB_X4 out2_f_buf_func[N];
A_2C1N_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];
)
}
}
}

View File

@ -0,0 +1,6 @@
my_fork.fork_test.out1_t_buf_func[4].n1 my_fork.fork_test._en2_X_f[0] my_fork.out2.v my_fork.fork_test._en1_X_f[0] my_fork.fork_test._out1_a_BX_t[0] my_fork.fork_test.vc.tmp[11] my_fork.fork_test.out1_f_buf_func[6].n1 my_fork.fork_test._out2_a_BX_t[0] my_fork.fork_test.out1_t_buf_func[5].n1 my_fork.fork_test.out1_t_buf_func[0].n1 my_fork.fork_test._out1_a_BX_f[0] my_fork.fork_test.out1_f_buf_func[3].n1 my_fork.fork_test.out1_f_buf_func[8].n1 my_fork.fork_test._out2_a_BX_f[0] my_fork.fork_test._in_v my_fork.fork_test.vc.tmp[2] my_fork.fork_test._en my_fork.fork_test.out1_f_buf_func[5].n1 my_fork.fork_test.vc.OR2_tf[3]._y my_fork.fork_test.out1_f_buf_func[7].n1 my_fork.fork_test.out1_f_buf_func[12].n1 my_fork.fork_test.out1_f_buf_func[1].n1 my_fork.fork_test.out1_f_buf_func[0].n1 my_fork.fork_test.out1_f_buf_func[13].n1 my_fork.fork_test.out1_t_buf_func[2].n1 my_fork.fork_test.vc.tmp[13] my_fork.fork_test.out1_f_buf_func[4].n1 my_fork.fork_test.out1_t_buf_func[11].n1 my_fork.fork_test._en2_X_t[0] my_fork.fork_test._en1_X_t[0] my_fork.fork_test.vc.tmp[1] my_fork.fork_test.vc.tmp[9] my_fork.fork_test.vc.tmp[20] my_fork.fork_test.vc.C2Els[0]._y my_fork.fork_test.out1_t_buf_func[6].n1 my_fork.fork_test.out1_t_buf_func[8].n1 my_fork.fork_test.out1_en_buf_t.buf6._y my_fork.fork_test.out1_f_buf_func[2].n1 my_fork.fork_test.out1_f_buf_func[10].n1 my_fork.fork_test._out1_a_B my_fork.fork_test.out1_t_buf_func[14].n1 my_fork.fork_test.out1_t_buf_func[12].n1 my_fork.fork_test.vc.C2Els[6]._y my_fork.fork_test.vc.tmp[0] my_fork.fork_test.vc.tmp[4] my_fork.fork_test.out1_t_buf_func[3].n1 my_fork.fork_test.vc.tmp[16] my_fork.fork_test.out1_t_buf_func[1].n1 my_fork.fork_test.vc.tmp[24] my_fork.fork_test.vc.tmp[8] my_fork.fork_test._out2_a_B my_fork.fork_test.out1_t_buf_func[10].n1 my_fork.fork_test.out1_a_B_buf_f.buf6._y my_fork.fork_test.vc.tmp[18] my_fork.fork_test.vc.C3Els[2]._y my_fork.fork_test.out1_t_buf_func[13].n1 my_fork.fork_test.vc.OR2_tf[8]._y my_fork.fork_test.out1_f_buf_func[14].n1 my_fork.fork_test.vc.tmp[12] my_fork.fork_test.vc.tmp[3] my_fork.fork_test.vc.tmp[21] my_fork.fork_test.vc.tmp[7] my_fork.fork_test.out1_t_buf_func[7].n1 my_fork.fork_test.out1_f_buf_func[11].n1 my_fork.fork_test.vc.C2Els[3]._y my_fork.fork_test.vc.tmp[23] my_fork.fork_test.out1_f_buf_func[9].n1 my_fork.fork_test.vc.tmp[17] my_fork.fork_test.vc.OR2_tf[13]._y my_fork.fork_test.vc.OR2_tf[0]._y my_fork.fork_test.vc.C3Els[1]._y my_fork.fork_test.vc.tmp[5] my_fork.fork_test.out1_t_buf_func[9].n1 my_fork.out1.a my_fork.fork_test.vc.OR2_tf[9]._y my_fork.out1.v my_fork.out2.a my_fork.fork_test.vc.tmp[22] my_fork.in.v my_fork.fork_test.vc.tmp[6] my_fork.fork_test.vc.C2Els[1]._y my_fork.fork_test.vc.tmp[10] my_fork.fork_test.vc.tmp[14] my_fork.fork_test.out2_en_buf_f.buf6._y my_fork.fork_test.vc.OR2_tf[7]._y my_fork.fork_test.vc.OR2_tf[11]._y my_fork.fork_test.vc.C3Els[0]._y my_fork.fork_test.vc.tmp[19] my_fork.fork_test.vc.OR2_tf[1]._y my_fork.fork_test.vc.C2Els[7]._y my_fork.fork_test.vc.C2Els[4]._y my_fork.fork_test.out1_en_buf_f.buf6._y my_fork.fork_test.vc.OR2_tf[2]._y my_fork.fork_test.out2_en_buf_t.buf6._y my_fork.fork_test.vc.OR2_tf[14]._y my_fork.fork_test.vc.C2Els[5]._y my_fork.fork_test.vc.tmp[15] my_fork.fork_test.vc.OR2_tf[6]._y my_fork.fork_test.vc.OR2_tf[4]._y my_fork.fork_test.out2_a_B_buf_t.buf6._y my_fork.fork_test.out2_a_B_buf_f.buf6._y my_fork.fork_test.vc.OR2_tf[5]._y my_fork.fork_test.vc.C2Els[2]._y my_fork.fork_test.vc.OR2_tf[12]._y my_fork.fork_test.vc.OR2_tf[10]._y my_fork.fork_test.out1_a_B_buf_t.buf6._y my_fork.fork_test.in_v_buf._y
System initialized
System reset completed
Output neutral checked
Finished

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
/*************************************************************************
*
* This file is part of ACT dataflow neuro library.
* It's the testing facility for cell_lib_std.act
*
* Copyright (c) 2022 University of Groningen - Ole Richter
* Copyright (c) 2022 University of Groningen - Hugh Greatorex
* Copyright (c) 2022 University of Groningen - Michele Mastella
* Copyright (c) 2022 University of Groningen - Madison Cotteret
*
* This source describes Open Hardware and is licensed under the CERN-OHL-W v2 or later
*
* You may redistribute and modify this documentation and make products
* using it under the terms of the CERN-OHL-W v2 (https:/cern.ch/cern-ohl).
* This documentation is distributed WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY, INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY
* AND FITNESS FOR A PARTICULAR PURPOSE. Please see the CERN-OHL-W v2
* for applicable conditions.
*
* Source location: https://git.web.rug.nl/bics/actlib_dataflow_neuro
*
* As per CERN-OHL-W v2 section 4.1, should You produce hardware based on
* these sources, You must maintain the Source Location visible in its
* documentation.
*
**************************************************************************
*/
import "../../dataflow_neuro/primitives.act";
import globals;
open tmpl::dataflow_neuro;
defproc fork_15 (avMx1of2<15> in; avMx1of2<15> out1; avMx1of2<15> out2){
fork<15> fork_test(.in=in, .out1=out1,.out2 = out2);
//Low active Reset
bool _reset_B;
prs {
Reset => _reset_B-
}
fork_test.supply.vss = GND;
fork_test.supply.vdd = Vdd;
fork_test.reset_B = _reset_B;
}
fork_15 my_fork;

View File

@ -0,0 +1,35 @@
set-qdi-channel-neutral "my_fork.in" 15
set my_fork.out1.a 0
set my_fork.out1.v 0
set my_fork.out2.a 0
set my_fork.out2.v 0
cycle
system "echo 'System initialized'"
set Reset 0
cycle
system "echo 'System reset completed'"
status X
mode run
assert-qdi-channel-neutral "my_fork.out1" 15
assert-qdi-channel-neutral "my_fork.out2" 15
cycle
system "echo 'Output neutral checked'"
set-qdi-channel-valid "my_fork.in" 15 5
cycle
assert my_fork.in.v 1
assert my_fork.in.a 0
assert-qdi-channel-valid "my_fork.out1" 15 5
assert-qdi-channel-valid "my_fork.out2" 15 5
set my_fork.out1.v 1
set my_fork.out2.v 1
cycle
assert my_fork.in.a 1
set-qdi-channel-neutral "my_fork.in" 15
cycle
set my_fork.out1.a 1
set my_fork.out1.a 1
system "echo 'Finished'"