Give error instead of asserting for invalid range, fixes #947
authorMiodrag Milanovic <mmicko@gmail.com>
Mon, 27 May 2019 10:25:18 +0000 (12:25 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Mon, 27 May 2019 10:25:18 +0000 (12:25 +0200)
frontends/ast/genrtlil.cc

index 379fed641a73c1657ccd233704f931c2692729d7..1b19ba4e53ebaee3ef18d2ee96a00e5dc019f10f 100644 (file)
@@ -904,7 +904,8 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                        if (!range_valid)
                                log_file_error(filename, linenum, "Signal `%s' with non-constant width!\n", str.c_str());
 
-                       log_assert(range_left >= range_right || (range_left == -1 && range_right == 0));
+                       if (!(range_left >= range_right || (range_left == -1 && range_right == 0)))
+                               log_file_error(filename, linenum, "Signal `%s' with invalid width range %d!\n", str.c_str(), range_left - range_right + 1);
 
                        RTLIL::Wire *wire = current_module->addWire(str, range_left - range_right + 1);
                        wire->attributes["\\src"] = stringf("%s:%d", filename.c_str(), linenum);