Skip to content

Commit

Permalink
feat: change for arm to use clcok_gettime
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdalla committed Aug 22, 2024
1 parent 43bf744 commit 43fec42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion installation_procedure.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Reminder: this is for linux setup

1. Install flexpret by following it's instructions. Use branch gametime-support. Can use instructions of master branch.
***Remember to export PATH=$PATH:/home/c/Desktop/research/lf/code/flexpret/emulator*** USE ABS PATH
***Remember to export PATH=$PATH:/Users/abdallaeltayeb/Desktop/Gamtime_project/flexpret/emulator*** USE ABS PATH
export PATH=$PATH:/opt/riscv/bin

2. Pull the lastest Gametime.
Expand Down Expand Up @@ -30,3 +30,4 @@ apt-get install -qqy --no-install-recommends \
7. Install KLEE and pycparser. Place pycparser in same directory as gametime to ensure it can find the stubs.

7. To regenerate documentation: install sphinx and numpydoc. Then run: make html; sphinx-build -b html ./ build/ -v
export PATH="/opt/homebrew/opt/llvm@14/bin:$PATH"
7 changes: 4 additions & 3 deletions src/backend/arm_backend/arm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
class ArmBackend(Backend):
timing_func = """
static inline unsigned long long read_cycle_count() {
unsigned long long val;
asm volatile("mrs %0, PMCCNTR_EL0" : "=r" (val));
return val;
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
unsigned long long nanoTime = time.tv_sec * 1000000000L + time.tv_nsec;
return nanoTime;
}
"""

Expand Down
4 changes: 3 additions & 1 deletion src/backend/generate_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ def generate_executable(input_file, input_folder, function_name, hex_values_file

# This must be included in we want to run flexpret backend (for printf)
if include_flexpret:
original_c_content = "#include <flexpret.h> \n" + original_c_content
original_c_content = "#include <flexpret.h> \n" + original_c_content
else:
original_c_content = "#include <time.h> \n" + original_c_content

#TODO: generate global variables, add the global timing function
original_c_content += timing_function_body
Expand Down

0 comments on commit 43fec42

Please sign in to comment.