diff --git a/dataflow_neuro/primitives.act b/dataflow_neuro/primitives.act index 3072a7f..00b72e9 100644 --- a/dataflow_neuro/primitives.act +++ b/dataflow_neuro/primitives.act @@ -312,6 +312,82 @@ namespace tmpl { } + export template + defproc demux_td (avMx1of2 in; avMx1of2 out1; avMx1of2<1> token; bool? reset_B; avMx1of2<1> cond; power supply) { + //control + bool _en, _reset_BX,_reset_BXX[2*N], _out_v, _in_c_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_BX,.sr_B=_reset_BX,.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); + //validity + bool _in_v, _c_f_buf[N], _c_t_buf[N], _c_v; + + sigbuf c_buf_t(.in=cond.d.d[0].t, .out=_c_t_buf); + sigbuf c_buf_f(.in=cond.d.d[0].f, .out=_c_f_buf); + + + //orientation of condition + [ invout < 0 -> + OR2_X1 c_f_c_t_or(.a=cond.d.d[0].t, .b=cond.d.d[0].f, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss); + [] invout > 0 -> + OR2_X1 c_f_c_t_or(.a=cond.d.d[0].f, .b=cond.d.d[0].t, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss); + ] + + ctree vc(.in=in.d,.out=_in_v,.supply=supply); + + A_2C_B_X1 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 out1_en_buf_t(.in=_en, .out=_en1_X_t, .supply=supply); + sigbuf 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 out1_a_B_buf_f(.in=_out1_a_B,.out=_out1_a_BX_t); + sigbuf 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[i]; + out1_t_buf_func[i].n2=_c_t_buf[i]; + ) + + //token out + + A_2C2N_RB_X4 token_buf; + + token_buf.y = ; + token_buf.c1 = ; + token_buf.c2 = ; + token_buf.n1 = ; + token_buf.n2 = ; + token_buf.vdd = supply.vdd; + token_buf.vss = supply.vss; + token_buf.pr_B ; + token_buf.sr_b ; + } + // export template // defproc merge (avMx1of2 in1; avMx1of2 in2; avMx1of2 out ; bool? reset_B; power supply) { diff --git a/test/prsim_plot.py b/test/prsim_plot.py index 4abb4e8..bb53ce8 100755 --- a/test/prsim_plot.py +++ b/test/prsim_plot.py @@ -30,6 +30,30 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") entries = re.findall(r"\t *(\d+) ([^:]+) : (\d)( \[by.+\])?[\n\r]", f) assert len(entries) >= 1, "Could not find signal info in prsim.out!" + # Check if user gave a colour specification + # default is Michele's atm + colour_undefined = (100,100,100) + colour_high = (98, 187, 93) + colour_low = (233, 115, 115) + for arg in argv: + r = re.findall(r'-c=[\"\']?(.+)[\"\']?', arg) + if len(r) >= 1: + if r[0] == "ole": + colour_undefined = (233, 115, 115) + colour_high = (98, 187, 93) + colour_low = (90, 111, 199) + elif r[0] == "og": + colour_undefined = (255,0,0) + colour_high = (252, 186, 3) + colour_low = (20, 184, 186) + elif r[0] == "michele": + colour_undefined = (100,100,100) + colour_high = (98, 187, 93) + colour_low = (233, 115, 115) + else: + raise Exception("Unknown colour given. I cba to code up general colours atm.") + + # Check if user gave an include filter include_given = False include_re = None @@ -104,15 +128,9 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") # Plot - colour_undefined = (255,0,0) - colour_high = (252, 186, 3) - colour_low = (20, 184, 186) - if argv[2] == "-color_Michele": - colour_undefined = (32,32,32) - colour_high = (98, 187, 93) - colour_low = (233, 115, 115) - - fig = plt.figure(figsize = (num_sigs/3+4,num_times/3+4), dpi = 100) + # Generate figure + # weird sizing is to try to keep "pixel" sizes approx const + fig = plt.figure(figsize = (num_sigs/3+0.5,num_times/3+0.2), dpi = 100) image = np.zeros((num_sigs, num_times, 3), dtype = int) image[signals_matrix == 0] = colour_undefined @@ -163,6 +181,9 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") plt.arrow(t0, s1, 0, s0-s1 + 0.2*np.sign(s0-s1), head_width = 0, width = 0.2, ec = "none", lw = 0, fc = "black", length_includes_head = True) plt.scatter((t0),(s0), c = "black", s = 30) + # Write times on x axis + for time in unique_times: + ax.text(time_to_index(time), num_sigs, time, ha = "center", va = "top", size = 10, rotation = 90) output_type = ".pdf" for arg in argv: diff --git a/test/unit_tests/arbiter_2/run/test.prs b/test/unit_tests/arbiter_2/run/test.prs new file mode 100644 index 0000000..525b6c1 --- /dev/null +++ b/test/unit_tests/arbiter_2/run/test.prs @@ -0,0 +1,12 @@ += "GND" "GND" += "Vdd" "Vdd" += "Reset" "Reset" +"a.a"&"a._v"->"a._u"- +~"a.a"|~"a._v"->"a._u"+ +"a.b"&"a._u"->"a._v"- +~"a.b"|~"a._u"->"a._v"+ +"a._u"->"a.u"- +~("a._u")->"a.u"+ +"a._v"->"a.v"- +~("a._v")->"a.v"+ +mk_excllo("a._u","a._v") diff --git a/test/unit_tests/buffer_token/run/test.prs b/test/unit_tests/buffer_token/run/test.prs deleted file mode 100644 index 2065324..0000000 --- a/test/unit_tests/buffer_token/run/test.prs +++ /dev/null @@ -1,65 +0,0 @@ -= "GND" "GND" -= "Vdd" "Vdd" -= "Reset" "Reset" -"t.a.reset_buf.a"->"t.a.reset_buf._y"- -~("t.a.reset_buf.a")->"t.a.reset_buf._y"+ -"t.a.reset_buf._y"->"t.a.reset_buf.y"- -~("t.a.reset_buf._y")->"t.a.reset_buf.y"+ -"t.a.inv_outa.a"->"t.a.inv_outa.y"- -~("t.a.inv_outa.a")->"t.a.inv_outa.y"+ -~"t.a.inack_ctl.c1"&~"t.a.inack_ctl.c2"|~"t.a.inack_ctl.pr_B"->"t.a.inack_ctl._y"+ -"t.a.inack_ctl.c1"&"t.a.inack_ctl.c2"&"t.a.inack_ctl.n1"&"t.a.inack_ctl.sr_B"->"t.a.inack_ctl._y"- -"t.a.inack_ctl._y"->"t.a.inack_ctl.y"- -~("t.a.inack_ctl._y")->"t.a.inack_ctl.y"+ -~"t.a.buf_func.c1"&~"t.a.buf_func.c2"|~"t.a.buf_func.pr_B"->"t.a.buf_func._y"+ -"t.a.buf_func.c1"&"t.a.buf_func.c2"&"t.a.buf_func.n1"&"t.a.buf_func.sr_B"->"t.a.buf_func._y"- -"t.a.buf_func._y"->"t.a.buf_func.y"- -~("t.a.buf_func._y")->"t.a.buf_func.y"+ -= "t.a.reset_B" "t.a.reset_buf.a" -= "t.a.supply.vdd" "t.a.reset_buf.vdd" -= "t.a.supply.vdd" "t.a.buf_func.vdd" -= "t.a.supply.vdd" "t.a.inv_outa.vdd" -= "t.a.supply.vdd" "t.a.en_ctl.vdd" -= "t.a.supply.vdd" "t.a.inack_ctl.vdd" -= "t.a.supply.vss" "t.a.reset_buf.vss" -= "t.a.supply.vss" "t.a.buf_func.vss" -= "t.a.supply.vss" "t.a.inv_outa.vss" -= "t.a.supply.vss" "t.a.en_ctl.vss" -= "t.a.supply.vss" "t.a.inack_ctl.vss" -= "t.a._reset_BX" "t.a.reset_buf.y" -= "t.a._reset_BX" "t.a.buf_func.sr_B" -= "t.a._reset_BX" "t.a.buf_func.pr_B" -= "t.a._reset_BX" "t.a.inack_ctl.sr_B" -= "t.a._reset_BX" "t.a.inack_ctl.pr_B" -= "t.a._en" "t.a.buf_func.c1" -= "t.a._en" "t.a.en_ctl.y" -= "t.a._en" "t.a.inack_ctl.c1" -~"t.a.en_ctl.p1"&~"t.a.en_ctl.c1"->"t.a.en_ctl.y"+ -"t.a.en_ctl.c1"->"t.a.en_ctl.y"- -= "t.a._out_a_B" "t.a.buf_func.c2" -= "t.a._out_a_B" "t.a.inv_outa.y" -= "t.a.in.d.d[0]" "t.a.in.r" -= "t.a.in.a" "t.a.en_ctl.c1" -= "t.a.in.a" "t.a.inack_ctl.y" -= "t.a.in.d.d[0]" "t.a.buf_func.n1" -= "t.a.in.d.d[0]" "t.a.inack_ctl.c2" -= "t.a.in.d.d[0]" "t.a.in.r" -= "t.a.out.d.d[0]" "t.a.out.r" -= "t.a.out.a" "t.a.inv_outa.a" -= "t.a.out.d.d[0]" "t.a.buf_func.y" -= "t.a.out.d.d[0]" "t.a.en_ctl.p1" -= "t.a.out.d.d[0]" "t.a.inack_ctl.n1" -= "t.a.out.d.d[0]" "t.a.out.r" -= "Reset" "t.a.reset_B" -= "Vdd" "t.a.supply.vdd" -= "GND" "t.a.supply.vss" -= "t.out.d.d[0]" "t.out.r" -= "t.out.r" "t.a.out.r" -= "t.out.a" "t.a.out.a" -= "t.out.d.d[0]" "t.a.out.d.d[0]" -= "t.out.d.d[0]" "t.out.r" -= "t.in.d.d[0]" "t.in.r" -= "t.in.r" "t.a.in.r" -= "t.in.a" "t.a.in.a" -= "t.in.d.d[0]" "t.a.in.d.d[0]" -= "t.in.d.d[0]" "t.in.r"