From c5c5f2145da70ad95f0d1f863f5e2888c78bb174 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Wed, 14 Oct 2020 17:17:40 +0200
Subject: [PATCH] [Docs] document flushing requirement after AXI lite
 read/write

---
 finn-rtllib/memstream/doc/README                          | 7 +++++--
 src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py | 6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/finn-rtllib/memstream/doc/README b/finn-rtllib/memstream/doc/README
index fefa531bd..f4f99542c 100644
--- a/finn-rtllib/memstream/doc/README
+++ b/finn-rtllib/memstream/doc/README
@@ -1,3 +1,7 @@
+IMPORTANT: After using AXI lite to either read or write the weights,
+always "flush" the accelerator by first passing a dummy input
+vector through the accelerator. This will get rid of any old
+weight data from the weight FIFOs.
 
 Memory Streamer Address Map
 
@@ -37,6 +41,5 @@ C        | N/A
 
 To perform a write to mem[0], the AXI master writes to AXI Addr 0,4,8 in any
 order, then writes to AXI Addr 0xC to commit the write. To read mem[1][63:32],
-the AXI master reads from AXI Addr 0x14. The words of mem can be written to or 
+the AXI master reads from AXI Addr 0x14. The words of mem can be written to or
 read from in any order.
-
diff --git a/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py b/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py
index cdb5c7727..1fa023640 100644
--- a/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py
+++ b/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py
@@ -99,6 +99,12 @@ class StreamingFCLayer_Batch(HLSCustomOp):
             # (mem_mode = decoupled only) whether weights will be writable through
             # an AXI-lite interface during runtime
             # 1 for enabled, 0 for disabled.
+            # see finn-rtllib/memstream/doc/README for more about the memory
+            # address map used for writable weights
+            # IMPORTANT: After using AXI lite to either read or write the weights,
+            # always "flush" the accelerator by first passing a dummy input
+            # vector through the accelerator. This will get rid of any old
+            # weight data from the weight FIFOs.
             "runtime_writeable_weights": ("i", False, 0),
         }
         my_attrs.update(super().get_nodeattr_types())
-- 
GitLab