diff options
Diffstat (limited to 'src/VeriFuzz/Context.hs')
-rw-r--r-- | src/VeriFuzz/Context.hs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/VeriFuzz/Context.hs b/src/VeriFuzz/Context.hs new file mode 100644 index 0000000..8aeed8d --- /dev/null +++ b/src/VeriFuzz/Context.hs @@ -0,0 +1,59 @@ +{-| +Module : VeriFuzz.Context +Description : Context types used in the generation. +Copyright : (c) 2019, Yann Herklotz +License : GPL-3 +Maintainer : yann [at] yannherklotz [dot] com +Stability : experimental +Portability : POSIX + +Context types used in the generation of the Verilog. +-} + +{-# LANGUAGE TemplateHaskell #-} + +module VeriFuzz.Context + ( -- * Context types + Context (..) + , variables + , parameters + , modules + , nameCounter + , stmntDepth + , modDepth + , determinism + , VarContext (..) + , ParamContext (..) + , ModuleContext (..) + , PortContext (..) + , portContPort + , portContND + ) +where + +import Control.Lens (makeLenses) +import Data.HashMap.Lazy (HashMap) +import VeriFuzz.Verilog + +data PortContext = PortContext { _portContPort :: !Port + , _portContND :: !Bool + } + +$(makeLenses ''PortContext) + +type VarContext = HashMap Identifier PortContext + +type ParamContext = HashMap Identifier Parameter + +type ModuleContext = HashMap Identifier ModDecl + +data Context = Context { _variables :: VarContext + , _parameters :: ParamContext + , _modules :: ModuleContext + , _nameCounter :: {-# UNPACK #-} !Int + , _stmntDepth :: {-# UNPACK #-} !Int + , _modDepth :: {-# UNPACK #-} !Int + , _determinism :: !Bool + } + +$(makeLenses ''Context) |