Commit e00582de by Zachary Snow

check for conflicts with unused declarations

parent a9f00cce
...@@ -123,8 +123,21 @@ convertPackages files = ...@@ -123,8 +123,21 @@ convertPackages files =
-- injected package items -- injected package items
collectIdentConflicts :: Idents -> AST -> Writer Idents () collectIdentConflicts :: Idents -> AST -> Writer Idents ()
collectIdentConflicts prefixes = collectIdentConflicts prefixes =
mapM_ $ collectModuleItemsM $ collectify traverseIdentsM $ mapM_ $ collectModuleItemsM collectModuleItem
collectIdent prefixes 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 -- write down identifiers that have a package name as a prefix
collectIdent :: Idents -> Identifier -> Writer Idents () collectIdent :: Idents -> Identifier -> Writer Idents ()
......
package P; package P;
typedef logic T; typedef logic T;
typedef logic [1:0] U;
endpackage endpackage
module top; module top;
P::T P_T; P::T P_T;
assign P_T = 0; assign P_T = 0;
initial $display("%b", P_T); initial $display("%b", P_T);
P::U P_U = 0;
endmodule endmodule
...@@ -2,4 +2,5 @@ module top; ...@@ -2,4 +2,5 @@ module top;
wire P_T; wire P_T;
assign P_T = 0; assign P_T = 0;
initial $display("%b", P_T); initial $display("%b", P_T);
reg [1:0] P_U = 0;
endmodule endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment