Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Dialect/FIRRTL/Import/FIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,7 @@ ParseResult FIRStmtParser::parsePrimExp(Value &result) {
case FIRToken::lp_integer_add:
case FIRToken::lp_integer_mul:
case FIRToken::lp_integer_shr:
case FIRToken::lp_integer_shl:
if (requireFeature({4, 0, 0}, "Integer arithmetic expressions", loc))
return failure();
break;
Expand Down
1 change: 1 addition & 0 deletions lib/Dialect/FIRRTL/Import/FIRTokenKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ TOK_LPKEYWORD_PRIM(xorr, XorRPrimOp, 1)
TOK_LPKEYWORD_PRIM(integer_add, IntegerAddOp, 2)
TOK_LPKEYWORD_PRIM(integer_mul, IntegerMulOp, 2)
TOK_LPKEYWORD_PRIM(integer_shr, IntegerShrOp, 2)
TOK_LPKEYWORD_PRIM(integer_shl, IntegerShlOp, 2)

#undef TOK_MARKER
#undef TOK_IDENTIFIER
Expand Down
5 changes: 5 additions & 0 deletions test/Dialect/FIRRTL/parse-basic.fir
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,7 @@ circuit IntegerArithmetic :
output c : Integer
output d : Integer
output e : Integer
output f : Integer

; CHECK: [[C:%.+]] = firrtl.integer.add %a, %b
; CHECK: firrtl.propassign %c, [[C]]
Expand All @@ -1670,6 +1671,10 @@ circuit IntegerArithmetic :
; CHECK: firrtl.propassign %e, [[E]]
propassign e, integer_shr(a, b)

; CHECK: [[F:%.+]] = firrtl.integer.shl %a, %b
; CHECK: firrtl.propassign %f, [[F]]
propassign f, integer_shl(a, b)

;// -----
FIRRTL version 4.0.0

Expand Down
11 changes: 11 additions & 0 deletions test/Dialect/FIRRTL/parse-errors.fir
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,17 @@ circuit Top:
; expected-error @below {{Integer arithmetic expressions are a FIRRTL 4.0.0+ feature, but the specified FIRRTL version was 3.1.0}}
propassign c, integer_shr(a, b)

;// -----
FIRRTL version 3.1.0

circuit Top:
module Top:
input a : Integer
input b : Integer
output c : Integer
; expected-error @below {{Integer arithmetic expressions are a FIRRTL 4.0.0+ feature, but the specified FIRRTL version was 3.1.0}}
propassign c, integer_shl(a, b)

;// -----
FIRRTL version 4.0.0

Expand Down
Loading