aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/CodeGen.hs
diff options
context:
space:
mode:
authorYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-16 14:28:30 +0000
committerYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-16 14:28:30 +0000
commitf28188fc54d187b501b861d43592702bc7e460ec (patch)
treec1d898d080dcfa44a5461218a047d04883076a23 /src/VeriFuzz/CodeGen.hs
parenta83b3b40f683400914d0f3ae23bd9e69e6e0fd96 (diff)
downloadverismith-f28188fc54d187b501b861d43592702bc7e460ec.tar.gz
verismith-f28188fc54d187b501b861d43592702bc7e460ec.zip
Add export lists
Diffstat (limited to 'src/VeriFuzz/CodeGen.hs')
-rw-r--r--src/VeriFuzz/CodeGen.hs32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/VeriFuzz/CodeGen.hs b/src/VeriFuzz/CodeGen.hs
index ea3159d..f35eff7 100644
--- a/src/VeriFuzz/CodeGen.hs
+++ b/src/VeriFuzz/CodeGen.hs
@@ -13,16 +13,22 @@ This module generates the code from the Verilog AST defined in
{-# LANGUAGE FlexibleInstances #-}
-module VeriFuzz.CodeGen where
-
-import Control.Lens (view, (^.))
-import Data.Foldable (fold)
-import Data.Text (Text)
-import qualified Data.Text as T
-import qualified Data.Text.IO as T
-import Numeric (showHex)
-import Test.QuickCheck (Arbitrary, arbitrary)
+module VeriFuzz.CodeGen
+ ( -- * Code Generation
+ GenVerilog(..)
+ , genSource
+ , render
+ ) where
+
+import Control.Lens (view, (^.))
+import Data.Foldable (fold)
+import Data.Text (Text)
+import qualified Data.Text as T
+import qualified Data.Text.IO as T
+import Numeric (showHex)
+import Test.QuickCheck (Arbitrary, arbitrary)
import VeriFuzz.AST
+import VeriFuzz.Internal
-- | 'Source' class which determines that source code is able to be generated
-- from the data structure using 'genSource'. This will be stored in 'Text' and
@@ -30,14 +36,6 @@ import VeriFuzz.AST
class Source a where
genSource :: a -> Text
--- | Inserts commas between '[Text]' and except the last one.
-comma :: [Text] -> Text
-comma = T.intercalate ", "
-
--- | Show function for 'Text'
-showT :: (Show a) => a -> Text
-showT = T.pack . show
-
-- | Map a 'Maybe Stmnt' to 'Text'. If it is 'Just stmnt', the generated
-- statements are returned. If it is 'Nothing', then @;\n@ is returned.
defMap :: Maybe Stmnt -> Text