encoder1d with bd simmed

This commit is contained in:
alexmadison 2022-04-21 16:09:13 +02:00
parent e3237e6115
commit e6f1a31f68
6 changed files with 8677 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import "../../dataflow_neuro/cell_lib_async.act";
import "../../dataflow_neuro/cell_lib_std.act";
import "../../dataflow_neuro/treegates.act";
import "../../dataflow_neuro/primitives.act";
import "../../dataflow_neuro/interfaces.act";
// import tmpl::dataflow_neuro;
// import tmpl::dataflow_neuro;
import std::channel;
@ -1033,6 +1034,20 @@ defproc decoder_2d_hybrid (avMx1of2<NxC+NyC> in; bool! out_req_x[Nx], out_req_y[
}
/**
* Encoder 1d followed by some fifos then a qd2bdi conversion.
*/
export template<pint Nc, N, N_BUFFERS, N_BD_DLY_CFG>
defproc encoder1d_bd(a1of1 in[N]; bd<Nc> out; bool? dly_cfg[N_BD_DLY_CFG], reset_B; power supply) {
bool _reset_BX;
BUF_X4 rsb(.a = reset_B, .y = _reset_BX, .vdd = supply.vdd, .vss = supply.vss);
encoder1d_simple<Nc, N> _enc(.in = in, .reset_B = _reset_BX, .supply = supply);
fifo<Nc, N_BUFFERS> _fifo(.in = _enc.out, .reset_B = _reset_BX, .supply = supply);
qdi2bd<Nc, N_BD_DLY_CFG> _qdi2bd(.in = _fifo.out, .out = out, .dly_cfg = dly_cfg,
.reset_B = _reset_BX, .supply = supply);
}
/**
* Neuron handshaking.
* Looks for a rising edge on the neuron req.

View File

@ -0,0 +1,92 @@
initialize
load-scm "helper.scm"
random
set GND 0
set Vdd 1
set Reset 1
mode reset
cycle
status U
watchall
set c.dly_cfg[0] 1
set c.dly_cfg[1] 1
set c.dly_cfg[2] 1
set c.dly_cfg[3] 1
set c.in[0].r 0
set c.in[1].r 0
set c.in[2].r 0
set c.in[3].r 0
set c.in[4].r 0
set c.in[5].r 0
set c.in[6].r 0
set c.out.a 0
set Reset 1
cycle
status X
system "echo '[] Set reset 0'"
mode run
set Reset 0
cycle
system "echo '[] Reset finished'"
status X
assert-bd-channel-neutral "c.out" 3
assert c.in[0].a 0
assert c.in[1].a 0
assert c.in[2].a 0
assert c.in[3].a 0
assert c.in[4].a 0
assert c.in[5].a 0
assert c.in[6].a 0
system "echo '[] Spiking 3'"
set c.in[3].r 1
cycle
assert c.in[3].a 1
set c.in[3].r 0
cycle
assert c.in[3].a 0
system "echo '[] Spiking 6'"
set c.in[6].r 1
cycle
assert c.in[6].a 1
set c.in[6].r 0
cycle
assert c.in[6].a 0
system "echo '[] Receive 3'"
assert-bd-channel-valid "c.out" 3 3
set c.out.a 1
cycle
assert-bd-channel-neutral "c.out" 3
set c.out.a 0
cycle
system "echo '[] Receive 6'"
assert-bd-channel-valid "c.out" 3 6
set c.out.a 1
cycle
assert-bd-channel-neutral "c.out" 6
set c.out.a 0
cycle

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
/*************************************************************************
*
* 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 globals;
import std::data;
open std::data;
open tmpl::dataflow_neuro;
pint N = 7;
pint Nc = std::ceil_log2(N);
pint N_BUFFERS = 5;
pint N_BD_DLY_CFG = 4;
defproc _encoder1d_bd (a1of1 in[N]; bd<Nc> out; bool? dly_cfg[N_BD_DLY_CFG]) {
bool _reset_B;
prs {
Reset => _reset_B-
}
power supply;
supply.vdd = Vdd;
supply.vss = GND;
encoder1d_bd<Nc, N, N_BUFFERS, N_BD_DLY_CFG> c(.in = in, .out = out, .dly_cfg = dly_cfg,
.reset_B = _reset_B, .supply = supply);
}
// fifo_decoder_neurons_encoder_fifo e;
_encoder1d_bd c;

View File

@ -0,0 +1,82 @@
watchall
set c.dly_cfg[0] 1
set c.dly_cfg[1] 1
set c.dly_cfg[2] 1
set c.dly_cfg[3] 1
set c.in[0].r 0
set c.in[1].r 0
set c.in[2].r 0
set c.in[3].r 0
set c.in[4].r 0
set c.in[5].r 0
set c.in[6].r 0
set c.out.a 0
set Reset 1
cycle
status X
system "echo '[] Set reset 0'"
mode run
set Reset 0
cycle
system "echo '[] Reset finished'"
status X
assert-bd-channel-neutral "c.out" 3
assert c.in[0].a 0
assert c.in[1].a 0
assert c.in[2].a 0
assert c.in[3].a 0
assert c.in[4].a 0
assert c.in[5].a 0
assert c.in[6].a 0
system "echo '[] Spiking 3'"
set c.in[3].r 1
cycle
assert c.in[3].a 1
set c.in[3].r 0
cycle
assert c.in[3].a 0
system "echo '[] Spiking 6'"
set c.in[6].r 1
cycle
assert c.in[6].a 1
set c.in[6].r 0
cycle
assert c.in[6].a 0
system "echo '[] Receive 3'"
assert-bd-channel-valid "c.out" 3 3
set c.out.a 1
cycle
assert-bd-channel-neutral "c.out" 3
set c.out.a 0
cycle
system "echo '[] Receive 6'"
assert-bd-channel-valid "c.out" 3 6
set c.out.a 1
cycle
assert-bd-channel-neutral "c.out" 6
set c.out.a 0
cycle