diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-07-29 15:47:22 +0200 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-07-29 15:47:22 +0200 |
commit | c2ada55bccc73cb604b77270049f0cfcc7e92bb8 (patch) | |
tree | 37063402dc6cd8444ac8f0f2e3e5a51fafc86618 /src/VeriFuzz/Context.hs | |
parent | 1aec47ead1c9fb65ab5b5e4b55337a79ff9314af (diff) | |
download | verismith-feature/hashmap.tar.gz verismith-feature/hashmap.zip |
Use HashMap for contextfeature/hashmap
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) |