Skip to content

Commit

Permalink
Change project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhauptmann committed Oct 14, 2023
1 parent eb83d14 commit f2a7b58
Show file tree
Hide file tree
Showing 28 changed files with 7 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_sources := $(wildcard *.c)
tests := $(test_sources:.c=.bin)

%.elf: %.c
riscv64-unknown-elf-gcc -O3 -fno-builtin -march=rv32ifd -mabi=ilp32 -Wl,-Ttext=0x80000000 -nostdlib -o $@ $^
riscv64-unknown-elf-gcc -Os -fno-builtin -march=rv32ifd -mabi=ilp32 -Wl,-Ttext=0x80000000 -nostdlib -o $@ $^

%.bin: %.elf
riscv64-unknown-elf-objcopy -O binary $^ $@
Expand Down
Binary file added binaries/programs/fib.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
int fib(unsigned int n, unsigned int* mem);
unsigned long long fib(unsigned long long n, unsigned long long* mem);

static const int N = 48; // fib(48) is the largest number fitting inside u32
static const int N = 94; // fib(94) is the largest number fitting inside u64

int main() {

unsigned int res[N];
unsigned long long res[N];
for (int i = 0; i < N; i++) {
res[i] = -1;
}
Expand All @@ -16,7 +15,7 @@ int main() {
return res[N - 1];
}

int fib(unsigned int n, unsigned int* mem) {
unsigned long long fib(unsigned long long n, unsigned long long* mem) {
if (mem[n] != -1)
return mem[n];

Expand Down
4 changes: 2 additions & 2 deletions risc-v-emulator-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fn gen_insn_tests(out_dir: &str) {
let destination = std::path::Path::new(&out_dir).join("tests_insn.rs");
let mut f = std::fs::File::create(&destination).unwrap();

let tests = std::fs::read_dir("tests/instructions")
.expect("Could not list files in tests/instructions")
let tests = std::fs::read_dir("../binaries/instruction_tests")
.expect("Could not list files in ../binaries/instruction_tests")
.filter_map(|r| {
r.ok()
.filter(|f| f.path().is_file() && f.path().extension().is_some_and(|e| e == "S"))
Expand Down
Binary file removed risc-v-emulator/tests/programs/fib.bin
Binary file not shown.

0 comments on commit f2a7b58

Please sign in to comment.