Added console out to csmith spike

This commit is contained in:
Clifford Wolf 2016-05-04 09:10:58 +02:00
parent 6c69b3812e
commit f4e42de247
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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); \