Skip to content

Commit

Permalink
cfu-playground: Bumped version of CFU Playground, updated patches
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Latosinski <[email protected]>
  • Loading branch information
glatosinski committed May 8, 2024
1 parent e051fe1 commit c3b374c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 10166d5dd37346fc74fc8f97f6d729c5e406c5bc Mon Sep 17 00:00:00 2001
From 562bed8f33aaf44ed9eccc4ce8466352cfb8a5e1 Mon Sep 17 00:00:00 2001
From: Grzegorz Latosinski <[email protected]>
Date: Tue, 27 Dec 2022 21:57:11 +0100
Subject: [PATCH] Adjusted CFU-Playground for external project development
Date: Wed, 8 May 2024 09:29:38 +0200
Subject: [PATCH 1/2] Adjusted CFU-Playground for external project development

This commit adjusts CFU Playground so the CFU_ROOT and
PROJ_DIR directories can be provided as environment
Expand All @@ -18,19 +18,19 @@ Signed-off-by: Grzegorz Latosinski <[email protected]>
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/proj/proj.mk b/proj/proj.mk
index 55582d3d..bd916728 100644
index 720415d9..7c6f9c06 100644
--- a/proj/proj.mk
+++ b/proj/proj.mk
@@ -48,7 +48,7 @@
@@ -53,7 +53,7 @@ export UART_SPEED = 115200
endif

export UART_SPEED ?= 1843200
export PROJ := $(lastword $(subst /, ,${CURDIR}))
-export CFU_ROOT := $(realpath $(CURDIR)/../..)
+export CFU_ROOT ?= $(realpath $(CURDIR)/../..)
export PLATFORM ?= common_soc
export TARGET ?= digilent_arty
export TTY ?= $(or $(wildcard /dev/ttyUSB?), $(wildcard /dev/ttyACM?))
@@ -213,9 +213,9 @@ ifneq '$(SW_ONLY)' '1'
@@ -220,9 +220,9 @@ ifneq '$(SW_ONLY)' '1'
pushd $(BUILD_DIR)/renode && cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TRACE=$(ENABLE_TRACE_ARG) -DTRACE_DEPTH_VAL=$(VERILATOR_TRACE_DEPTH) \
-DINCLUDE_DIR="$(PROJ_DIR)" -DVTOP="$(CFU_VERILOG)" -DVIL_DIR="$(VIL_DIR)" $${VERILATOR_PATH:+"-DUSER_VERILATOR_DIR=$$VERILATOR_PATH"} \
-DTRACE_FILEPATH="$(VERILATOR_TRACE_PATH)" "$(RVI_DIR)" && make libVtop && popd
Expand Down Expand Up @@ -78,5 +78,5 @@ index 1ced95ee..daa3780d 100644
CFU_ARGS:= --cpu-cfu $(CFU_V)
TARGET_ARGS:= --target $(TARGET)
--
2.38.1
2.43.0

14 changes: 7 additions & 7 deletions cfu-playground/0002-common-perf-Added-simple-cycle-counter.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From 8a5959bbb08706f73946db4dd8007e7fde2a2065 Mon Sep 17 00:00:00 2001
From 4ccf5152db7ec01bef42f9a430b1909e6e05f0d3 Mon Sep 17 00:00:00 2001
From: Grzegorz Latosinski <[email protected]>
Date: Tue, 27 Dec 2022 23:36:30 +0100
Date: Wed, 8 May 2024 09:30:43 +0200
Subject: [PATCH 2/2] common: perf: Added simple cycle counter

Signed-off-by: Grzegorz Latosinski <[email protected]>
Expand All @@ -23,10 +23,10 @@ index 60f2ca92..553a3a44 100644
void perf_print_human(uint64_t n) {
if (n > 9999999) {
diff --git a/common/src/perf.h b/common/src/perf.h
index dae94b42..6145e70e 100644
index bfd822fc..4f8ca40e 100644
--- a/common/src/perf.h
+++ b/common/src/perf.h
@@ -30,6 +30,7 @@ extern "C" {
@@ -33,6 +33,7 @@ extern "C" {
#define NUM_PERF_COUNTERS 0
#endif

Expand All @@ -35,7 +35,7 @@ index dae94b42..6145e70e 100644
extern unsigned CFU_start_counts[NUM_PERF_COUNTERS];

diff --git a/common/src/tflite.cc b/common/src/tflite.cc
index 8991bc97..d6f0e963 100644
index 906fbda4..05850ce2 100644
--- a/common/src/tflite.cc
+++ b/common/src/tflite.cc
@@ -251,6 +251,7 @@ void tflite_classify() {
Expand All @@ -50,10 +50,10 @@ index 8991bc97..d6f0e963 100644
#endif
perf_print_value(end - start); // Possible overflow is intentional here.
printf(" cycles total\n");
+ printf("Tracked cycles: %lu\n", cycle_counter);
+ printf("Tracked cycles: %lu\n", cycle_counter);
}

int8_t* get_input() { return interpreter->input(0)->data.int8; }
--
2.38.1
2.43.0

2 changes: 1 addition & 1 deletion cfu-playground/clone-cfu-playground.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ git clone --recursive https://github.com/google/CFU-Playground.git

cd CFU-Playground

git checkout 328263b92abc8b607e02812db4d386b2759c2041
git checkout 0612528704a5d177235b3321d3ada2f2946c5e30

git am ../*.patch

Expand Down

0 comments on commit c3b374c

Please sign in to comment.