From 9eff3d214de18f413f5c7022c422bd097d678883 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Fri, 23 Sep 2022 16:31:49 -0700 Subject: Add some asserts. --- backend/regfile.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/regfile.h b/backend/regfile.h index 4ea2f31..62177de 100644 --- a/backend/regfile.h +++ b/backend/regfile.h @@ -105,11 +105,13 @@ namespace backend { if (!hazard) { auto i = instp.read(); if (!(i.field[FLAGS_DST] & FLAG_IMM1)) { + assert(!hazards[i.field[SRC1] % regs.size()]); auto x = regs[i.field[SRC1] % regs.size()]; pte(i.transaction, "", fmt::format("rf1[{}]={:x}", i.field[SRC1] % regs.size(), x)); i.field[SRC1] = x; } if (!(i.field[FLAGS_DST] & FLAG_IMM2)) { + assert(!hazards[i.field[SRC2] % regs.size()]); auto x = regs[i.field[SRC2] % regs.size()]; pte(i.transaction, "", fmt::format("rf2[{}]={:x}", i.field[SRC2] % regs.size(), x)); i.field[SRC2] = x; @@ -123,6 +125,7 @@ namespace backend { case OP_STORE: break; default: + assert(!hazards[i.field[FLAGS_DST] % regs.size()]); hazards[i.field[FLAGS_DST] % regs.size()] = true; break; } -- cgit v1.2.3