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
e62074c7
Commit
e62074c7
authored
Jan 11, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
type operator full select support
parent
22d6ba49
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
12 deletions
+59
-12
src/Convert/DimensionQuery.hs
+0
-8
src/Convert/TypeOf.hs
+26
-4
test/basic/dimensions.sv
+3
-0
test/basic/dimensions.v
+30
-0
No files found.
src/Convert/DimensionQuery.hs
View file @
e62074c7
...
@@ -125,14 +125,6 @@ convertBits (Right e) =
...
@@ -125,14 +125,6 @@ convertBits (Right e) =
foldl
(
BinOp
Add
)
(
Number
"0"
)
$
foldl
(
BinOp
Add
)
(
Number
"0"
)
$
map
(
convertBits
.
Right
)
$
map
(
convertBits
.
Right
)
$
exprs
exprs
Range
expr
mode
range
->
simplify
$
BinOp
Mul
size
(
convertBits
$
Right
$
Bit
expr
(
Number
"0"
))
where
size
=
case
mode
of
NonIndexed
->
rangeSize
range
IndexedPlus
->
snd
range
IndexedMinus
->
snd
range
Stream
_
_
exprs
->
convertBits
$
Right
$
Concat
exprs
Stream
_
_
exprs
->
convertBits
$
Right
$
Concat
exprs
Number
n
->
Number
n
->
case
elemIndex
'
\'
'
n
of
case
elemIndex
'
\'
'
n
of
...
...
src/Convert/TypeOf.hs
View file @
e62074c7
...
@@ -73,9 +73,22 @@ typeof (orig @ (Ident x)) = do
...
@@ -73,9 +73,22 @@ typeof (orig @ (Ident x)) = do
typeof
(
orig
@
(
Call
(
Ident
x
)
_
))
=
do
typeof
(
orig
@
(
Call
(
Ident
x
)
_
))
=
do
res
<-
gets
$
Map
.
lookup
x
res
<-
gets
$
Map
.
lookup
x
return
$
fromMaybe
(
TypeOf
orig
)
res
return
$
fromMaybe
(
TypeOf
orig
)
res
typeof
(
orig
@
(
Bit
(
Ident
x
)
_
))
=
do
typeof
(
orig
@
(
Bit
e
_
))
=
do
res
<-
gets
$
Map
.
lookup
x
t
<-
typeof
e
return
$
maybe
(
TypeOf
orig
)
popRange
res
return
$
case
t
of
TypeOf
_
->
TypeOf
orig
_
->
popRange
t
typeof
(
orig
@
(
Range
e
mode
r
))
=
do
t
<-
typeof
e
return
$
case
t
of
TypeOf
_
->
TypeOf
orig
_
->
replaceRange
(
lo
,
hi
)
t
where
lo
=
fst
r
hi
=
case
mode
of
NonIndexed
->
snd
r
IndexedPlus
->
BinOp
Sub
(
uncurry
(
BinOp
Add
)
r
)
(
Number
"1"
)
IndexedMinus
->
BinOp
Add
(
uncurry
(
BinOp
Sub
)
r
)
(
Number
"1"
)
typeof
other
=
return
$
TypeOf
other
typeof
other
=
return
$
TypeOf
other
-- combines a type with unpacked ranges
-- combines a type with unpacked ranges
...
@@ -84,8 +97,17 @@ injectRanges t [] = t
...
@@ -84,8 +97,17 @@ injectRanges t [] = t
injectRanges
(
UnpackedType
t
rs
)
unpacked
=
UnpackedType
t
$
unpacked
++
rs
injectRanges
(
UnpackedType
t
rs
)
unpacked
=
UnpackedType
t
$
unpacked
++
rs
injectRanges
t
unpacked
=
UnpackedType
t
unpacked
injectRanges
t
unpacked
=
UnpackedType
t
unpacked
-- removes the
outermos
t range of the given type
-- removes the
most significan
t range of the given type
popRange
::
Type
->
Type
popRange
::
Type
->
Type
popRange
(
UnpackedType
t
[
_
])
=
t
popRange
t
=
popRange
t
=
tf
$
tail
rs
tf
$
tail
rs
where
(
tf
,
rs
)
=
typeRanges
t
where
(
tf
,
rs
)
=
typeRanges
t
-- replaces the most significant range of the given type
replaceRange
::
Range
->
Type
->
Type
replaceRange
r
(
UnpackedType
t
(
_
:
rs
))
=
UnpackedType
t
(
r
:
rs
)
replaceRange
r
t
=
tf
$
r
:
tail
rs
where
(
tf
,
rs
)
=
typeRanges
t
test/basic/dimensions.sv
View file @
e62074c7
...
@@ -23,6 +23,9 @@ module top;
...
@@ -23,6 +23,9 @@ module top;
$
display
($
bits
(
foo
))
;
$
display
($
bits
(
foo
))
;
`EXHAUST
(
Ram
)
;
`EXHAUST
(
Ram
)
;
`EXHAUST
(
Ram
[
0
+:
2
])
;
`EXHAUST
(
Ram
[
1
+:
2
])
;
`EXHAUST
(
Ram
[
0
][
2
-:
1
])
;
`EXHAUST
(
RamPair
)
;
`EXHAUST
(
RamPair
)
;
`EXHAUST
(
RamPair
[
0
])
;
`EXHAUST
(
RamPair
[
0
])
;
`EXHAUST
(
Word
)
;
`EXHAUST
(
Word
)
;
...
...
test/basic/dimensions.v
View file @
e62074c7
...
@@ -15,6 +15,36 @@ module top;
...
@@ -15,6 +15,36 @@ module top;
$
display
(
1
)
;
$
display
(
1
)
;
$
display
(
160
)
;
$
display
(
160
)
;
$
display
(
2
,
2
,
16
)
;
$
display
(
0
,
0
,
16
)
;
$
display
(
1
,
1
,
1
)
;
$
display
(
1
,
1
,
16
)
;
$
display
(
0
,
0
,
1
)
;
$
display
(
-
1
,
-
1
,
1
)
;
$
display
(
2
)
;
$
display
(
1
)
;
$
display
(
32
)
;
$
display
(
2
,
2
,
16
)
;
$
display
(
1
,
1
,
16
)
;
$
display
(
2
,
2
,
1
)
;
$
display
(
2
,
2
,
16
)
;
$
display
(
1
,
1
,
1
)
;
$
display
(
-
1
,
-
1
,
1
)
;
$
display
(
2
)
;
$
display
(
1
)
;
$
display
(
32
)
;
$
display
(
1
,
1
,
1'bx
)
;
$
display
(
2
,
2
,
1'bx
)
;
$
display
(
2
,
2
,
1'bx
)
;
$
display
(
2
,
2
,
1'bx
)
;
$
display
(
2
,
2
,
1'bx
)
;
$
display
(
1
,
1
,
1'bx
)
;
$
display
(
1
)
;
$
display
(
0
)
;
$
display
(
1
)
;
$
display
(
2
,
2
,
10
)
;
$
display
(
2
,
2
,
10
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
1
,
1
,
9
)
;
$
display
(
1
,
1
,
9
)
;
...
...
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