aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriSmith/Circuit.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-09-04 20:15:51 +1000
committerYann Herklotz <git@yannherklotz.com>2019-09-04 20:15:51 +1000
commita2b01b92612a098673ff03890e6e8aef4ceb28ea (patch)
tree15cafe6ba47981938552a4b342a56795251aadc5 /src/VeriSmith/Circuit.hs
parentcccb665ebac6e916c4f961eacbe11a9af7d7ceb3 (diff)
downloadverismith-a2b01b92612a098673ff03890e6e8aef4ceb28ea.tar.gz
verismith-a2b01b92612a098673ff03890e6e8aef4ceb28ea.zip
Renaming to VeriSmith
Diffstat (limited to 'src/VeriSmith/Circuit.hs')
-rw-r--r--src/VeriSmith/Circuit.hs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/VeriSmith/Circuit.hs b/src/VeriSmith/Circuit.hs
new file mode 100644
index 0000000..aee0d57
--- /dev/null
+++ b/src/VeriSmith/Circuit.hs
@@ -0,0 +1,45 @@
+{-|
+Module : VeriSmith.Circuit
+Description : Definition of the circuit graph.
+Copyright : (c) 2018-2019, Yann Herklotz
+License : BSD-3
+Maintainer : yann [at] yannherklotz [dot] com
+Stability : experimental
+Portability : POSIX
+
+Definition of the circuit graph.
+-}
+
+module VeriSmith.Circuit
+ ( -- * Circuit
+ Gate(..)
+ , Circuit(..)
+ , CNode(..)
+ , CEdge(..)
+ , fromGraph
+ , generateAST
+ , rDups
+ , rDupsCirc
+ , randomDAG
+ , genRandomDAG
+ )
+where
+
+import Control.Lens
+import Hedgehog (Gen)
+import qualified Hedgehog.Gen as Hog
+import VeriSmith.Circuit.Base
+import VeriSmith.Circuit.Gen
+import VeriSmith.Circuit.Random
+import VeriSmith.Verilog.AST
+import VeriSmith.Verilog.Mutate
+
+fromGraph :: Gen ModDecl
+fromGraph = do
+ gr <- rDupsCirc <$> Hog.resize 100 randomDAG
+ return
+ $ initMod
+ . head
+ $ nestUpTo 5 (generateAST gr)
+ ^.. _Wrapped
+ . traverse