mirror of https://github.com/zachjs/sv2v.git
forbid bit-selects and part-selects of scalar struct fields
This commit is contained in:
parent
814f96597e
commit
ff241115c4
|
|
@ -32,6 +32,8 @@
|
|||
* Non-positive integer size casts are now detected and forbidden
|
||||
* Negative indices in struct pattern literals are now detected and forbidden
|
||||
* Escaped vendor block comments in macro bodies are now tolerated
|
||||
* Illegal bit-selects and part-selects of scalar struct fields are now detected
|
||||
and forbidden, rather than yielding an internal assertion failure
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
|||
|
|
@ -386,6 +386,9 @@ convertSubExpr scopes (Range (Dot e x) NonIndexed rOuter) =
|
|||
(UnknownType, orig')
|
||||
else if structIsntReady subExprType then
|
||||
(replaceInnerTypeRange NonIndexed rOuter' fieldType, orig')
|
||||
else if null dims then
|
||||
error $ "illegal access to range " ++ show (Range Nil NonIndexed rOuter)
|
||||
++ " of " ++ show (Dot e x) ++ ", which has type " ++ show fieldType
|
||||
else
|
||||
(replaceInnerTypeRange NonIndexed rOuter' fieldType, undotted)
|
||||
where
|
||||
|
|
@ -408,6 +411,9 @@ convertSubExpr scopes (Range (Dot e x) mode (baseO, lenO)) =
|
|||
(UnknownType, orig')
|
||||
else if structIsntReady subExprType then
|
||||
(replaceInnerTypeRange mode (baseO', lenO') fieldType, orig')
|
||||
else if null dims then
|
||||
error $ "illegal access to range " ++ show (Range Nil mode (baseO, lenO))
|
||||
++ " of " ++ show (Dot e x) ++ ", which has type " ++ show fieldType
|
||||
else
|
||||
(replaceInnerTypeRange mode (baseO', lenO') fieldType, undotted)
|
||||
where
|
||||
|
|
@ -438,6 +444,9 @@ convertSubExpr scopes (Bit (Dot e x) i) =
|
|||
(dropInnerTypeRange backupType, orig')
|
||||
else if structIsntReady subExprType then
|
||||
(dropInnerTypeRange fieldType, orig')
|
||||
else if null dims then
|
||||
error $ "illegal access to bit " ++ show i ++ " of " ++ show (Dot e x)
|
||||
++ ", which has type " ++ show fieldType
|
||||
else
|
||||
(dropInnerTypeRange fieldType, Bit e' iFlat)
|
||||
where
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
// pattern: illegal access to bit 0 of s\.x, which has type logic
|
||||
module top;
|
||||
struct packed {
|
||||
logic x;
|
||||
} s;
|
||||
initial s.x[0] = 1;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// pattern: illegal access to range \[0:0\] of s\.x, which has type logic
|
||||
module top;
|
||||
struct packed {
|
||||
logic x;
|
||||
} s;
|
||||
initial s.x[0:0] = 1;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// pattern: illegal access to range \[0\+:1\] of s\.x, which has type logic
|
||||
module top;
|
||||
struct packed {
|
||||
logic x;
|
||||
} s;
|
||||
initial s.x[0+:1] = 1;
|
||||
endmodule
|
||||
Loading…
Reference in New Issue