aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/translation/Veriloggen.v2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/translation/Veriloggen.v b/src/translation/Veriloggen.v
index e2dc8f4..dcdbaa5 100644
--- a/src/translation/Veriloggen.v
+++ b/src/translation/Veriloggen.v
@@ -245,7 +245,7 @@ Definition translate_eff_addressing (a: Op.addressing) (args: list reg) : mon ex
(* Stack arrays/referenced variables *)
| Op.Ainstack a, nil => (* We need to be sure that the base address is aligned *)
let a := Integers.Ptrofs.unsigned a in (* FIXME: Assuming stack offsets are +ve; is this ok? *)
- if (Z.eq_dec (Z.modulo a 4) 0) then ret (Vlit (ZToValue 32%nat a))
+ if (Z.eq_dec (Z.modulo a 4) 0) then ret (Vlit (ZToValue 32%nat (a / 4)))
else error (Errors.msg "Veriloggen: eff_addressing misaligned stack offset")
| _, _ => error (Errors.msg "Veriloggen: eff_addressing instruction not implemented: other")
end.