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
37760007
Commit
37760007
authored
Apr 10, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
struct conversion attempts to size unsized constants when packing patterns
parent
006e0e08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
src/Convert/Struct.hs
+16
-1
test/relong/cache_request.sv
+2
-3
No files found.
src/Convert/Struct.hs
View file @
37760007
...
...
@@ -10,6 +10,7 @@ import Data.Maybe (fromJust, isJust)
import
Data.List
(
elemIndex
,
sortOn
)
import
Data.Tuple
(
swap
)
import
Control.Monad.Writer
import
Text.Read
(
readMaybe
)
import
qualified
Data.Map.Strict
as
Map
import
Convert.Traverse
...
...
@@ -231,7 +232,21 @@ convertAsgn structs types (lhs, expr) =
items''
=
map
subMap
items'
fieldNames
=
map
snd
fields
itemPosition
=
\
(
Just
x
,
_
)
->
fromJust
$
elemIndex
x
fieldNames
exprs
=
map
snd
$
sortOn
itemPosition
items''
packItem
(
Just
x
,
Number
n
)
=
Number
$
case
readMaybe
unticked
::
Maybe
Int
of
Nothing
->
if
unticked
==
n
then
n
else
size
++
n
Just
num
->
size
++
"'d"
++
show
num
where
Number
size
=
rangeSize
$
lookupUnstructRange
structTf
x
unticked
=
case
n
of
'
\'
'
:
rest
->
rest
rest
->
rest
packItem
(
_
,
itemExpr
)
=
itemExpr
exprs
=
map
packItem
$
sortOn
itemPosition
items''
convertExpr
_
other
=
other
-- try expression conversion by looking at the *innermost* type first
...
...
test/relong/cache_request.sv
View file @
37760007
...
...
@@ -50,7 +50,7 @@ module CacheHelper (
writeData:
`WORD_POISON
,
requestType:
CACHE_READ
,
isValid:
1'b1
,
writeEnable:
4'b
0
,
writeEnable:
0
,
// This is effectively 32-bits wide which is sufficient, but not technically correct. The "compiler" will truncate the bits to the width of 'writeSet'
writeSet:
'0
};
...
...
@@ -62,4 +62,4 @@ module CacheHelper (
assign
flatRequest
=
request
;
endmodule
\ No newline at end of file
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