@@ -15,6 +15,7 @@ import Clash.Netlist.Types (TopEntityT(topId))
15
15
16
16
import Criterion.Main
17
17
18
+ import qualified Control.Concurrent.MVar as MVar
18
19
import qualified Control.Concurrent.Supply as Supply
19
20
import Control.DeepSeq (NFData (.. ), rwhnf )
20
21
import Data.List (isPrefixOf , partition )
@@ -42,7 +43,7 @@ main = do
42
43
benchFile :: [FilePath ] -> FilePath -> Benchmark
43
44
benchFile idirs src =
44
45
env (setupEnv idirs src) $
45
- \ ~ (clashEnv, clashDesign, supplyN) -> do
46
+ \ ~ (clashEnv, clashDesign, supplyN, lock ) -> do
46
47
bench (" normalization of " ++ src)
47
48
(nfIO
48
49
(normalizeEntity
@@ -51,18 +52,20 @@ benchFile idirs src =
51
52
(ghcTypeToHWType (opt_intWidth (envOpts clashEnv)))
52
53
ghcEvaluator
53
54
evaluator
55
+ lock
54
56
(fmap topId (designEntities clashDesign))
55
57
supplyN
56
58
(topId (head (designEntities clashDesign)))))
57
59
58
60
setupEnv
59
61
:: [FilePath ]
60
62
-> FilePath
61
- -> IO (ClashEnv , ClashDesign , Supply. Supply )
63
+ -> IO (ClashEnv , ClashDesign , Supply. Supply, MVar. MVar () )
62
64
setupEnv idirs src = do
63
65
(clashEnv, clashDesign) <- runInputStage idirs src
64
66
supplyN <- Supply. newSupply
65
- return (clashEnv, clashDesign ,supplyN)
67
+ lock <- MVar. newMVar ()
68
+ return (clashEnv, clashDesign ,supplyN, lock)
66
69
67
70
instance NFData Supply. Supply where
68
71
rnf = rwhnf
0 commit comments