Skip to content

Commit

Permalink
Add new pretty printer with indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yann Herklotz committed May 9, 2019
1 parent 76ce30d commit 77702d5
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 219 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ addons:
- ghc-8.6.4

script:
- stack --no-terminal --skip-ghc-check test --pedantic
- stack --no-terminal --skip-ghc-check test --pedantic --fast
2 changes: 1 addition & 1 deletion Setup.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Distribution.Extra.Doctest

main :: IO ()
main = defaultMainWithDoctests "verifuzz-doctest"
main = defaultMainWithDoctests "doctest"
2 changes: 1 addition & 1 deletion src/VeriFuzz.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ runEquivalence seed gm t d k i = do
where n = t <> "_" <> T.pack (show i)

runReduce :: SourceInfo -> IO SourceInfo
runReduce s = reduce (\s -> not <$> checkEquivalence s "reduce") s
runReduce s = reduce (\s' -> not <$> checkEquivalence s' "reduce") s
24 changes: 12 additions & 12 deletions src/VeriFuzz/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ module VeriFuzz.Config
, ProbModItem(..)
-- *** Statement
, ProbStatement(..)
-- ** Property
, Property(..)
-- ** ConfProperty
, ConfProperty(..)
-- ** Simulator Description
, SimDescription(..)
-- ** Synthesiser Description
Expand Down Expand Up @@ -189,11 +189,11 @@ data Probability = Probability { _probModItem :: {-# UNPACK #-} !ProbModItem
}
deriving (Eq, Show)

data Property = Property { _propSize :: {-# UNPACK #-} !Int
, _propSeed :: !(Maybe Seed)
, _propStmntDepth :: {-# UNPACK #-} !Int
, _propModDepth :: {-# UNPACK #-} !Int
, _propMaxModules :: {-# UNPACK #-} !Int
data ConfProperty = ConfProperty { _propSize :: {-# UNPACK #-} !Int
, _propSeed :: !(Maybe Seed)
, _propStmntDepth :: {-# UNPACK #-} !Int
, _propModDepth :: {-# UNPACK #-} !Int
, _propMaxModules :: {-# UNPACK #-} !Int
}
deriving (Eq, Show)

Expand All @@ -214,7 +214,7 @@ data SynthDescription = SynthDescription { synthName :: {-# UNPACK #-} !Text

data Config = Config { _configInfo :: Info
, _configProbability :: {-# UNPACK #-} !Probability
, _configProperty :: {-# UNPACK #-} !Property
, _configProperty :: {-# UNPACK #-} !ConfProperty
, _configSimulators :: [SimDescription]
, _configSynthesisers :: [SynthDescription]
}
Expand All @@ -224,7 +224,7 @@ $(makeLenses ''ProbExpr)
$(makeLenses ''ProbModItem)
$(makeLenses ''ProbStatement)
$(makeLenses ''Probability)
$(makeLenses ''Property)
$(makeLenses ''ConfProperty)
$(makeLenses ''Info)
$(makeLenses ''Config)

Expand Down Expand Up @@ -270,7 +270,7 @@ fromQuartus (Quartus a b c) =
defaultConfig :: Config
defaultConfig = Config (Info (pack $(gitHash)) (pack $ showVersion version))
(Probability defModItem defStmnt defExpr)
(Property 20 Nothing 3 2 5)
(ConfProperty 20 Nothing 3 2 5)
[]
[fromYosys defaultYosys, fromVivado defaultVivado]
where
Expand Down Expand Up @@ -370,9 +370,9 @@ probCodec =
.= _probExpr
where defProb i = defaultConfig ^. configProbability . i

propCodec :: TomlCodec Property
propCodec :: TomlCodec ConfProperty
propCodec =
Property
ConfProperty
<$> defaultValue (defProp propSize) (Toml.int "size")
.= _propSize
<*> Toml.dioptional (Toml.read "seed")
Expand Down
Loading

0 comments on commit 77702d5

Please sign in to comment.