From: whitequark Date: Wed, 15 Jul 2020 04:09:58 +0000 (+0000) Subject: back.rtlil: fix guard for division by zero. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9388dae4ed03a8bb3433d82f5c8ea54d1808bb18;p=nmigen.git back.rtlil: fix guard for division by zero. Oops... that should be checking the divisor, not the dividend. This was discovered by running the test suite on cxxsim. --- diff --git a/nmigen/back/rtlil.py b/nmigen/back/rtlil.py index 3838101..f772778 100644 --- a/nmigen/back/rtlil.py +++ b/nmigen/back/rtlil.py @@ -558,7 +558,7 @@ class _RHSValueCompiler(_ValueCompiler): self.s.rtlil.cell("$mux", ports={ "\\A": divmod_res, "\\B": self(ast.Const(0, ast.Shape(res_bits, res_sign))), - "\\S": self(lhs == 0), + "\\S": self(rhs == 0), "\\Y": res, }, params={ "WIDTH": res_bits