From f4e42de247f20bdd6205844b1da15d701c330351 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 4 May 2016 09:10:58 +0200 Subject: [PATCH] Added console out to csmith spike --- scripts/csmith/Makefile | 1 + scripts/csmith/riscv-isa-sim-console.diff | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 scripts/csmith/riscv-isa-sim-console.diff diff --git a/scripts/csmith/Makefile b/scripts/csmith/Makefile index 4fd060b..a854e7f 100644 --- a/scripts/csmith/Makefile +++ b/scripts/csmith/Makefile @@ -21,6 +21,7 @@ riscv-isa-sim/build.ok: riscv-fesvr/build.ok git clone https://github.com/riscv/riscv-isa-sim.git riscv-isa-sim cd riscv-isa-sim && git checkout 10ae74e cd riscv-isa-sim && patch -p1 < ../riscv-isa-sim-exit.diff + cd riscv-isa-sim && patch -p1 < ../riscv-isa-sim-console.diff cd riscv-isa-sim && LDFLAGS="-L../riscv-fesvr" ./configure --with-isa=RV32IMC +cd riscv-isa-sim && ln -s ../riscv-fesvr/fesvr . && make && touch build.ok diff --git a/scripts/csmith/riscv-isa-sim-console.diff b/scripts/csmith/riscv-isa-sim-console.diff new file mode 100644 index 0000000..551cf96 --- /dev/null +++ b/scripts/csmith/riscv-isa-sim-console.diff @@ -0,0 +1,14 @@ +diff --git a/riscv/mmu.h b/riscv/mmu.h +index b9948c5..bee1f8b 100644 +--- a/riscv/mmu.h ++++ b/riscv/mmu.h +@@ -67,7 +67,8 @@ public: + if (addr & (sizeof(type##_t)-1)) \ + throw trap_store_address_misaligned(addr); \ + reg_t vpn = addr >> PGSHIFT; \ +- if (likely(tlb_store_tag[vpn % TLB_ENTRIES] == vpn)) \ ++ if (addr == 0x10000000) putchar(val), fflush(stdout); \ ++ else if (likely(tlb_store_tag[vpn % TLB_ENTRIES] == vpn)) \ + *(type##_t*)(tlb_data[vpn % TLB_ENTRIES] + addr) = val; \ + else \ + store_slow_path(addr, sizeof(type##_t), (const uint8_t*)&val); \