Snitch Runtime
Toggle main menu visibility
Main Page
Related Pages
Classes
Class List
Class Index
Class Members
All
Variables
Files
File List
File Members
All
s
Functions
s
Typedefs
Enumerations
Enumerator
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Pages
Loading...
Searching...
No Matches
sw
snRuntime
src
dump.h
1
// Copyright 2020 ETH Zurich and University of Bologna.
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
//
5
// Authors: Samuel Riedel, ETH Zurich <sriedel@iis.ee.ethz.ch>
6
// Viviane Potocnik, ETH Zurich <vivianep@iis.ee.ethz.ch>
7
// Luca Colagrande, ETH Zurich <colluca@iis.ee.ethz.ch>
8
9
// Dump a value via CSR
10
// !!! Careful: This is only supported in simulation and an experimental
11
// feature. All writes to unimplemented CSR registers will be dumped by Snitch.
12
// This can be exploited to quickly print measurement values from all cores
13
// simultaneously without the hassle of printf. To specify multiple metrics,
14
// different CSRs can be used. The macro will define a function that will then
15
// always print via the same CSR. E.g., `dump(uint32_t, errors, 8)` will define
16
// a function with the following signature: `dump_errors(uint32_t val)`, which
17
// will print the given value via the 8th register. Alternatively, the
18
// `write_csr(reg, val)` macro can be used directly.
19
20
#pragma once
21
22
#define NAMED_DUMP(type, name, reg) \
23
static __attribute__((always_inline)) inline void dump_##name(type val) { \
24
asm volatile("csrw " #reg ", %0" ::"rK"(val)); \
25
}
26
27
#define DUMP(val) ({ asm volatile("csrw 0x7C4, %0" ::"rK"(val)); })
Generated by
1.12.0