diff options
-rw-r--r-- | src/Test/VeriFuzz/VerilogAST.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Test/VeriFuzz/VerilogAST.hs b/src/Test/VeriFuzz/VerilogAST.hs index 8314acb..53efad1 100644 --- a/src/Test/VeriFuzz/VerilogAST.hs +++ b/src/Test/VeriFuzz/VerilogAST.hs @@ -1,14 +1,12 @@ -{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} module Test.VeriFuzz.VerilogAST where import Control.Lens +import Data.Text as T import Data.Text (Text) -newtype NetLVal = NetLVal { _getNetLVal :: Text } - deriving (Show) -makeLenses ''NetLVal - newtype Identifier = Identifier { _getIdentifier :: Text } deriving (Show) makeLenses ''Identifier @@ -49,7 +47,7 @@ data Expression = PrimExpr Primary deriving (Show) makeLenses ''Expression -data ContAssign = ContAssign { _contAssignNetLVal :: NetLVal +data ContAssign = ContAssign { _contAssignNetLVal :: Identifier , _contAssignExpr :: Expression } deriving (Show) makeLenses ''ContAssign @@ -83,3 +81,14 @@ makeLenses ''Description newtype SourceText = SourceText { _getSourceText :: [Description] } deriving (Show) makeLenses ''SourceText + +numExpr :: Int -> Int -> Expression +numExpr = ((PrimExpr . PrimNum) .) . Number + +emptyMod :: ModuleDecl +emptyMod = + ModuleDecl (Identifier "") [] $ Assign $ ContAssign (Identifier "") $ + OpExpr (numExpr 32 0) BinAnd (numExpr 32 0) + +setModName :: Text -> ModuleDecl -> ModuleDecl +setModName str = moduleId .~ (Identifier str) |