diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-11-30 23:30:53 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-11-30 23:30:53 +0000 |
commit | d5b0ff4cba238f52765c56b21c4efd01e355bb88 (patch) | |
tree | 1eb4157012e4a6112c63d8c5a578b62c52c31e24 | |
parent | b90fa78203d7b7da8c872b67575bdfeabaa5d134 (diff) | |
download | verismith-d5b0ff4cba238f52765c56b21c4efd01e355bb88.tar.gz verismith-d5b0ff4cba238f52765c56b21c4efd01e355bb88.zip |
Add more types
-rw-r--r-- | src/Test/VeriFuzz/VerilogAST.hs | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/Test/VeriFuzz/VerilogAST.hs b/src/Test/VeriFuzz/VerilogAST.hs index e4d19ec..d4514cc 100644 --- a/src/Test/VeriFuzz/VerilogAST.hs +++ b/src/Test/VeriFuzz/VerilogAST.hs @@ -4,28 +4,35 @@ module Test.VeriFuzz.VerilogAST where import Control.Lens import Data.Text (Text) -import qualified Data.Text as T -type NetLVal = Text +newtype NetLVal = NetLVal { _getNetLVal :: Text } + deriving (Show) +makeLenses ''NetLVal -type Identifier = Text +newtype Identifier = Identifier { _getIdentifier :: Text } + deriving (Show) +makeLenses ''Identifier data Number = Number { _numSize :: Int , _numVal :: Int } deriving (Show) +makeLenses ''Number data BinaryOperator = BinAnd | BinOr | BinXor deriving (Show) +makeLenses ''BinaryOperator data UnaryOperator = UnNot | UnMinus deriving (Show) +makeLenses ''UnaryOperator data Primary = PrimNum Number | PrimId Identifier deriving (Show) +makeLenses ''Primary data Expression = PrimExpr Primary | UnPrimExpr { _exprUnOp :: UnaryOperator @@ -40,34 +47,40 @@ data Expression = PrimExpr Primary , _exprFalse :: Expression } deriving (Show) +makeLenses ''Expression data ContAssign = ContAssign { _contAssignNetLVal :: NetLVal , _contAssignExpr :: Expression } deriving (Show) +makeLenses ''ContAssign data PortDir = Input | Output | InOut deriving (Show) +makeLenses ''PortDir data Port = Port { _portName :: Identifier , _portDir :: PortDir } deriving (Show) +makeLenses ''Port -type ModuleItem = Text +newtype ModuleItem = ModuleItem { _getModuleItem :: Text } + deriving (Show) +makeLenses ''ModuleItem -- | 'module' module_identifier [list_of_ports] ';' { module_item } 'end_module' data ModuleDecl = ModuleDecl { _moduleId :: Identifier , _modPorts :: [Port] , _moduleItem :: ModuleItem } deriving (Show) +makeLenses ''ModuleDecl -type Description = ModuleDecl - -type SourceText = [Description] +newtype Description = Description { _getDescription :: ModuleDecl } + deriving (Show) +makeLenses ''Description -makeLenses ''Number -makeLenses ''Expression -makeLenses ''ContAssign -makeLenses ''Port -makeLenses ''ModuleDecl +newtype SourceText = SourceText { _getSourceText :: [Description] } + deriving (Show + ) +makeLenses ''SourceText |