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
5351dee8
Commit
5351dee8
authored
Apr 02, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor scoping/ordering fixes for pesky VCS restrictions
parent
ba7ffdf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
src/Convert/Enum.hs
+2
-1
src/Convert/PackedArray.hs
+3
-3
src/Convert/Traverse.hs
+2
-0
No files found.
src/Convert/Enum.hs
View file @
5351dee8
...
...
@@ -12,6 +12,7 @@ module Convert.Enum (convert) where
import
Text.Read
(
readMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Data.List
(
sortOn
)
import
Control.Monad.Writer
import
qualified
Data.Set
as
Set
...
...
@@ -31,7 +32,7 @@ convertDescription :: Description -> Description
convertDescription
(
description
@
(
Part
_
_
_
_
_
_
))
=
Part
extern
kw
lifetime
name
ports
(
enumItems
++
items
)
where
enumPairs
=
concat
$
m
ap
(
uncurry
enumVals
)
$
Set
.
toList
enums
enumPairs
=
sortOn
snd
$
concatM
ap
(
uncurry
enumVals
)
$
Set
.
toList
enums
enumItems
=
map
(
\
(
x
,
v
)
->
MIDecl
$
Localparam
(
Implicit
Unspecified
[]
)
x
v
)
enumPairs
(
Part
extern
kw
lifetime
name
ports
items
,
enums
)
=
runWriter
$
traverseModuleItemsM
(
traverseTypesM
traverseType
)
$
...
...
src/Convert/PackedArray.hs
View file @
5351dee8
...
...
@@ -195,7 +195,7 @@ unflattener writeToFlatVariant arr (t, (majorHi, majorLo)) =
(
index
,
majorLo
)
(
BinOp
Le
(
Ident
index
)
majorHi
)
(
index
,
AsgnOp
Add
,
Number
"1"
)
(
Just
$
prefix
"unflatten
"
)
(
Just
$
prefix
"unflatten
_"
++
arr
)
[
localparam
startBit
(
simplify
$
BinOp
Add
majorLo
(
BinOp
Mul
(
Ident
index
)
size
))
...
...
@@ -206,9 +206,9 @@ unflattener writeToFlatVariant arr (t, (majorHi, majorLo)) =
]
]
where
startBit
=
prefix
"_tmp_start
"
startBit
=
prefix
"_tmp_start
_"
++
arr
arrUnflat
=
prefix
arr
index
=
prefix
"_tmp_index
"
index
=
prefix
"_tmp_index
_"
++
arr
(
minorHi
,
minorLo
)
=
head
$
snd
$
typeRanges
t
size
=
rangeSize
(
minorHi
,
minorLo
)
localparam
::
Identifier
->
Expr
->
GenItem
...
...
src/Convert/Traverse.hs
View file @
5351dee8
...
...
@@ -105,6 +105,8 @@ traverseModuleItemsM :: Monad m => MapperM m ModuleItem -> MapperM m Description
traverseModuleItemsM
mapper
(
Part
extern
kw
lifetime
name
ports
items
)
=
mapM
fullMapper
items
>>=
return
.
Part
extern
kw
lifetime
name
ports
where
fullMapper
(
Generate
[
GenBlock
Nothing
genItems
])
=
mapM
fullGenItemMapper
genItems
>>=
mapper
.
Generate
fullMapper
(
Generate
genItems
)
=
mapM
fullGenItemMapper
genItems
>>=
mapper
.
Generate
fullMapper
other
=
mapper
other
...
...
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