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
f895f4f0
Commit
f895f4f0
authored
Feb 22, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some silly edge cases in round-tripping output
parent
546657d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
Language/SystemVerilog/AST.hs
+9
-8
Language/SystemVerilog/Parser/Parse.y
+2
-0
No files found.
Language/SystemVerilog/AST.hs
View file @
f895f4f0
...
@@ -79,10 +79,10 @@ data Type
...
@@ -79,10 +79,10 @@ data Type
deriving
Eq
deriving
Eq
instance
Show
Type
where
instance
Show
Type
where
show
(
Reg
r
)
=
"reg
"
++
(
showRanges
r
)
show
(
Reg
r
)
=
"reg"
++
(
showRanges
r
)
show
(
Wire
r
)
=
"wire
"
++
(
showRanges
r
)
show
(
Wire
r
)
=
"wire"
++
(
showRanges
r
)
show
(
Logic
r
)
=
"logic
"
++
(
showRanges
r
)
show
(
Logic
r
)
=
"logic"
++
(
showRanges
r
)
show
(
Alias
t
r
)
=
t
++
" "
++
(
showRanges
r
)
show
(
Alias
t
r
)
=
t
++
(
showRanges
r
)
data
ModuleItem
data
ModuleItem
=
Comment
String
=
Comment
String
...
@@ -135,8 +135,8 @@ instance Show ModuleItem where
...
@@ -135,8 +135,8 @@ instance Show ModuleItem where
MIParameter
nest
->
show
nest
MIParameter
nest
->
show
nest
MILocalparam
nest
->
show
nest
MILocalparam
nest
->
show
nest
MIIntegerV
nest
->
show
nest
MIIntegerV
nest
->
show
nest
PortDecl
d
r
x
->
printf
"%s
%s
%s;"
(
show
d
)
(
showRanges
r
)
x
PortDecl
d
r
x
->
printf
"%s
%s
%s;"
(
show
d
)
(
showRanges
r
)
x
LocalNet
t
x
v
->
printf
"%s%s%s;"
(
show
t
)
x
(
showRangesOrAssignment
v
)
LocalNet
t
x
v
->
printf
"%s
%s%s;"
(
show
t
)
x
(
showRangesOrAssignment
v
)
AlwaysC
k
b
->
printf
"%s %s"
(
show
k
)
(
show
b
)
AlwaysC
k
b
->
printf
"%s %s"
(
show
k
)
(
show
b
)
Assign
a
b
->
printf
"assign %s = %s;"
(
show
a
)
(
show
b
)
Assign
a
b
->
printf
"assign %s = %s;"
(
show
a
)
(
show
b
)
Instance
m
params
i
ports
Instance
m
params
i
ports
...
@@ -173,8 +173,9 @@ showAssignment Nothing = ""
...
@@ -173,8 +173,9 @@ showAssignment Nothing = ""
showAssignment
(
Just
val
)
=
" = "
++
show
val
showAssignment
(
Just
val
)
=
" = "
++
show
val
showRanges
::
[
Range
]
->
String
showRanges
::
[
Range
]
->
String
showRanges
=
concat
.
(
map
rangeToString
)
showRanges
[]
=
""
where
rangeToString
d
=
(
showRange
$
Just
d
)
++
"
\b
"
showRanges
l
=
" "
++
(
concat
$
map
rangeToString
l
)
where
rangeToString
d
=
init
$
showRange
$
Just
d
showRange
::
Maybe
Range
->
String
showRange
::
Maybe
Range
->
String
showRange
Nothing
=
""
showRange
Nothing
=
""
...
...
Language/SystemVerilog/Parser/Parse.y
View file @
f895f4f0
...
@@ -219,6 +219,7 @@ PortDeclsFollow :: { [ModuleItem] }
...
@@ -219,6 +219,7 @@ PortDeclsFollow :: { [ModuleItem] }
PortDecl(delim) :: { [ModuleItem] }
PortDecl(delim) :: { [ModuleItem] }
: "inout" opt(NetType) Dimensions Identifiers delim { portDeclToModuleItems Inout $2 $3 (zip $4 (repeat Nothing)) }
: "inout" opt(NetType) Dimensions Identifiers delim { portDeclToModuleItems Inout $2 $3 (zip $4 (repeat Nothing)) }
| "input" opt(NetType) Dimensions Identifiers delim { portDeclToModuleItems Input $2 $3 (zip $4 (repeat Nothing)) }
| "input" opt(NetType) Dimensions Identifiers delim { portDeclToModuleItems Input $2 $3 (zip $4 (repeat Nothing)) }
| "output" Dimensions Identifiers delim { portDeclToModuleItems Output Nothing $2 (zip $3 (repeat Nothing)) }
| "output" "wire" Dimensions Identifiers delim { portDeclToModuleItems Output (Just Wire ) $3 (zip $4 (repeat Nothing)) }
| "output" "wire" Dimensions Identifiers delim { portDeclToModuleItems Output (Just Wire ) $3 (zip $4 (repeat Nothing)) }
| "output" "reg" Dimensions VariablePortIdentifiers delim { portDeclToModuleItems Output (Just Reg ) $3 $4 }
| "output" "reg" Dimensions VariablePortIdentifiers delim { portDeclToModuleItems Output (Just Reg ) $3 $4 }
| "output" "logic" Dimensions VariablePortIdentifiers delim { portDeclToModuleItems Output (Just Logic) $3 $4 }
| "output" "logic" Dimensions VariablePortIdentifiers delim { portDeclToModuleItems Output (Just Logic) $3 $4 }
...
@@ -300,6 +301,7 @@ RangeOrType :: { Either Range () }
...
@@ -300,6 +301,7 @@ RangeOrType :: { Either Range () }
EventControl :: { Sense }
EventControl :: { Sense }
: "@" "(" Sense ")" { $3 }
: "@" "(" Sense ")" { $3 }
| "@" "(" "*" ")" { SenseStar }
| "@" "(" "*" ")" { SenseStar }
| "@" "(*)" { SenseStar }
| "@" "*" { SenseStar }
| "@" "*" { SenseStar }
| "@*" { SenseStar }
| "@*" { SenseStar }
...
...
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