mirror of https://github.com/zachjs/sv2v.git
check for conflicts with unused declarations
This commit is contained in:
parent
a9f00cce2a
commit
e00582de8f
|
|
@ -123,8 +123,21 @@ convertPackages files =
|
|||
-- injected package items
|
||||
collectIdentConflicts :: Idents -> AST -> Writer Idents ()
|
||||
collectIdentConflicts prefixes =
|
||||
mapM_ $ collectModuleItemsM $ collectify traverseIdentsM $
|
||||
collectIdent prefixes
|
||||
mapM_ $ collectModuleItemsM collectModuleItem
|
||||
where
|
||||
collectModuleItem =
|
||||
evalScoperT . scoper >=>
|
||||
collectify traverseIdentsM ident
|
||||
scoper = scopeModuleItem collectDecl return return return
|
||||
collectDecl decl = do
|
||||
case decl of
|
||||
Variable _ _ x _ _ -> lift $ ident x
|
||||
Net _ _ _ _ x _ _ -> lift $ ident x
|
||||
Param _ _ x _ -> lift $ ident x
|
||||
ParamType _ x _ -> lift $ ident x
|
||||
CommentDecl{} -> return ()
|
||||
return decl
|
||||
ident = collectIdent prefixes
|
||||
|
||||
-- write down identifiers that have a package name as a prefix
|
||||
collectIdent :: Idents -> Identifier -> Writer Idents ()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package P;
|
||||
typedef logic T;
|
||||
typedef logic [1:0] U;
|
||||
endpackage
|
||||
|
||||
module top;
|
||||
P::T P_T;
|
||||
assign P_T = 0;
|
||||
initial $display("%b", P_T);
|
||||
P::U P_U = 0;
|
||||
endmodule
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ module top;
|
|||
wire P_T;
|
||||
assign P_T = 0;
|
||||
initial $display("%b", P_T);
|
||||
reg [1:0] P_U = 0;
|
||||
endmodule
|
||||
|
|
|
|||
Loading…
Reference in New Issue