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
1a394cff
Commit
1a394cff
authored
Oct 06, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support mintypmax expressions
parent
f0368714
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
src/Convert/Struct.hs
+6
-0
src/Convert/Traverse.hs
+5
-0
src/Language/SystemVerilog/AST/Expr.hs
+2
-0
src/Language/SystemVerilog/Parser/Parse.y
+2
-0
No files found.
src/Convert/Struct.hs
View file @
1a394cff
...
...
@@ -475,6 +475,12 @@ convertAsgn structs types (lhs, expr) =
where
items'
=
map
mapItem
items
mapItem
(
mx
,
e
)
=
(
mx
,
snd
$
convertSubExpr
e
)
convertSubExpr
(
MinTypMax
a
b
c
)
=
(
t
,
MinTypMax
a'
b'
c'
)
where
(
_
,
a'
)
=
convertSubExpr
a
(
t
,
b'
)
=
convertSubExpr
b
(
_
,
c'
)
=
convertSubExpr
c
convertSubExpr
Nil
=
(
Implicit
Unspecified
[]
,
Nil
)
convertTypeOrExpr
::
TypeOrExpr
->
TypeOrExpr
...
...
src/Convert/Traverse.hs
View file @
1a394cff
...
...
@@ -481,6 +481,11 @@ traverseNestedExprsM mapper = exprMapper
let
names
=
map
fst
l
exprs
<-
mapM
exprMapper
$
map
snd
l
return
$
Pattern
$
zip
names
exprs
em
(
MinTypMax
e1
e2
e3
)
=
do
e1'
<-
exprMapper
e1
e2'
<-
exprMapper
e2
e3'
<-
exprMapper
e3
return
$
MinTypMax
e1'
e2'
e3'
em
(
Nil
)
=
return
Nil
exprMapperHelpers
::
Monad
m
=>
MapperM
m
Expr
->
...
...
src/Language/SystemVerilog/AST/Expr.hs
View file @
1a394cff
...
...
@@ -55,6 +55,7 @@ data Expr
|
DimFn
DimFn
TypeOrExpr
Expr
|
Dot
Expr
Identifier
|
Pattern
[(
Maybe
Identifier
,
Expr
)]
|
MinTypMax
Expr
Expr
Expr
|
Nil
deriving
(
Eq
,
Ord
)
...
...
@@ -83,6 +84,7 @@ instance Show Expr where
showPatternItem
::
(
Maybe
Identifier
,
Expr
)
->
String
showPatternItem
(
Nothing
,
e
)
=
show
e
showPatternItem
(
Just
n
,
e
)
=
printf
"%s: %s"
n
(
show
e
)
show
(
MinTypMax
a
b
c
)
=
printf
"(%s : %s : %s)"
(
show
a
)
(
show
b
)
(
show
c
)
data
Args
=
Args
[
Maybe
Expr
]
[(
Identifier
,
Maybe
Expr
)]
...
...
src/Language/SystemVerilog/Parser/Parse.y
View file @
1a394cff
...
...
@@ -1019,6 +1019,7 @@ DelayValue :: { Expr }
: Number { Number $1 }
| Identifier { Ident $1 }
| Identifier "::" Identifier { PSIdent $1 $3 }
| "(" Expr ":" Expr ":" Expr ")" { MinTypMax $2 $4 $6 }
-- TODO: Support these other DelayValues?
-- | real_number
-- | time_literal
...
...
@@ -1106,6 +1107,7 @@ Expr :: { Expr }
| "{" StreamOp StreamSize Concat "}" { Stream $2 $3 $4 }
| "{" StreamOp Concat "}" { Stream $2 (Number "1") $3 }
| Expr "inside" Concat { foldl1 (BinOp LogOr) $ map (BinOp Eq $1) $3 }
| "(" Expr ":" Expr ":" Expr ")" { MinTypMax $2 $4 $6 }
-- binary expressions
| Expr "||" Expr { BinOp LogOr $1 $3 }
| Expr "&&" Expr { BinOp LogAnd $1 $3 }
...
...
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