diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-07-26 11:43:10 +0200 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-07-26 11:43:10 +0200 |
commit | e200500f6a43d0ed48b194f9fc397fd32e9ce3e2 (patch) | |
tree | f62bea2924ff4a24bddde6982686400377d64c05 /src/VeriFuzz/Config.hs | |
parent | eab290581be7e3c0f504044731c076f858d24e61 (diff) | |
download | verismith-e200500f6a43d0ed48b194f9fc397fd32e9ce3e2.tar.gz verismith-e200500f6a43d0ed48b194f9fc397fd32e9ce3e2.zip |
Add non determinism probability to generation
Diffstat (limited to 'src/VeriFuzz/Config.hs')
-rw-r--r-- | src/VeriFuzz/Config.hs | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/VeriFuzz/Config.hs b/src/VeriFuzz/Config.hs index dab854b..8705f7c 100644 --- a/src/VeriFuzz/Config.hs +++ b/src/VeriFuzz/Config.hs @@ -69,6 +69,8 @@ module VeriFuzz.Config , propModDepth , propMaxModules , propCombine + , propDeterminism + , propNonDeterminism , parseConfigFile , parseConfig , encodeConfig @@ -192,14 +194,36 @@ data Probability = Probability { _probModItem :: {-# UNPACK #-} !ProbModItem } deriving (Eq, Show) -data ConfProperty = ConfProperty { _propSize :: {-# UNPACK #-} !Int - , _propSeed :: !(Maybe Seed) - , _propStmntDepth :: {-# UNPACK #-} !Int - , _propModDepth :: {-# UNPACK #-} !Int - , _propMaxModules :: {-# UNPACK #-} !Int - , _propSampleMethod :: !Text - , _propSampleSize :: {-# UNPACK #-} !Int - , _propCombine :: !Bool +data ConfProperty = ConfProperty { _propSize :: {-# UNPACK #-} !Int + -- ^ The size of the generated Verilog. + , _propSeed :: !(Maybe Seed) + -- ^ A possible seed that could be used to + -- generate the same Verilog. + , _propStmntDepth :: {-# UNPACK #-} !Int + -- ^ The maximum statement depth that should be + -- reached. + , _propModDepth :: {-# UNPACK #-} !Int + -- ^ The maximium module depth that should be + -- reached. + , _propMaxModules :: {-# UNPACK #-} !Int + -- ^ The maximum number of modules that are + -- allowed to be created at each level. + , _propSampleMethod :: !Text + -- ^ The sampling method that should be used to + -- generate specific distributions of random + -- programs. + , _propSampleSize :: {-# UNPACK #-} !Int + -- ^ The number of samples to take for the + -- sampling method. + , _propCombine :: !Bool + -- ^ If the output should be combined into one + -- bit or not. + , _propNonDeterminism :: {-# UNPACK #-} !Int + -- ^ The frequency at which nondeterminism + -- should be generated. + , _propDeterminism :: {-# UNPACK #-} !Int + -- ^ The frequency at which determinism should + -- be generated. } deriving (Eq, Show) @@ -267,7 +291,7 @@ defaultConfig :: Config defaultConfig = Config (Info (pack $(gitHash)) (pack $ showVersion version)) (Probability defModItem defStmnt defExpr) - (ConfProperty 20 Nothing 3 2 5 "random" 10 False) + (ConfProperty 20 Nothing 3 2 5 "random" 10 False 0 1) [] [fromYosys defaultYosys, fromVivado defaultVivado] where @@ -388,6 +412,10 @@ propCodec = <*> defaultValue (defProp propCombine) (Toml.bool (twoKey "output" "combine")) .= _propCombine + <*> defaultValue (defProp propNonDeterminism) (Toml.int "nondeterminism") + .= _propNonDeterminism + <*> defaultValue (defProp propDeterminism) (Toml.int "determinism") + .= _propDeterminism where defProp i = defaultConfig ^. configProperty . i simulator :: TomlCodec SimDescription |