decoder 2d hybrid unit tests working

This commit is contained in:
alexmadison 2022-03-31 18:00:08 +02:00
parent 2c491a6e37
commit c840273ae6
6 changed files with 10826 additions and 9 deletions

View File

@ -270,6 +270,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,
reset_B; power supply) {
bool hs_enB;
INV_X4 hs_inv(.a = hs_en, .y = hs_enB, .vdd = supply.vdd, .vss = supply.vss);
// Buffer to recieve concat(x,y) address packet
buffer<NxC+NyC> addr_buf(.in = in, .reset_B = reset_B, .supply = supply);
@ -323,10 +326,11 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
// bc smaller
// and bc the delay that an AND induces means that the pullup could
// end up fighting a synapse pulldown, as both have the correct req sigs.
A_1P_U_X4 pu[Nx]; // TODO probably replace this with variable strength PU
A_2P_U_X4 pu[Nx]; // TODO probably replace this with variable strength PU
A_1P_U_X4 pu_reset[Nx];
(i:Nx:
pu[i].a = d_dr_xX[i].out[Ny];
pu[i].b = hs_enB;
pu[i].y = _out_acksB[i];
pu[i].vdd = supply.vdd;
pu[i].vss = supply.vss;
@ -354,17 +358,15 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
// _only_ once _both_ ackB has been reset, _and_ its output data
// has been fully invalidated.
// Otherwise run into the issue that ack is removed before data is invalid.
A_2C_B_X1 buf_ack_Cel(.c1 = _ortree.out, .c2 = valid_Cel.y, .y = addr_buf.out.a,
A_2C_B_X1 buf_ack_Cel(.c1 = _ortree.out, .c2 = valid_Cel.y,
.vdd = supply.vdd, .vss = supply.vss);
// Mux to switch between acks from handshake or delay
MUX2_X1 ack_mux(.s = hs_en, .a = valid_Cel.y, .b = buf_ack_Cel.y,
.vdd = supply.vdd, .vss = supply.vss);
// Programmable delay
delayprog<N_dly_cfg> dly(.s = dly_cfg, .supply = supply);
dly.out = addr_buf.out.a;
delayprog<N_dly_cfg> dly(.in = ack_mux.y, .out = addr_buf.out.a, .s = dly_cfg, .supply = supply);
}
@ -739,7 +741,7 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; a1of1 out[Nx*Ny]; bool? dly_cfg
// y_req pull up
NAND2_X1 nand_y(.a = _y_a_B, .b = _req, .vdd = supply.vdd, .vss = supply.vss);
A_1P_U_X4 pu_y(.a = nand_y.y, .y = outy.r, .vdd = supply.vdd, .vss = supply.vss);
// x_req pull up
NAND3_X1 nand_x(.a = _x_a_B, .b = _req, .c = outy.a, .vdd = supply.vdd, .vss = supply.vss);
A_1P_U_X4 pu_x(.a = nand_x.y, .y = outx.r, .vdd = supply.vdd, .vss = supply.vss);

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
/*************************************************************************
*
* 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/coders.act";
import "../../dataflow_neuro/primitives.act";
import "../../dataflow_neuro/cell_lib_async.act";
import "../../dataflow_neuro/cell_lib_std.act";
import globals;
import std::data;
open std::data;
open tmpl::dataflow_neuro;
defproc decoder_2d_hybrid_2x4 (avMx1of2<3> in; a1of1 out[8]; bool? dly_cfg[4], hs_en){
bool _reset_B;
prs {
Reset => _reset_B-
}
power supply;
supply.vdd = Vdd;
supply.vss = GND;
decoder_2d_hybrid<1,2,2,4,4> decoder(.in = in, .out = out, .dly_cfg = dly_cfg, .hs_en = hs_en,
.reset_B = _reset_B, .supply = supply);
// model the synapse as having automatic pulldown of ack.
INV_X1 synapses[8];
PULLDOWN_X4 synapses2[8];
(i:8:
synapses[i].a = decoder.out[i].r;
synapses2[i].a = synapses[i].y;
synapses2[i].y = decoder.out[i].a;
synapses[i].vss = supply.vss;
synapses[i].vdd = supply.vdd;
synapses2[i].vss = supply.vss;
synapses2[i].vdd = supply.vdd;
)
}
// fifo_decoder_neurons_encoder_fifo e;
decoder_2d_hybrid_2x4 e;

View File

@ -0,0 +1,341 @@
watchall
set e.out[0].a 0
set e.out[1].a 0
set e.out[2].a 0
set e.out[3].a 0
set e.out[4].a 0
set e.out[5].a 0
set e.out[6].a 0
set e.out[7].a 0
set e.dly_cfg[0] 0
set e.dly_cfg[1] 0
set e.dly_cfg[2] 0
set e.dly_cfg[3] 0
set e.hs_en 1
set-qdi-channel-neutral "e.in" 3
set Reset 1
cycle
mode run
system "echo '[] Set reset 0'"
status X
set Reset 0
cycle
system "echo '[] Sending in a 7 packet'"
set-qdi-channel-valid "e.in" 3 7
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 1
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
system "echo '[] Synapse [7] gives ack'"
set e.out[7].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 0
assert e.in.v 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
system "echo '[] Sending in a 5 packet'"
set-qdi-channel-valid "e.in" 3 5
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 1
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
system "echo '[] Synapse [5] gives ack'"
set e.out[5].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 0
assert e.in.v 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
system "echo '[] Sending in a 1 packet'"
set-qdi-channel-valid "e.in" 3 1
cycle
assert e.out[0].r 0
assert e.out[1].r 1
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Synapse [1] gives ack'"
set e.out[1].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input, enabling delays'"
set-qdi-channel-neutral "e.in" 3
cycle
assert e.in.a 0
assert e.in.v 0
system "echo '[] Enabling delays'"
cycle
set e.dly_cfg[0] 1
set e.dly_cfg[1] 1
set e.dly_cfg[2] 1
set e.dly_cfg[3] 1
system "echo '[] Sending in a 7 packet, with delays'"
set-qdi-channel-valid "e.in" 3 7
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 1
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
system "echo '[] Synapse [7] gives ack'"
set e.out[7].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 0
assert e.in.v 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
system "echo '[] Sending in a 5 packet'"
set-qdi-channel-valid "e.in" 3 5
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 1
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
system "echo '[] Synapse [5] gives ack'"
set e.out[5].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 0
assert e.in.v 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
system "echo '[] Sending in a 1 packet'"
set-qdi-channel-valid "e.in" 3 1
cycle
assert e.out[0].r 0
assert e.out[1].r 1
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Synapse [1] gives ack'"
set e.out[1].a 1
cycle
assert e.out[0].r 0
assert e.out[1].r 0
assert e.out[2].r 0
assert e.out[3].r 0
assert e.out[4].r 0
assert e.out[5].r 0
assert e.out[6].r 0
assert e.out[7].r 0
assert e.out[0].a 0
assert e.out[1].a 0
assert e.out[2].a 0
assert e.out[3].a 0
assert e.out[4].a 0
assert e.out[5].a 0
assert e.out[6].a 0
assert e.out[7].a 0
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input, disabling handshaking'"
set-qdi-channel-neutral "e.in" 3
cycle
assert e.in.a 0
assert e.in.v 0
set e.hs_en 0
cycle
system "echo '[] Sending in a 0, handshaking disabled'"
set-qdi-channel-valid "e.in" 3 0
cycle
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
cycle
assert e.in.a 0
assert e.in.v 0
system "echo '[] Sending in a 7, handshaking disabled'"
set-qdi-channel-valid "e.in" 3 7
cycle
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
cycle
assert e.in.a 0
assert e.in.v 0
system "echo '[] Sending in a 5, handshaking disabled'"
set-qdi-channel-valid "e.in" 3 5
cycle
assert e.in.a 1
assert e.in.v 1
system "echo '[] Removing input'"
set-qdi-channel-neutral "e.in" 3
cycle
assert e.in.a 0
assert e.in.v 0