Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM OpenMP runtime #109

Open
wants to merge 117 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
cb36d27
[software] Add kmp and move omp to gomp
sant0s12 Mar 26, 2024
347246a
[software] Call real main only from core 0
sant0s12 Mar 26, 2024
ec539ae
[software] Use lld when compiling with clang (fixes linking C++)
sant0s12 Mar 26, 2024
d8f9563
[software] Implement basic barrier after parallel block
sant0s12 Apr 2, 2024
53f1dc6
[software] Put sbss in l2
sant0s12 Apr 3, 2024
ff00eb6
[software] Disable C++ exceptions and set std to c++20
sant0s12 Apr 3, 2024
9496ca8
[software] Use simple l1 allocator for C++ heap
sant0s12 Apr 3, 2024
3d28c6b
[software] Restructure
sant0s12 Apr 4, 2024
a415c79
[software] Add clangd config
sant0s12 Apr 9, 2024
f269d31
[software] Switch main wrapper to cpp
sant0s12 Apr 9, 2024
75d3019
[software] Add ETL
sant0s12 Apr 13, 2024
6dc0ddf
[software] Init globals
sant0s12 Apr 13, 2024
eca417c
[software] Redo barrier
sant0s12 Apr 13, 2024
02ebe9d
[software] Restructure running tasks
sant0s12 Apr 13, 2024
589d960
[software] Implement mutex
sant0s12 Apr 14, 2024
8590b97
[software] Fix barrier
sant0s12 Apr 14, 2024
762f2b5
[software] Port barrier_test1 to kmp
sant0s12 Apr 14, 2024
fc443fa
[software] Restructure
sant0s12 Apr 14, 2024
262129f
[software] Add reference counting to barrier and use std::atomic
sant0s12 Apr 14, 2024
5ee5337
[software] Add support for omp_get_num_threads and omp_get_thread_num
sant0s12 Apr 14, 2024
4906596
[software] Port omp_parallel_test and barrier_test_2
sant0s12 Apr 14, 2024
393754b
[software] Disable stdlib
sant0s12 Apr 15, 2024
5f4d39c
[software] Use std::atomic in main_wrapper
sant0s12 Apr 15, 2024
d2039dd
[software] Implement getCurrentThread
sant0s12 Apr 15, 2024
7fee82b
[software] Add support for assert()
sant0s12 Apr 16, 2024
1191ce4
[software] ETL follow NDEBUG and suppress library warnings
sant0s12 Apr 16, 2024
17a6b25
[software] Implement static for loops
sant0s12 Apr 19, 2024
7cc9fdc
[software] Port omp_parallel_for test
sant0s12 Apr 19, 2024
32efe63
[software] Lock allocator since it's not thread safe
sant0s12 Apr 20, 2024
8b8694c
[software] Implement shared pointer
sant0s12 Apr 20, 2024
4d05fe1
[software] Switch barrier to shared pointer
sant0s12 Apr 20, 2024
158e003
[software] Add teams
sant0s12 Apr 21, 2024
05d32a4
[software] Implement dynamic worksharing
sant0s12 Apr 21, 2024
973794d
[software] Port parallel for benchmark
sant0s12 Apr 22, 2024
0be5a78
[software] Include <memory> to build verilator on new clang
sant0s12 Apr 22, 2024
96abc74
[software] Add stack tracing to tracevis
sant0s12 Apr 27, 2024
d940c07
[software] Print PC on stack overflow detection
sant0s12 Apr 27, 2024
e31c56b
[software] Remove debug printing and update gen_trace
sant0s12 Apr 27, 2024
cb32d65
[software] Warn on large stack usage
sant0s12 Apr 27, 2024
fd509bd
[software] Tweak tracing Makefile
sant0s12 Apr 27, 2024
12252d8
[software] Put microtask on the heap, debug print and inlining
sant0s12 Apr 27, 2024
58a9bcd
[software] Implement master, single and reduction
sant0s12 Apr 28, 2024
432a2ab
[software] Remove barrier_test2
sant0s12 Apr 28, 2024
44faf07
[software] Automate benchmarks
sant0s12 May 5, 2024
fd320fa
[software] Heap allocate task args
sant0s12 May 11, 2024
69b3f7e
[software] Add .clang-tidy
sant0s12 May 11, 2024
6405a6b
[software] Save figures to folder based on git commit
sant0s12 May 11, 2024
b226f4e
[software] Don't format external dependencies
sant0s12 May 11, 2024
53c52eb
[software] Fix tracevis cycles
sant0s12 May 11, 2024
34c20da
[software] Remove wfi from main wrapper
sant0s12 May 11, 2024
e0e5199
[software] Implement intitial performance optimizations
sant0s12 May 11, 2024
10c212b
[software] Specify dwarf version
sant0s12 May 11, 2024
813cd52
[software] Fix formatting and add some barrier debugging
sant0s12 May 11, 2024
3ce6698
[software] Add minpool config with no xpulp extensions
sant0s12 May 11, 2024
5fecba5
[software] Improve barrier performance
sant0s12 May 11, 2024
070ada7
[software] Move benchmarking scripts
sant0s12 May 11, 2024
2f07136
[software] Implement automated testing
sant0s12 May 12, 2024
db885e6
[software] Fix barrier test failing
sant0s12 May 14, 2024
bf1503c
[software] Add banshee config
sant0s12 May 15, 2024
c03ce4a
[software] Add banshee target
sant0s12 May 15, 2024
ebad7da
[software] Fix atomic test failing
sant0s12 May 17, 2024
e1f1cab
[software] Use testing framework in atomic test
sant0s12 May 17, 2024
75c4c14
[software] Update .clang-tidy
sant0s12 May 17, 2024
8ba2635
[software] Update critical test
sant0s12 May 17, 2024
3e7fbb9
[software] Update master test
sant0s12 May 17, 2024
92c9604
[software] Add neq and print failure location
sant0s12 May 18, 2024
8774ceb
[software] Try to optimise team creation
sant0s12 May 20, 2024
2f2c566
[software] Handle error 117
sant0s12 May 21, 2024
e26f110
[software] Fix dynamic schedule invalidation for default team
sant0s12 May 21, 2024
dbecab3
[software] Fix barrier race contidion on banshee
sant0s12 May 21, 2024
05ff6f6
[software] Fix dynamic for loop and other optimizations
sant0s12 May 21, 2024
4b32bb5
[software] Update scripts
sant0s12 May 21, 2024
dc0b40c
[software] Fix clang warnings
sant0s12 May 26, 2024
7e46d6c
[software] Update .clangd and .clang-tidy
sant0s12 May 26, 2024
5467e1b
[software] Fix init array
sant0s12 May 26, 2024
29a7eed
[software] Invalidate schedule only when all threads are done
sant0s12 May 26, 2024
c0fd9c5
[software] Fix formatting
sant0s12 May 26, 2024
c77a242
[software] Update omp benchmarks
sant0s12 May 26, 2024
2b35f55
[changelog] Update changelog
sant0s12 May 26, 2024
e3dec88
[software] Move tests and apps to gomp and set default compiler
sant0s12 May 27, 2024
87c5501
[config] Fix minpool-no-xpulp config
sant0s12 May 28, 2024
73815a3
[software] Fix RISCV_ARCH
sant0s12 May 29, 2024
d8481b2
[software] Avoid microtask args allocation
sant0s12 May 30, 2024
1a012e4
[software] Add initial teams support
sant0s12 May 30, 2024
ab0b45d
[software] Add num_teams, thread_limit and distribute
sant0s12 Jun 1, 2024
a350536
[software] Fix kmp tests failing on RTL
sant0s12 Jun 11, 2024
9af2367
[software] Remove output file
sant0s12 Jun 11, 2024
a272a8b
[software] Add test repetition option
sant0s12 Jun 11, 2024
e9802b0
[software] Format python scripts
sant0s12 Jun 11, 2024
6894519
[software] Add license headers
sant0s12 Jun 11, 2024
2aee4a5
[software] Join kmp and gomp apps and tests
sant0s12 Jun 13, 2024
15f4570
[software] Remove frame size warning
sant0s12 Jun 13, 2024
31ab3db
[software] Fix warnings
sant0s12 Jun 13, 2024
589c861
[software] Fix formatting
sant0s12 Jun 13, 2024
7553a40
[software] Re-add data.h
sant0s12 Jun 13, 2024
41ccc3c
[software] Re-add -lgcc
sant0s12 Jun 13, 2024
4f6650a
[software] Fix parallel for private test
sant0s12 Jun 13, 2024
36c060e
[software] Jump to _eoc on abort
sant0s12 Jun 13, 2024
22b13ee
[software] Simplify omp dynamic schedule
sant0s12 Jun 13, 2024
2fbe8eb
[software] Update benchmarking scripts
sant0s12 Jun 13, 2024
2da7935
[software] Fix warnings
sant0s12 Jun 13, 2024
164fd09
[software] Only put COMMON in L1
sant0s12 Jun 16, 2024
1491897
[software] Fix teams
sant0s12 Jun 16, 2024
acc9265
[software] Move benchmark and testing scripts
sant0s12 Jun 16, 2024
262054f
[software] Add sections test
sant0s12 Jun 16, 2024
db383a7
[software] Remove etl since it is not used
sant0s12 Jun 21, 2024
26746e1
[software] Fix deadlock when deleting team
sant0s12 Jun 22, 2024
7d8bc21
[software] Use getThread(gtid)
sant0s12 Jun 22, 2024
1243194
[software] Fix runner.py and linting
sant0s12 Jun 22, 2024
2732157
[software] Put globals with locks in L1 also for gomp
sant0s12 Jun 27, 2024
0bd9344
[software] Move copyPrivate and implement minor performance tweaks
sant0s12 Jun 27, 2024
2a188b0
[software] Update runner.py to always return output
sant0s12 Jul 1, 2024
cf9ee77
[software] Fix tracevis
sant0s12 Jul 1, 2024
8c50cf2
[software] Fix lint
sant0s12 Jul 1, 2024
940d43c
[software] Put entire bss in L1, fixes riscv-tests
sant0s12 Jul 1, 2024
adade21
[software] Fix warnings
sant0s12 Jul 1, 2024
7321549
[changelog] Update changelog
sant0s12 Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
Checks: >
bugprone-*,
cppcoreguidelines-*,
performance-*,
readability-*,$
clang-analyzer-*,
misc-unused-parameters,

-bugprone-easily-swappable-parameters,
-bugprone-reserved-identifier,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-avoid-non-const-global-variables,

WarningsAsErrors: ''
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
google-readability-namespace-comments.ShortNamespaceLines: '10'
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
llvm-else-after-return.WarnOnUnfixable: 'false'
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
google-readability-namespace-comments.SpacesBeforeComments: '2'
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
google-readability-braces-around-statements.ShortStatementLines: '1'
google-readability-function-size.StatementThreshold: '800'
llvm-qualified-auto.AddConstToQualified: 'false'
llvm-else-after-return.WarnOnConditionVariables: 'false'
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
cppcoreguidelines-avoid-do-while.IgnoreMacros: 'true'
SystemHeaders: false
...

29 changes: 29 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CompileFlags:
Add: [
-std=c++17,
-D__riscv,
-DNUM_CORES,
-DNUM_CORES_PER_TILE,
-DNUM_GROUPS,
-DSTACK_SIZE,
-DXQUEUE_SIZE,
-DSEQ_MEM_SIZE,
-DBANKING_FACTOR,
-DETL_CHECK_PUSH_POP,
-DETL_LOG_ERRORS,
-DETL_VERBOSE_ERRORS
]

---

If:
PathMatch: [.*/runtime/.*/.*]
CompileFlags:
Add: [-xc++, -I..]

---

If:
PathMatch: [.*/tests/.*/.*]
CompileFlags:
Add: [-xc++, -I.., -I../../runtime/]
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `apb` dependency of version 0.2.4
- Add support for the `FENCE` instruction
- Add support for DRAMsys5.0 co-simulation
- Add KMP runtime
- Add new runtime testing infrastructure
- Add automated benchmark running and plotting
- Add clangd and clang-tidy configs
- Add Banshee config
- Add OpenMP sections and teams tests

### Changes
- Add physical feasible TeraPool configuration with SubGroup hierarchy.
Expand All @@ -33,12 +39,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Update `common_verification` to 0.2.3
- Update `register_interface` to 0.4.3
- Updated Halide to version 15
- Include SP in Snitch traces to aid in building better tracevis
- Make the `tracevis` target depend on the `trace` target and use `-cf`
- Rename the `omp` runtime directory to `gomp`
- Link with `lld` when using clang

### Fixed
- Fix type issue in `snitch_addr_demux`
- Properly disable the debugging CSRs in ASIC implementations
- Fix a bug in the DMA's distributed midend
- Fix bugs in radix2, radix4by2 parallelization and loading of data for radix4 CFFT
- Fix building verilator on newer clang and gcc versions
- Fix tracing targets missing some harts
- Fix clang warnings about the .comment section

## 0.6.0 - 2023-01-09

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ tc-llvm:
-DCMAKE_INSTALL_PREFIX=$(LLVM_INSTALL_DIR) \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DCMAKE_C_COMPILER=$(CC) \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD="RISCV;host" \
-DLLVM_BUILD_DOCS="0" \
-DLLVM_ENABLE_BINDINGS="0" \
Expand Down Expand Up @@ -146,7 +146,7 @@ $(BENDER_INSTALL_DIR)/bender:
verilator: $(VERILATOR_INSTALL_DIR)/bin/verilator
$(VERILATOR_INSTALL_DIR)/bin/verilator: toolchain/verilator Makefile
cd $<; unset VERILATOR_ROOT; \
autoconf && CC=$(CLANG_CC) CXX=$(CLANG_CXX) CXXFLAGS=$(CLANG_CXXFLAGS) LDFLAGS=$(CLANG_LDFLAGS) ./configure --prefix=$(VERILATOR_INSTALL_DIR) $(VERILATOR_CI) && \
autoconf && CC=$(CLANG_CC) CXX=$(CLANG_CXX) CXXFLAGS="$(CLANG_CXXFLAGS) -include memory" LDFLAGS=$(CLANG_LDFLAGS) ./configure --prefix=$(VERILATOR_INSTALL_DIR) $(VERILATOR_CI) && \
make -j4 && make install

# Update and patch hardware dependencies for MemPool
Expand Down
53 changes: 53 additions & 0 deletions banshee-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2021 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

---
address:
scratch_reg: 0x40000000
wakeup_reg: 0x40000004
tcdm_start: 0x40000008
tcdm_end: 0x4000000C
nr_cores: 0x40000010
uart: 0xC0000000
# Not supported in MemPool
barrier_reg:
start: 0x50000000
offset: 0x100000
cluster_base_hartid: 0x50000001
cluster_num: 0x50000002
cluster_id: 0x50000003
cl_clint: 0x40000060
clint: 0xFFFF0000
memory:
tcdm:
start: 0x0
size: 0x100000
offset: 0x100000
latency: 5
dram:
start: 0x80000000
size: 0x01000000
offset: 0x0
latency: 10
periphs:
start: 0x40000000
size: 0x20000
offset: 0x0
latency: 5
callbacks:
- name: zero-memory
size: 0x10000
- name: mempool-dma
size: 0x1C
inst_latency:
mul: 3
mulh: 3
mulhsu: 3
mulhu: 3
div: 3
divu: 3
rem: 3
remu: 3
ssr:
num_dm: 3
14 changes: 14 additions & 0 deletions config/minpool-no-xpulp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2021 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Author: Matheus Cavalcante, ETH Zurich

###############
## MinPool ##
###############

include $(MEMPOOL_DIR)/config/minpool.mk

# Disable Xpulpimg
xpulpimg ?= 0
22 changes: 17 additions & 5 deletions hardware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ TOOLCHAIN_DIR := $(abspath $(ROOT_DIR)/../toolchain)
config_mk = $(abspath $(ROOT_DIR)/../config/config.mk)
include $(config_mk)

# Banshee config
banshee_config = $(MEMPOOL_DIR)/banshee-config.yaml

# build path
buildpath ?= build
resultpath ?= results
Expand Down Expand Up @@ -319,6 +322,13 @@ verilate: $(VERILATOR_EXE) $(buildpath) Makefile
# Avoid capturing the return status when running the load-throughput analysis
if [ $(tg) -ne 1 ]; then ./scripts/return_status.sh $(buildpath)/transcript; fi

################
# Banshee #
################

banshee:
banshee --configuration $(banshee_config) --num-clusters 1 --num-cores $(num_cores) -l $(preload)

#############
# Lint #
#############
Expand All @@ -340,11 +350,13 @@ spyglass/tmp/files: $(bender)
trace_env += NUM_CORES=$(num_cores)
trace_env += SEQ_MEM_SIZE=$(seq_mem_size)

.PHONY: benchmark trace log pre_trace post_trace tracevis

benchmark: log simcvcs
# Call `make` again to get variable extension with all traces
result_dir=$(result_dir) $(MAKE) trace

trace: pre_trace $(trace) post_trace
trace: post_trace

log:
mkdir -p "$(result_dir)"
Expand All @@ -361,20 +373,20 @@ log:
pre_trace:
rm -rf $(tracepath)

post_trace:
post_trace: $(trace)
mkdir -p "$(result_dir)"
cp $(buildpath)/transcript "$(result_dir)/" | true
cp $(traceresult) "$(result_dir)"
cp $(trace) "$(result_dir)"
$(python) $(ROOT_DIR)/scripts/gen_avg.py --folder "$(result_dir)" | tee $(result_dir)/avg.txt

$(buildpath)/%.trace: $(buildpath)/%.dasm
$(buildpath)/%.trace: $(buildpath)/%.dasm pre_trace
mkdir -p $(tracepath)
$(INSTALL_DIR)/riscv-isa-sim/bin/spike-dasm < $< > $(tracepath)/$*
$(trace_env) $(python) $(ROOT_DIR)/scripts/gen_trace.py -p --csv $(traceresult) $(tracepath)/$* > $@

tracevis:
$(MEMPOOL_DIR)/scripts/tracevis.py $(preload) $(buildpath)/*.trace -o $(buildpath)/tracevis.json
tracevis: $(trace)
$(MEMPOOL_DIR)/scripts/tracevis.py -cf $(preload) $(buildpath)/*.trace -o $(buildpath)/tracevis.json

############################
# Unit tests simulation #
Expand Down
2 changes: 1 addition & 1 deletion hardware/deps/snitch/src/snitch.sv
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ module snitch
assign sp_new_value = gpr_wdata[i];
always_ff @(posedge clk_i or posedge rst_i) begin
if (!rst_i && gpr_we[i] && gpr_waddr[i] == SP && csr_stack_limit_q != 32'hFFFF_FFFF && ($signed(sp_new_value) < $signed(csr_stack_limit_q))) begin
$warning("[Stackoverflow: Core %0d] Set SP to 0x%08h, limit is 0x%08h", hart_id_i, sp_new_value, csr_stack_limit_q);
$warning("[Stackoverflow: Core %0d, PC: %0d] Set SP to 0x%08h, limit is 0x%08h", hart_id_i, inst_addr_o, sp_new_value, csr_stack_limit_q);
end
end
end
Expand Down
14 changes: 8 additions & 6 deletions hardware/scripts/gen_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
GENERAL_WARN = ('WARNING: Inconsistent final state; performance metrics may '
'be inaccurate. Is this trace complete?\n')

TRACE_IN_REGEX = r'(\d+)\s+(\d+)\s+(0x[0-9A-Fa-fz]+)\s+([^#;]*)(\s*#;\s*(.*))?'
TRACE_IN_REGEX = (r'(\d+)\s+(\d+)\s+(0x[0-9A-Fa-fz]+)\s+(0x[0-9A-Fa-fz]+)\s+'
r'([^#;]*)(\s*#;\s*(.*))?')

TRACE_OUT_FMT = '{:>8} {:>8} {:>10} {:<30}'
TRACE_OUT_FMT = '{:>8} {:>8} {:>8} {:>10} {:<30}'


# -------------------- Tracer configuration --------------------
Expand Down Expand Up @@ -304,7 +305,7 @@ def annotate_insn(
match = re.search(TRACE_IN_REGEX, line.strip('\n'))
if match is None:
raise ValueError('Not a valid trace line:\n{}'.format(line))
time_str, cycle_str, pc_str, insn, _, extras_str = match.groups()
time_str, cycle_str, pc_str, sp_str, insn, _, extras_str = match.groups()
time_info = (int(time_str), int(cycle_str))
show_time_info = (dupl_time_info or time_info != last_time_info)
time_info_strs = tuple((str(elem) if show_time_info else '')
Expand Down Expand Up @@ -333,12 +334,13 @@ def annotate_insn(
else:
prev_wfi_time = 0
return ((TRACE_OUT_FMT + ' #; {}').format(*time_info_strs,
pc_str, insn, annot),
pc_str, sp_str, insn, annot),
time_info, prev_wfi_time, retired_reg, empty)
# Vanilla trace
else:
return TRACE_OUT_FMT.format(
*time_info_strs, pc_str, insn), time_info, 0, retired_reg, False
return (TRACE_OUT_FMT.format(
*time_info_strs, pc_str, sp_str, insn), time_info, 0, retired_reg,
False)


# -------------------- Performance metrics --------------------
Expand Down
4 changes: 2 additions & 2 deletions hardware/src/mempool_cc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ module mempool_cc
extras_fpu = $sformatf("%s}", extras_fpu);

$timeformat(-9, 0, "", 10);
$sformat(trace_entry, "%t %8d 0x%h DASM(%h) #; %s\n",
$time, cycle, i_snitch.pc_q, i_snitch.inst_data_i, extras_str);
$sformat(trace_entry, "%t %8d 0x%h 0x%h DASM(%h) #; %s\n",
$time, cycle, i_snitch.pc_q, i_snitch.i_snitch_regfile.mem[2], i_snitch.inst_data_i, extras_str);
$fwrite(f, trace_entry);
end

Expand Down
2 changes: 1 addition & 1 deletion scripts/license-checker.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'software/runtime/printf*'
'software/runtime/encoding.h'
'software/runtime/mempool_dma_frontend.h'
'software/runtime/omp/libgomp.h'
'software/runtime/gomp/libgomp.h'
'software/riscv-tests/*'
'hardware/deps/*'
'hardware/tb/dpi/elfloader.cpp'
Expand Down
Loading