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
82d06b39
Commit
82d06b39
authored
Jun 25, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
elaboration avoid introducing illegal selects
parent
80154feb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
+33
-1
src/Convert/Simplify.hs
+12
-1
test/basic/simplify_func.sv
+15
-0
test/basic/simplify_func.v
+6
-0
No files found.
src/Convert/Simplify.hs
View file @
82d06b39
...
...
@@ -34,13 +34,24 @@ convertDescription =
traverseDeclM
::
Decl
->
State
Info
Decl
traverseDeclM
decl
=
do
case
decl
of
Param
Localparam
_
x
e
->
modify
$
Map
.
insert
x
e
Param
Localparam
_
x
e
->
when
(
isSimpleExpr
e
)
$
modify
$
Map
.
insert
x
e
_
->
return
()
let
mi
=
MIPackageItem
$
Decl
decl
mi'
<-
traverseModuleItemM
mi
let
MIPackageItem
(
Decl
decl'
)
=
mi'
return
decl'
isSimpleExpr
::
Expr
->
Bool
isSimpleExpr
Ident
{}
=
True
isSimpleExpr
PSIdent
{}
=
True
isSimpleExpr
Number
{}
=
True
isSimpleExpr
String
{}
=
True
isSimpleExpr
(
Dot
e
_
)
=
isSimpleExpr
e
isSimpleExpr
(
Bit
e
_
)
=
isSimpleExpr
e
isSimpleExpr
(
Range
e
_
_
)
=
isSimpleExpr
e
isSimpleExpr
_
=
False
traverseModuleItemM
::
ModuleItem
->
State
Info
ModuleItem
traverseModuleItemM
(
Instance
m
p
x
rs
l
)
=
do
p'
<-
mapM
paramBindingMapper
p
...
...
test/basic/simplify_func.sv
0 → 100644
View file @
82d06b39
package
PKG
;
typedef
struct
packed
{
int
F
;
}
S
;
function
automatic
S
f
()
;
return
'0
;
endfunction
endpackage
module
top
;
localparam
PKG
::
S
L0
=
PKG
::
f
()
;
localparam
int
L1
=
L0
.
F
;
localparam
int
L2
=
$
clog2
(
L1
)
;
initial
$
display
(
"%b %b %b"
,
L0
,
L1
,
L2
)
;
endmodule
test/basic/simplify_func.v
0 → 100644
View file @
82d06b39
module
top
;
localparam
L0
=
0
;
localparam
L1
=
L0
;
localparam
L2
=
$
clog2
(
L1
)
;
initial
$
display
(
"%b %b %b"
,
L0
,
L1
,
L2
)
;
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