Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
07caba64
Commit
07caba64
authored
Jul 31, 2023
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify non-ANSI style port declaration dimensions
parent
19b479d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
CHANGELOG.md
+2
-0
src/Convert/ExprUtils.hs
+8
-0
src/Convert/PortDecl.hs
+3
-2
test/basic/port_decl_simplify.sv
+4
-0
No files found.
CHANGELOG.md
View file @
07caba64
...
...
@@ -8,6 +8,8 @@
### Bug Fixes
*
Fixed an issue that prevented parsing tasks and functions with
`inout`
ports
*
Fixed certain non-ANSI style port declarations being incorrectly reported as
incompatible
## v0.0.11
...
...
src/Convert/ExprUtils.hs
View file @
07caba64
...
...
@@ -14,6 +14,8 @@ module Convert.ExprUtils
,
endianCondRange
,
dimensionsSize
,
stringToNumber
,
simplifyRange
,
simplifyDimensions
)
where
import
Data.Bits
((
.&.
),
(
.|.
),
shiftL
,
shiftR
)
...
...
@@ -319,3 +321,9 @@ pattern ConvertedUU :: Integer -> Integer -> Integer -> Expr
pattern
ConvertedUU
sz
v
k
<-
Repeat
(
RawNum
sz
)
[
Number
(
Based
1
True
Binary
v
k
)]
simplifyRange
::
Range
->
Range
simplifyRange
(
e1
,
e2
)
=
(
simplify
e1
,
simplify
e2
)
simplifyDimensions
::
[
Range
]
->
[
Range
]
simplifyDimensions
=
map
simplifyRange
src/Convert/PortDecl.hs
View file @
07caba64
...
...
@@ -18,6 +18,7 @@ module Convert.PortDecl (convert) where
import
Data.List
(
intercalate
,
(
\\
))
import
Data.Maybe
(
mapMaybe
)
import
Convert.ExprUtils
(
simplifyDimensions
)
import
Convert.Traverse
import
Language.SystemVerilog.AST
...
...
@@ -102,9 +103,9 @@ combineDecls :: Decl -> Decl -> Decl
combineDecls
portDecl
dataDecl
|
eP
/=
Nil
=
mismatch
"invalid initialization at port declaration"
|
aP
/=
aD
=
|
simplifyDimensions
aP
/=
simplifyDimensions
aD
=
mismatch
"different unpacked dimensions"
|
rsP
/=
rsD
=
|
simplifyDimensions
rsP
/=
simplifyDimensions
rsD
=
mismatch
"different packed dimensions"
|
otherwise
=
base
(
tf
rsD
)
ident
aD
Nil
...
...
test/basic/port_decl_simplify.sv
0 → 100644
View file @
07caba64
module
top
(
out
)
;
output
[
32
-
1
:
0
]
out
;
reg
[
31
:
0
]
out
;
endmodule
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment