aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Config.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-26 13:48:32 +0100
committerYann Herklotz <git@ymhg.org>2019-04-26 13:48:56 +0100
commit1f92f329dabfaf5077bed677a273a196667229e1 (patch)
treea19c9ed6ec91db71d51684911420fd12a80a59bc /src/VeriFuzz/Config.hs
parent1486a2afa481de46938c1bc122c469975978593f (diff)
downloadverismith-1f92f329dabfaf5077bed677a273a196667229e1.tar.gz
verismith-1f92f329dabfaf5077bed677a273a196667229e1.zip
Add random bit selection for wires
This has not been tested fully yet
Diffstat (limited to 'src/VeriFuzz/Config.hs')
-rw-r--r--src/VeriFuzz/Config.hs25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/VeriFuzz/Config.hs b/src/VeriFuzz/Config.hs
index 77d62a4..8a3d422 100644
--- a/src/VeriFuzz/Config.hs
+++ b/src/VeriFuzz/Config.hs
@@ -44,6 +44,7 @@ module VeriFuzz.Config
, probEventList
, probExprNum
, probExprId
+ , probExprRangeSelect
, probExprUnOp
, probExprBinOp
, probExprCond
@@ -160,30 +161,32 @@ import qualified Toml
-- <BLANKLINE>
-- | Probability of different expressions nodes.
-data ProbExpr = ProbExpr { _probExprNum :: {-# UNPACK #-} !Int
+data ProbExpr = ProbExpr { _probExprNum :: {-# UNPACK #-} !Int
-- ^ Probability of generation a number like
-- @4'ha@. This should never be set to 0, as it is used
-- as a fallback in case there are no viable
-- identifiers, such as none being in scope.
- , _probExprId :: {-# UNPACK #-} !Int
+ , _probExprId :: {-# UNPACK #-} !Int
-- ^ Probability of generating an identifier that is in
-- scope and of the right type.
- , _probExprUnOp :: {-# UNPACK #-} !Int
+ , _probExprRangeSelect :: {-# UNPACK #-} !Int
+ -- ^ Probability of generating a range selection from a port.
+ , _probExprUnOp :: {-# UNPACK #-} !Int
-- ^ Probability of generating a unary operator.
- , _probExprBinOp :: {-# UNPACK #-} !Int
+ , _probExprBinOp :: {-# UNPACK #-} !Int
-- ^ Probability of generation a binary operator.
- , _probExprCond :: {-# UNPACK #-} !Int
+ , _probExprCond :: {-# UNPACK #-} !Int
-- ^ probability of generating a conditional ternary
-- operator.
- , _probExprConcat :: {-# UNPACK #-} !Int
+ , _probExprConcat :: {-# UNPACK #-} !Int
-- ^ Probability of generating a concatenation.
- , _probExprStr :: {-# UNPACK #-} !Int
+ , _probExprStr :: {-# UNPACK #-} !Int
-- ^ Probability of generating a string. This is not
-- fully supported therefore currently cannot be set.
- , _probExprSigned :: {-# UNPACK #-} !Int
+ , _probExprSigned :: {-# UNPACK #-} !Int
-- ^ Probability of generating a signed function
-- @$signed(...)@.
- , _probExprUnsigned :: {-# UNPACK #-} !Int
+ , _probExprUnsigned :: {-# UNPACK #-} !Int
-- ^ Probability of generating an unsigned function
-- @$unsigned(...)@.
}
@@ -265,7 +268,7 @@ defaultConfig = Config
where
defModItem = ProbModItem 5 1 1
defStmnt = ProbStatement 0 15 1 1
- defExpr = ProbExpr 1 1 1 1 1 1 0 1 1
+ defExpr = ProbExpr 1 1 1 1 1 1 1 0 1 1
defEvent = ProbEventList 1 1 1
twoKey :: Toml.Piece -> Toml.Piece -> Toml.Key
@@ -281,6 +284,8 @@ exprCodec =
.= _probExprNum
<*> defaultValue (defProb probExprId) (intE "variable")
.= _probExprId
+ <*> defaultValue (defProb probExprRangeSelect) (intE "rangeselect")
+ .= _probExprRangeSelect
<*> defaultValue (defProb probExprUnOp) (intE "unary")
.= _probExprUnOp
<*> defaultValue (defProb probExprBinOp) (intE "binary")