encoder2d revd mdsn

This commit is contained in:
alexmadison 2022-03-22 16:29:30 +01:00
parent af2cedf54d
commit 9ad12dc951
8 changed files with 4967 additions and 841 deletions

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,49 @@
/*************************************************************************
*
* 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 globals;
import std::data;
open std::data;
open tmpl::dataflow_neuro;
defproc encoder2D_2x2 (a1of1 x[8]; a1of1 y[7]; avMx1of2<6> out){
encoder2D<3, 3, 8, 7, 1> e(.x=x, .y=y, .out=out);
bool _reset_B;
prs {
Reset => _reset_B-
}
e.supply.vss = GND;
e.supply.vdd = Vdd;
e.reset_B = _reset_B;
}
encoder2D_2x2 e;

View File

@ -0,0 +1,246 @@
watchall
mode run
system "echo '[] Set Out Ack/Valid Low'"
set e.out.a 0
set e.out.v 0
cycle
system "echo '[] Setting Neuron Req Low'"
set e.y[0].r 0
set e.y[1].r 0
set e.y[2].r 0
set e.y[3].r 0
set e.y[4].r 0
set e.y[5].r 0
set e.y[6].r 0
# set e.y[7].r 0
set e.x[0].r 0
set e.x[1].r 0
set e.x[2].r 0
set e.x[3].r 0
set e.x[4].r 0
set e.x[5].r 0
set e.x[6].r 0
set e.x[7].r 0
cycle
# # Slightly confused as to whether Reset should be set to 1 given A_2C_RB_X1 needs active high to change y
# # status X
# # set Reset 1
# # cycle
cycle
mode run
status X
status 0
set Reset 0
cycle
system "echo '[] Single Neuron Spikes (2,5), raise y[5].r'"
set e.y[5].r 1
# set e.x[2].r 1
cycle
assert e.e.Yarb.out.r 1
assert e.e.Xarb.out.r 0
assert e.e._x_v 0
system "echo '[] Raise x[2].r'"
# set e.y[5].r 1
set e.x[2].r 1
cycle
assert e.e.Yarb.out.r 1
assert e.e.Xarb.out.r 1
assert e.e._x_v 1
system "echo '[] Check Arbiter Acks'"
assert e.e._x_a_B 1
assert e.y[0].a 0
assert e.y[1].a 0
assert e.y[2].a 0
assert e.y[3].a 0
assert e.y[4].a 0
assert e.y[5].a 1
assert e.y[6].a 0
# assert e.y[7].a 0
assert e.e.Yarb.out.a 1
assert e.x[0].a 0
assert e.x[1].a 0
assert e.x[2].a 1
assert e.x[3].a 0
assert e.x[4].a 0
assert e.x[5].a 0
assert e.x[6].a 0
assert e.x[7].a 0
assert e.e.Xarb.out.a 1
system "echo '[] Check Encoders'"
assert e.e.x_enc_out.d[0].t 0
assert e.e.x_enc_out.d[0].f 1
assert e.e.x_enc_out.d[1].t 1
assert e.e.x_enc_out.d[1].f 0
assert e.e.x_enc_out.d[2].t 0
assert e.e.x_enc_out.d[2].f 1
assert e.e.y_enc_out.d[0].t 1
assert e.e.y_enc_out.d[0].f 0
assert e.e.y_enc_out.d[1].t 0
assert e.e.y_enc_out.d[1].f 1
assert e.e.y_enc_out.d[2].t 1
assert e.e.y_enc_out.d[2].f 0
system "echo '[] Check Buffer'"
assert e.e._in_x_v 1
assert e.e._in_y_v 1
assert e.e._en 1
assert e.out.d.d[0].t 0
assert e.out.d.d[0].f 1
assert e.out.d.d[1].t 1
assert e.out.d.d[1].f 0
assert e.out.d.d[2].t 0
assert e.out.d.d[2].f 1
assert e.out.d.d[3].t 1
assert e.out.d.d[3].f 0
assert e.out.d.d[4].t 0
assert e.out.d.d[4].f 1
assert e.out.d.d[5].t 1
assert e.out.d.d[5].f 0
system "echo '[] Finish Neuron Handshake'"
set e.y[5].r 0
set e.x[2].r 0
cycle
assert e.e.Yarb.out.r 0
assert e.e.Xarb.out.r 0
set e.out.a 1
set e.out.v 1
cycle
assert e.e.Yarb.out.a 0
assert e.e.Xarb.out.a 0
assert e.y[5].a 0
assert e.x[2].a 0
set e.out.a 0
set e.out.v 0
cycle
system "echo '[] Neuron (2,5) Encoded'"
system "echo '[] Single Neuron Spikes (0,0)'"
set e.y[0].r 1
set e.x[0].r 1
cycle
assert e.e.Yarb.out.r 1
assert e.e.Xarb.out.r 1
assert e.e._x_v 1
system "echo '[] Check Arbiter Acks'"
assert e.e._x_a_B 1
assert e.y[0].a 1
assert e.y[1].a 0
assert e.y[2].a 0
assert e.y[3].a 0
assert e.y[4].a 0
assert e.y[5].a 0
assert e.y[6].a 0
# assert e.y[7].a 0
assert e.e.Yarb.out.a 1
assert e.x[0].a 1
assert e.x[1].a 0
assert e.x[2].a 0
assert e.x[3].a 0
assert e.x[4].a 0
assert e.x[5].a 0
assert e.x[6].a 0
assert e.x[7].a 0
assert e.e.Xarb.out.a 1
system "echo '[] Check Encoders'"
assert e.e.y_enc_out.d[0].t 0
assert e.e.y_enc_out.d[0].f 1
assert e.e.y_enc_out.d[1].t 0
assert e.e.y_enc_out.d[1].f 1
assert e.e.y_enc_out.d[2].t 0
assert e.e.y_enc_out.d[2].f 1
assert e.e.x_enc_out.d[0].t 0
assert e.e.x_enc_out.d[0].f 1
assert e.e.x_enc_out.d[1].t 0
assert e.e.x_enc_out.d[1].f 1
assert e.e.x_enc_out.d[2].t 0
assert e.e.x_enc_out.d[2].f 1
system "echo '[] Check Buffer'"
assert e.e._in_x_v 1
assert e.e._in_y_v 1
assert e.e._en 1
assert e.out.d.d[0].t 0
assert e.out.d.d[0].f 1
assert e.out.d.d[1].t 0
assert e.out.d.d[1].f 1
assert e.out.d.d[2].t 0
assert e.out.d.d[2].f 1
assert e.out.d.d[3].t 0
assert e.out.d.d[3].f 1
assert e.out.d.d[4].t 0
assert e.out.d.d[4].f 1
assert e.out.d.d[5].t 0
assert e.out.d.d[5].f 1
system "echo '[] Finish Neuron Handshake'"
set e.y[0].r 0
set e.x[0].r 0
cycle
assert e.e.Yarb.out.r 0
assert e.e.Xarb.out.r 0
set e.out.a 1
set e.out.v 1
cycle
assert e.e.Yarb.out.a 0
assert e.e.Xarb.out.a 0
assert e.y[0].a 0
assert e.x[0].a 0
set e.out.a 0
set e.out.v 0
cycle
system "echo '[] Neuron (0,0) Encoded'"

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -34,21 +34,36 @@ cycle
# # cycle
cycle
mode run
status X
status 0
set Reset 0
cycle
system "echo '[] Single Neuron Spikes (2,5)'"
system "echo '[] Single Neuron Spikes (2,5), raise y[5].r'"
set e.y[5].r 1
set e.x[2].r 1
# set e.x[2].r 1
cycle
assert e.e.Yarb.out.r 1
assert e.e.Xarb.out.r 1
assert e.e.Xarb.out.r 0
assert e.e._x_v 0
system "echo '[] Raise x[2].r'"
# set e.y[5].r 1
set e.x[2].r 1
cycle
assert e.e.Yarb.out.r 1
assert e.e.Xarb.out.r 1
assert e.e._x_v 1
system "echo '[] Check Arbiter Acks'"
assert e.e._x_a_B 1
@ -76,13 +91,6 @@ assert e.e.Xarb.out.a 1
system "echo '[] Check Encoders'"
assert e.e.y_enc_out.d[0].t 1
assert e.e.y_enc_out.d[0].f 0
assert e.e.y_enc_out.d[1].t 0
assert e.e.y_enc_out.d[1].f 1
assert e.e.y_enc_out.d[2].t 1
assert e.e.y_enc_out.d[2].f 0
assert e.e.x_enc_out.d[0].t 0
assert e.e.x_enc_out.d[0].f 1
assert e.e.x_enc_out.d[1].t 1
@ -90,6 +98,13 @@ assert e.e.x_enc_out.d[1].f 0
assert e.e.x_enc_out.d[2].t 0
assert e.e.x_enc_out.d[2].f 1
assert e.e.y_enc_out.d[0].t 1
assert e.e.y_enc_out.d[0].f 0
assert e.e.y_enc_out.d[1].t 0
assert e.e.y_enc_out.d[1].f 1
assert e.e.y_enc_out.d[2].t 1
assert e.e.y_enc_out.d[2].f 0
system "echo '[] Check Buffer'"
assert e.e._in_x_v 1