Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
8d7db075
Commit
8d7db075
authored
Aug 25, 2017
by
Jens Korinth
Browse files
Work on generator for valid data width conversions
parent
43beb5b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/scala/generators.scala
View file @
8d7db075
...
...
@@ -33,6 +33,12 @@ package object generators {
type
DataSize
=
Limited
[
Int
]
def
dataSizeGen
(
max
:
Int
=
1024
)
:
Gen
[
DataSize
]
=
genLimited
(
1
,
max
)
/** Generates bit width that is a integer ratio from the other. */
def
conversionWidthGen
(
inW
:
BitWidth
)
:
Gen
[
BitWidth
]
=
Gen
.
oneOf
(
((
Stream
.
from
(
2
)
map
(
inW
*
_
)
takeWhile
((
i
:
Int
)
=>
i
<=
inW
.
max
)).
toList
++
(
Stream
.
from
(
2
)
map
(
inW
/
_
)
takeWhile
((
i
:
Int
)
=>
i
>
0
)
filter
((
i
:
Int
)
=>
inW
%
i
==
0
)).
toList
).
map
(
Limited
(
_
,
1
,
64
))
)
/** Generator for a DataWidthConverter test configuration consisting of
* input bit width, output bit width and endianess flag. */
def
widthConversionGen
(
max
:
Int
=
64
)
:
Gen
[(
BitWidth
,
BitWidth
,
Boolean
)]
=
for
{
...
...
Jens Korinth
@jk
mentioned in commit
17f0d672
·
Mar 05, 2018
mentioned in commit
17f0d672
mentioned in commit 17f0d67240ebf5d7e1d0be9162d272b04256c47d
Toggle commit list
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