Skip to content

Commit

Permalink
[FIRRTL] Explicitly reject rwprobe of types containing const. (llvm#5367
Browse files Browse the repository at this point in the history
)

Don't leave to verifier, better diagnostic this way.
  • Loading branch information
dtzSiFive authored Jun 12, 2023
1 parent 099378c commit 7b52973
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Dialect/FIRRTL/Import/FIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,9 @@ ParseResult FIRParser::parseType(FIRRTLType &result, const Twine &message) {
if (!innerType.isPassive())
return emitError(loc, "probe inner type must be passive");

if (forceable && innerType.containsConst())
return emitError(loc, "rwprobe cannot contain const");

result = RefType::get(innerType, forceable);
break;
}
Expand Down
6 changes: 6 additions & 0 deletions test/Dialect/FIRRTL/parse-errors.fir
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ circuit ForceWithLiteral:

;// -----

circuit RWProbeConst:
extmodule RWProbeConst:
output p : RWProbe<{a: const UInt}> ; expected-error {{rwprobe cannot contain const}}

;// -----

FIRRTL version 2.0.0
circuit PartialConnect_v2p0p0:
module PartialConnect_v2p0p0:
Expand Down

0 comments on commit 7b52973

Please sign in to comment.