From 8b44a11fd6660bbb11f5fc043194f5c5d79e357b Mon Sep 17 00:00:00 2001 From: alexmadison Date: Fri, 25 Mar 2022 18:57:18 +0100 Subject: [PATCH] added append, fixed bug in fifo --- dataflow_neuro/primitives.act | 60 ++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/dataflow_neuro/primitives.act b/dataflow_neuro/primitives.act index 540fa88..624ab34 100644 --- a/dataflow_neuro/primitives.act +++ b/dataflow_neuro/primitives.act @@ -165,7 +165,7 @@ namespace tmpl { fifo_element[i].supply = supply; fifo_element[i].reset_B = _reset_BXX[i]; ) - fifo_element[N-1].out = out; + fifo_element[M-1].out = out; // reset buffers bool _reset_BX; @@ -697,6 +697,7 @@ namespace tmpl { PULLUP_X4 pull_up(.a=nor_out, .y=out); } + export defproc line_end_pull_down (a1of1 in; bool? reset_B; power supply; bool! out) { bool _out, __out, nor_out; @@ -707,4 +708,61 @@ namespace tmpl { PULLUP_X4 pull_down(.a=nor_out, .y=out); } + + + + + /** + * Appends a hard-coded word "VAL" to an input. + * Works by piping through all sigs, but adding + * some extra sigs when the input is valid. + * N is size of channel to pipe through. + * NVAL is size of word to be put on output. + * VAL is word to be put on output. + * + */ + export template + defproc append (avMx1of2 in; avMx1of2 out; power supply) + { + { N >= 0 : "What?" }; + { NVAL >= 0 : "What?" }; + { NVAL < 1< in_val(.supply = supply); + (i:N: + in_val.in.d[i].t = in.d.d[i].t; + in_val.in.d[i].f = in.d.d[i].f; + ) + + // wire through most signals + (i:N: + in.d.d[i].t = out.d.d[i].t; + in.d.d[i].f = out.d.d[i].f; + ) + in.a = out.a; + in.v = out.v; + + // appender + pint bitval; + sigbuf sb(.in = in_val.out, .supply = supply); + TIELO_X1 tielows[NVAL]; + (i:NVAL:tielows[i].vss = supply.vss; tielows[i].vdd = supply.vdd;) + (i:0..NVAL-1: + bitval = (VAL & ( 1 << i )) >> i; + [ bitval = 1 -> + out.d.d[i+N].t = sb.out[i]; + out.d.d[i+N].f = tielows[i].y; + [] bitval = 0 -> + out.d.d[i+N].f = sb.out[i]; + out.d.d[i+N].t = tielows[i].y; + [] bitval >= 2 -> {false : "fuck"}; + ] + ) + + } + + + + }}