mirror of https://github.com/zachjs/sv2v.git
minor perf optimization
This commit is contained in:
parent
336b180d74
commit
39f0e9b40d
|
|
@ -55,8 +55,7 @@ traverseStmtM :: Stmt -> State Info Stmt
|
|||
traverseStmtM stmt = traverseStmtExprsM traverseExprM stmt
|
||||
|
||||
traverseExprM :: Expr -> State Info Expr
|
||||
traverseExprM = traverseNestedExprsM $ stately converter
|
||||
where converter a b = simplify $ (traverseNestedExprs (convertExpr a) b)
|
||||
traverseExprM = traverseNestedExprsM $ stately convertExpr
|
||||
|
||||
-- elaborate integer atom types to have explicit dimensions
|
||||
elaborateType :: Type -> Type
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ convertExpr info (Mux cc aa bb) =
|
|||
where
|
||||
before = substitute info cc
|
||||
after = simplify before
|
||||
convertExpr _ (other @ Repeat{}) = traverseNestedExprs simplify other
|
||||
convertExpr _ (other @ Concat{}) = simplify other
|
||||
convertExpr _ other = other
|
||||
|
||||
substitute :: Info -> Expr -> Expr
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ castFn e sg =
|
|||
Function (Just Automatic) t fnName [decl] [Return $ Ident inp]
|
||||
where
|
||||
inp = "inp"
|
||||
r = (BinOp Sub e (Number "1"), Number "0")
|
||||
r = (simplify $ BinOp Sub e (Number "1"), Number "0")
|
||||
t = IntegerVector TLogic sg [r]
|
||||
fnName = castFnName e sg
|
||||
decl = Variable Input t inp [] Nothing
|
||||
|
|
|
|||
|
|
@ -349,9 +349,7 @@ traverseAssertionExprsM mapper = assertionMapper
|
|||
propExprMapper (PropExprIff p1 p2) =
|
||||
ppMapper PropExprIff p1 p2
|
||||
propSpecMapper (PropertySpec ms me pe) = do
|
||||
me' <- case me of
|
||||
Nothing -> return Nothing
|
||||
Just e -> mapper e >>= return . Just
|
||||
me' <- maybeExprMapper me
|
||||
pe' <- propExprMapper pe
|
||||
return $ PropertySpec ms me' pe'
|
||||
assertionExprMapper (Left e) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue