Conversation
The module assigns {cout, out[DW-1:0]} = a - b, but cout was never
declared anywhere -- not as a port, and not as a wire/reg. Any
Verilog tool that checks for undeclared identifiers rejects this
(e.g. EBMC: "unknown identifier cout"). Add cout as an output port,
mirroring the sibling add module's cin/cout convention (a[DW-1:0] -
b[DW-1:0] is computed as a (DW+1)-bit operation, with the extra bit
carrying the borrow/carry-out).
Found via ebmc's parse/elaborate pass over the benchmark suite
(https://diffblue.github.io/hw-cbmc/logikbench/).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
arithmetic/sub/rtl/sub.vcomputesbut
coutis never declared: it isn't a port, and there's nowire/regdeclaration for it either. This is invalid Verilog (anundeclared identifier used on an lvalue), caught by any tool that
checks for undeclared identifiers -- e.g. ebmc reports
unknown identifier coutwhile type-checking, and rejects the module.Fix
Add
coutas an output port, mirroring the siblingaddmodule'scin/coutconvention:a - bis computed as a(DW+1)-bitoperation, with the extra bit carrying the borrow/carry-out.
How found
Found via
ebmc's parse/elaborate pass over the benchmark suite,reported at https://diffblue.github.io/hw-cbmc/logikbench/.