From 0d5bd9e810db2f2eafaed3de472ac1130501fd41 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sun, 7 Feb 2016 17:05:21 -0800 Subject: [PATCH] Set default RV32 RAM size to 4 GiB - 256 MiB This allows, by default, 256 MiB of addressable I/O space. --- riscv/sim.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscv/sim.cc b/riscv/sim.cc index 67b655e..69d5e19 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -30,11 +30,11 @@ sim_t::sim_t(const char* isa, size_t nprocs, size_t mem_mb, size_t memsz0 = (size_t)mem_mb << 20; size_t quantum = 1L << 20; if (memsz0 == 0) - memsz0 = 1L << (sizeof(size_t) == 8 ? 32 : 30); + memsz0 = (size_t)((sizeof(size_t) == 8 ? 4096 : 2048) - 256) << 20; memsz = memsz0; while ((mem = (char*)calloc(1, memsz)) == NULL) - memsz = memsz*10/11/quantum*quantum; + memsz = (size_t)(memsz*0.9)/quantum*quantum; if (memsz != memsz0) fprintf(stderr, "warning: only got %lu bytes of target mem (wanted %lu)\n", -- 2.30.2