aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-04 15:29:51 +0100
committerYann Herklotz <git@ymhg.org>2019-04-04 15:29:51 +0100
commit855cae6758b4dd92280d7548862b3d9c8cf61281 (patch)
treeed37d2de615bf775bd7ffbb783b63a61553b18fa /src
parent02019f140184b29735bc8aca17dedb38c0a0a3f1 (diff)
downloadverismith-855cae6758b4dd92280d7548862b3d9c8cf61281.tar.gz
verismith-855cae6758b4dd92280d7548862b3d9c8cf61281.zip
Reorganise runEquivalence
Diffstat (limited to 'src')
-rw-r--r--src/VeriFuzz.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/VeriFuzz.hs b/src/VeriFuzz.hs
index b6b134b..ebedb0d 100644
--- a/src/VeriFuzz.hs
+++ b/src/VeriFuzz.hs
@@ -113,13 +113,18 @@ checkEquivalence src dir = shellyFailDir $ do
-- | Run a fuzz run and check if all of the simulators passed by checking if the
-- generated Verilog files are equivalent.
-runEquivalence :: Gen Verilog -> Text -> Int -> IO ()
-runEquivalence gm t i = do
+runEquivalence :: Gen Verilog -- ^ Generator for the Verilog file.
+ -> Text -- ^ Name of the folder on each thread.
+ -> Text -- ^ Name of the general folder being used.
+ -> Bool -- ^ Keep flag.
+ -> Int -- ^ Used to track the recursion.
+ -> IO ()
+runEquivalence gm t d k i = do
m <- Hog.sample gm
let srcInfo = SourceInfo "top" m
rand <- generateByteString 20
shellyFailDir $ do
- mkdir_p (fromText "output" </> fromText n)
+ mkdir_p (fromText d </> fromText n)
curr <- toTextIgnore <$> pwd
setenv "VERIFUZZ_ROOT" curr
cd (fromText "output" </> fromText n)
@@ -134,8 +139,8 @@ runEquivalence gm t i = do
)
$ onFailure n
cd ".."
- rm_rf $ fromText n
- when (i < 5) (runEquivalence gm t $ i + 1)
+ unless k . rm_rf $ fromText n
+ when (i < 5) (runEquivalence gm t d k $ i + 1)
where n = t <> "_" <> T.pack (show i)
runReduce :: SourceInfo -> IO SourceInfo