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
da9452bd
Commit
da9452bd
authored
Apr 11, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix PackedArray handling of bit select followed by range select
parent
88c537c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
16 deletions
+34
-16
src/Convert/PackedArray.hs
+25
-10
test/basic/flatten.sv
+9
-6
No files found.
src/Convert/PackedArray.hs
View file @
da9452bd
...
...
@@ -195,16 +195,31 @@ rewriteModuleItem info =
hi
=
BinOp
Sub
(
BinOp
Add
lo
(
BinOp
Mul
(
rangeSize
range
)
size
))
(
Number
"1"
)
IndexedPlus
->
(
BinOp
Add
(
BinOp
Mul
size
(
fst
range
))
base
,
BinOp
Mul
size
(
snd
range
))
IndexedMinus
->
(
BinOp
Add
(
BinOp
Mul
size
(
fst
range
))
base
,
BinOp
Mul
size
(
snd
range
))
---- TODO: I'm not sure how these should be handled yet.
----rewriteExpr (orig @ (Range (Bit (Ident x) idxInner) modeOuter rangeOuter)) =
---- if Map.member x typeDims
---- then Range (Ident x') mode' range'
---- else orig
---- where
---- (dimInner, dimOuter) = dims x
---- x' = ':' : x
---- mode' =
---- range' =
rewriteExpr
(
orig
@
(
Range
(
Bit
(
Ident
x
)
idxInner
)
modeOuter
rangeOuter
))
=
if
Map
.
member
x
typeDims
then
Range
(
Ident
x'
)
mode'
range'
else
orig
where
(
dimInner
,
dimOuter
)
=
dims
x
x'
=
':'
:
x
mode'
=
IndexedPlus
idxInner'
=
orientIdx
dimInner
idxInner
rangeOuterReverseIndexed
=
(
BinOp
Add
(
fst
rangeOuter
)
(
BinOp
Sub
(
snd
rangeOuter
)
(
Number
"1"
)),
snd
rangeOuter
)
(
baseOuter
,
lenOuter
)
=
case
modeOuter
of
IndexedPlus
->
endianCondRange
dimOuter
rangeOuter
rangeOuterReverseIndexed
IndexedMinus
->
endianCondRange
dimOuter
rangeOuterReverseIndexed
rangeOuter
NonIndexed
->
(
endianCondExpr
dimOuter
(
snd
rangeOuter
)
(
fst
rangeOuter
),
rangeSize
rangeOuter
)
idxOuter'
=
orientIdx
dimOuter
baseOuter
start
=
BinOp
Mul
idxInner'
(
rangeSize
dimOuter
)
base
=
simplify
$
BinOp
Add
start
idxOuter'
len
=
lenOuter
range'
=
(
base
,
len
)
rewriteExpr
other
=
other
rewriteLHS
::
LHS
->
LHS
...
...
test/basic/flatten.sv
View file @
da9452bd
...
...
@@ -6,12 +6,15 @@ module name(clock, in, out); \
initial
out
[
1
+
a
]
=
0
;
\
initial
out
[
2
+
a
]
=
0
;
\
always
@
(
posedge
clock
)
begin
\
/*$display($time, `" name ", out[0+a][1+b+:1]);*/
\
/*$display($time, `" name ", out[0+a][1+b+:1]);*/
\
/*$display($time, `" name ", out[1+a][1+b+:1]);*/
\
/*$display($time, `" name ", out[1+a][1+b+:1]);*/
\
/*$display($time, `" name ", out[2+a][1+b+:1]);*/
\
/*$display($time, `" name ", out[2+a][1+b+:1]);*/
\
$
display
($
time
,
`
" name @+ "
,
out
[
0
+
a
][
1
+
b
+:
1
])
;
\
$
display
($
time
,
`
" name @+ "
,
out
[
1
+
a
][
1
+
b
+:
1
])
;
\
$
display
($
time
,
`
" name @+ "
,
out
[
2
+
a
][
1
+
b
+:
1
])
;
\
$
display
($
time
,
`
" name @+ "
,
out
[
0
+
a
][
1
+
b
+:
2
])
;
\
$
display
($
time
,
`
" name @+ "
,
out
[
1
+
a
][
1
+
b
+:
2
])
;
\
$
display
($
time
,
`
" name @+ "
,
out
[
2
+
a
][
1
+
b
+:
2
])
;
\
$
display
($
time
,
`
" name @: "
,
out
[
0
+
a
][
1
+
b
:
1
+
b
])
;
\
$
display
($
time
,
`
" name @: "
,
out
[
1
+
a
][
1
+
b
:
1
+
b
])
;
\
$
display
($
time
,
`
" name @: "
,
out
[
2
+
a
][
1
+
b
:
1
+
b
])
;
\
\
out
[
2
+
a
][
4
+
b
]
=
out
[
2
+
a
][
3
+
b
]
;
\
out
[
2
+
a
][
3
+
b
]
=
out
[
2
+
a
][
2
+
b
]
;
\
...
...
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