mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-04 08:45:29 +02:00
use repeats for converted unbased-unsized literals
- reduces the number of cast functions which are generated - adjust package_function_cast to preserve cast converage - fix issue where cast functions would be generated before localparam substitution within a procedure
This commit is contained in:
@@ -31,7 +31,10 @@ traverseDeclM decl = do
|
||||
if isPrefixOf "sv2v_cast_" x && details /= Nothing
|
||||
then return $ Variable Local DuplicateTag x [] Nil
|
||||
else insertElem x t >> return decl
|
||||
Param _ t x _ -> insertElem x t >> return decl
|
||||
Param _ t x _ -> do
|
||||
inProcedure <- withinProcedureM
|
||||
when (not inProcedure) $ insertElem x t
|
||||
return decl
|
||||
ParamType _ _ _ -> return decl
|
||||
CommentDecl _ -> return decl
|
||||
traverseDeclExprsM traverseExprM decl'
|
||||
|
||||
@@ -102,7 +102,7 @@ convertModuleItemM (Instance moduleName params instanceName [] bindings) = do
|
||||
expr'' <- traverseNestedExprsM (replaceBindingExpr port) expr'
|
||||
return (portName, expr'')
|
||||
replaceBindingExpr :: Port -> Expr -> Writer Binds Expr
|
||||
replaceBindingExpr port (orig @ (Cast Right{} (ConvertedUU a b))) = do
|
||||
replaceBindingExpr port (orig @ (Repeat _ [ConvertedUU a b])) = do
|
||||
let ch = charForBit a b
|
||||
if orig == sizedLiteralFor tag ch
|
||||
then do
|
||||
@@ -141,7 +141,7 @@ charForBit _ _ = error "charForBit invariant violated"
|
||||
|
||||
sizedLiteralFor :: Expr -> Char -> Expr
|
||||
sizedLiteralFor expr ch =
|
||||
Cast (Right size) (literalFor ch)
|
||||
Repeat size [literalFor ch]
|
||||
where size = DimsFn FnBits $ Right expr
|
||||
|
||||
convertAsgn :: (LHS, Expr) -> (LHS, Expr)
|
||||
|
||||
Reference in New Issue
Block a user