aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2019-01-19 23:12:25 +0000
committerYann Herklotz <ymherklotz@gmail.com>2019-01-19 23:12:25 +0000
commit64a0ae3600073f486462b1d056409954634b0084 (patch)
treea2315f2f075a2c91b88b0cb3bfaa581d702e2e48 /app
parent771ff2ccb2f07f5c60d4af260d236ee148de667f (diff)
downloadverismith-64a0ae3600073f486462b1d056409954634b0084.tar.gz
verismith-64a0ae3600073f486462b1d056409954634b0084.zip
Reformat with stylish-haskell
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs41
1 files changed, 19 insertions, 22 deletions
diff --git a/app/Main.hs b/app/Main.hs
index efa61e6..632e0f1 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,28 +1,18 @@
module Main where
import Control.Lens
-import qualified Crypto.Random.DRBG as C
-import Data.ByteString (ByteString)
-import qualified Data.ByteString as B
-import qualified Data.Graph.Inductive as G
-import qualified Data.Graph.Inductive.Arbitrary as G
-import qualified Data.Graph.Inductive.Dot as G
-import qualified Data.Graph.Inductive.PatriciaTree as G
-import qualified Data.Text.IO as T
-import qualified Data.Text.Lazy as T
-import Numeric (showHex)
-import Numeric.Natural (Natural)
+import qualified Crypto.Random.DRBG as C
+import Data.ByteString (ByteString)
+import qualified Data.Graph.Inductive as G
+import Numeric (showHex)
import Shelly
-import qualified Test.QuickCheck as QC
+import qualified Test.QuickCheck as QC
import VeriFuzz
-import qualified VeriFuzz.Graph.RandomAlt as V
genRand :: C.CtrDRBG -> Int -> [ByteString] -> [ByteString]
-genRand gen n bytes
- | n == 0 = ranBytes : bytes
- | otherwise = genRand newGen (n-1) $ ranBytes : bytes
- where
- Right (ranBytes, newGen) = C.genBytes 32 gen
+genRand gen n bytes | n == 0 = ranBytes : bytes
+ | otherwise = genRand newGen (n - 1) $ ranBytes : bytes
+ where Right (ranBytes, newGen) = C.genBytes 32 gen
genRandom :: Int -> IO [ByteString]
genRandom n = do
@@ -35,15 +25,22 @@ runSimulation = do
-- let dot = G.showDot . G.fglToDotString $ G.nemap show (const "") gr
-- writeFile "file.dot" dot
-- shelly $ run_ "dot" ["-Tpng", "-o", "file.png", "file.dot"]
- let circ = head $ (nestUpTo 5 . generateAST $ Circuit gr) ^.. getVerilogSrc . traverse . getDescription
+ let circ =
+ head $ (nestUpTo 5 . generateAST $ Circuit gr) ^.. getVerilogSrc . traverse . getDescription
rand <- genRandom 20
- val <- shelly $ runSim defaultIcarus (initMod circ) rand
+ val <- shelly $ runSim defaultIcarus (initMod circ) rand
putStrLn $ showHex (abs val) ""
-runEquivalence:: IO ()
+runEquivalence :: IO ()
runEquivalence = do
gr <- QC.generate $ rDups <$> QC.resize 100 (randomDAG :: QC.Gen (G.Gr Gate ()))
- let circ = initMod . head $ (nestUpTo 5 . generateAST $ Circuit gr) ^.. getVerilogSrc . traverse . getDescription
+ let circ =
+ initMod
+ . head
+ $ (nestUpTo 5 . generateAST $ Circuit gr)
+ ^.. getVerilogSrc
+ . traverse
+ . getDescription
shelly . verbosely $ runEquiv defaultYosys defaultYosys (Just defaultXst) circ
main :: IO ()