Copyright | (c) 2019 Yann Herklotz |
---|---|
License | GPL-3 |
Maintainer | yann [at] yannherklotz [dot] com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
TOML Configuration file format and parser.
Synopsis
- data Config = Config {}
- defaultConfig :: Config
- data Probability = Probability {}
- data ProbExpr = ProbExpr {
- _probExprNum :: !Int
- _probExprId :: !Int
- _probExprRangeSelect :: !Int
- _probExprUnOp :: !Int
- _probExprBinOp :: !Int
- _probExprCond :: !Int
- _probExprConcat :: !Int
- _probExprStr :: !Int
- _probExprSigned :: !Int
- _probExprUnsigned :: !Int
- data ProbModItem = ProbModItem {}
- data ProbStatement = ProbStatement {
- _probStmntBlock :: !Int
- _probStmntNonBlock :: !Int
- _probStmntCond :: !Int
- _probStmntFor :: !Int
- data ConfProperty = ConfProperty {
- _propSize :: !Int
- _propSeed :: !(Maybe Seed)
- _propStmntDepth :: !Int
- _propModDepth :: !Int
- _propMaxModules :: !Int
- _propSampleMethod :: !Text
- _propSampleSize :: !Int
- _propCombine :: !Bool
- _propNonDeterminism :: !Int
- _propDeterminism :: !Int
- _propDefaultYosys :: !(Maybe Text)
- data SimDescription = SimDescription {}
- data SynthDescription = SynthDescription {}
- fromXST :: XST -> SynthDescription
- fromYosys :: Yosys -> SynthDescription
- fromVivado :: Vivado -> SynthDescription
- fromQuartus :: Quartus -> SynthDescription
- fromQuartusLight :: QuartusLight -> SynthDescription
- configProbability :: Lens' Config Probability
- configProperty :: Lens' Config ConfProperty
- configSimulators :: Lens' Config [SimDescription]
- configSynthesisers :: Lens' Config [SynthDescription]
- probModItem :: Lens' Probability ProbModItem
- probStmnt :: Lens' Probability ProbStatement
- probExpr :: Lens' Probability ProbExpr
- probExprNum :: Lens' ProbExpr Int
- probExprId :: Lens' ProbExpr Int
- probExprRangeSelect :: Lens' ProbExpr Int
- probExprUnOp :: Lens' ProbExpr Int
- probExprBinOp :: Lens' ProbExpr Int
- probExprCond :: Lens' ProbExpr Int
- probExprConcat :: Lens' ProbExpr Int
- probExprStr :: Lens' ProbExpr Int
- probExprSigned :: Lens' ProbExpr Int
- probExprUnsigned :: Lens' ProbExpr Int
- probModItemAssign :: Lens' ProbModItem Int
- probModItemSeqAlways :: Lens' ProbModItem Int
- probModItemCombAlways :: Lens' ProbModItem Int
- probModItemInst :: Lens' ProbModItem Int
- probStmntBlock :: Lens' ProbStatement Int
- probStmntNonBlock :: Lens' ProbStatement Int
- probStmntCond :: Lens' ProbStatement Int
- probStmntFor :: Lens' ProbStatement Int
- propSampleSize :: Lens' ConfProperty Int
- propSampleMethod :: Lens' ConfProperty Text
- propSize :: Lens' ConfProperty Int
- propSeed :: Lens' ConfProperty (Maybe Seed)
- propStmntDepth :: Lens' ConfProperty Int
- propModDepth :: Lens' ConfProperty Int
- propMaxModules :: Lens' ConfProperty Int
- propCombine :: Lens' ConfProperty Bool
- propDeterminism :: Lens' ConfProperty Int
- propNonDeterminism :: Lens' ConfProperty Int
- propDefaultYosys :: Lens' ConfProperty (Maybe Text)
- parseConfigFile :: FilePath -> IO Config
- parseConfig :: Text -> Config
- encodeConfig :: Config -> Text
- encodeConfigFile :: FilePath -> Config -> IO ()
- versionInfo :: String
TOML Configuration
Verismith supports a TOML configuration file that can be passed using the -c
flag or using the parseConfig
and encodeConfig
functions. The
configuration can then be manipulated using the lenses that are also provided
in this module.
The configuration file can be used to tweak the random Verilog generation by
passing different probabilities to each of the syntax nodes in the AST. It
can also be used to specify which simulators to fuzz with which options. A
seed for the run can also be set, to replay a previous run using the same
exact generation. A default value is associated with each key in the
configuration file, which means that only the options that need overriding
can be added to the configuration. The defaults can be observed in
defaultConfig
or when running verismith config
.
Configuration Sections
There are four main configuration sections in the TOML file:
probability
- The
probability
section defines the probabilities at every node in the AST. property
- Controls different properties of the generation, such as adding a seed or the depth of the statements.
simulator
- This is an array of tables containing descriptions of the different simulators that should be used. It currently only supports Icarus Verilog.
synthesiser
- This is also an array of tables containing descriptions of the different synthesisers that should be used. The synthesisers that are currently supported are:
Config | |
|
Probabilities
data Probability Source #
[probability]
: combined probabilities.
Probability | |
|
Instances
Eq Probability Source # | |
Defined in Verismith.Config (==) :: Probability -> Probability -> Bool # (/=) :: Probability -> Probability -> Bool # | |
Show Probability Source # | |
Defined in Verismith.Config showsPrec :: Int -> Probability -> ShowS # show :: Probability -> String # showList :: [Probability] -> ShowS # |
Expression
Probability of different expressions nodes.
ProbExpr | |
|
Module Item
data ProbModItem Source #
Probability of generating different nodes inside a module declaration.
ProbModItem | |
|
Instances
Eq ProbModItem Source # | |
Defined in Verismith.Config (==) :: ProbModItem -> ProbModItem -> Bool # (/=) :: ProbModItem -> ProbModItem -> Bool # | |
Show ProbModItem Source # | |
Defined in Verismith.Config showsPrec :: Int -> ProbModItem -> ShowS # show :: ProbModItem -> String # showList :: [ProbModItem] -> ShowS # |
Statement
data ProbStatement Source #
Probability of generating different statements.
ProbStatement | |
|
Instances
Eq ProbStatement Source # | |
Defined in Verismith.Config (==) :: ProbStatement -> ProbStatement -> Bool # (/=) :: ProbStatement -> ProbStatement -> Bool # | |
Show ProbStatement Source # | |
Defined in Verismith.Config showsPrec :: Int -> ProbStatement -> ShowS # show :: ProbStatement -> String # showList :: [ProbStatement] -> ShowS # |
ConfProperty
data ConfProperty Source #
[property]
: properties for the generated Verilog file.
ConfProperty | |
|
Instances
Eq ConfProperty Source # | |
Defined in Verismith.Config (==) :: ConfProperty -> ConfProperty -> Bool # (/=) :: ConfProperty -> ConfProperty -> Bool # | |
Show ConfProperty Source # | |
Defined in Verismith.Config showsPrec :: Int -> ConfProperty -> ShowS # show :: ConfProperty -> String # showList :: [ConfProperty] -> ShowS # |
Simulator Description
data SimDescription Source #
Description of the simulator
Instances
Eq SimDescription Source # | |
Defined in Verismith.Config (==) :: SimDescription -> SimDescription -> Bool # (/=) :: SimDescription -> SimDescription -> Bool # | |
Show SimDescription Source # | |
Defined in Verismith.Config showsPrec :: Int -> SimDescription -> ShowS # show :: SimDescription -> String # showList :: [SimDescription] -> ShowS # |
Synthesiser Description
data SynthDescription Source #
[[synthesiser]]
: description of the synthesis tool. There can be multiple of these sections in a config
file.
SynthDescription | |
|
Instances
Eq SynthDescription Source # | |
Defined in Verismith.Config (==) :: SynthDescription -> SynthDescription -> Bool # (/=) :: SynthDescription -> SynthDescription -> Bool # | |
Show SynthDescription Source # | |
Defined in Verismith.Config showsPrec :: Int -> SynthDescription -> ShowS # show :: SynthDescription -> String # showList :: [SynthDescription] -> ShowS # |
Useful Lenses
fromXST :: XST -> SynthDescription Source #
fromYosys :: Yosys -> SynthDescription Source #
fromVivado :: Vivado -> SynthDescription Source #
parseConfig :: Text -> Config Source #
encodeConfig :: Config -> Text Source #
versionInfo :: String Source #