From eaf47a3da2ec43a50bbb92a309c635f4d71347dd Mon Sep 17 00:00:00 2001 From: James Pollard Date: Tue, 26 May 2020 19:50:05 +0100 Subject: Bug fix: stack address normalisation --- src/translation/Veriloggen.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/translation/Veriloggen.v') 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. -- cgit