Browse Source

Set 16..4096-byte bound on cache-block size

16 B suffices to subsume all aligned accesses (including the Q extension).
Spike does not actually rely on this property, but in some real systems,
it is impractical to guarantee atomicity across cache lines.

4096 B suffices to prevent cache lines from spanning pages (which would
require multiple TLB accesses).  This one is a bug fix, since we were
not performing multiple TLB accesses in this case.
pull/1125/head
Andrew Waterman 4 years ago
parent
commit
da21648472
  1. 7
      spike_main/spike.cc

7
spike_main/spike.cc

@ -411,8 +411,11 @@ int main(int argc, char** argv)
});
parser.option(0, "blocksz", 1, [&](const char* s){
blocksz = strtoull(s, 0, 0);
if (((blocksz & (blocksz - 1))) != 0) {
fprintf(stderr, "--blocksz should be power of 2\n");
const unsigned min_blocksz = 16;
const unsigned max_blocksz = PGSIZE;
if (blocksz < min_blocksz || blocksz > max_blocksz || ((blocksz & (blocksz - 1))) != 0) {
fprintf(stderr, "--blocksz must be a power of 2 between %u and %u\n",
min_blocksz, max_blocksz);
exit(-1);
}
});

Loading…
Cancel
Save