type inference for localparams performed lazily

The implicit type of a localparam is not always needed. This improves
performance when complex localparam expressions are processed.
This commit is contained in:
Zachary Snow 2022-12-24 01:01:33 -07:00
parent 9de4d44305
commit e09aea48e0
1 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,7 @@
module Convert.TypeOf (convert) where module Convert.TypeOf (convert) where
import Control.Monad.State.Strict
import Data.Tuple (swap) import Data.Tuple (swap)
import Convert.ExprUtils (dimensionsSize, endianCondRange, simplify) import Convert.ExprUtils (dimensionsSize, endianCondRange, simplify)
@ -71,7 +72,8 @@ traverseDeclM decl = do
-- rewrite and store a non-genvar data declaration's type information -- rewrite and store a non-genvar data declaration's type information
insertType :: Identifier -> Type -> ST () insertType :: Identifier -> Type -> ST ()
insertType ident typ = do insertType ident typ = do
typ' <- scopeType typ -- hack to make this evaluation lazy
typ' <- gets $ evalState $ scopeType typ
insertElem ident typ' insertElem ident typ'
-- convert TypeOf in a ModuleItem -- convert TypeOf in a ModuleItem