mirror of https://github.com/zachjs/sv2v.git
leave non-data-declarations at the end of modules
This commit is contained in:
parent
c722e931fe
commit
79f9d21fe7
|
|
@ -46,7 +46,7 @@ collectDescriptionM _ = return ()
|
||||||
-- nests packages items missing from modules
|
-- nests packages items missing from modules
|
||||||
convertDescription :: PIs -> Description -> Description
|
convertDescription :: PIs -> Description -> Description
|
||||||
convertDescription pis (orig @ Part{}) =
|
convertDescription pis (orig @ Part{}) =
|
||||||
Part attrs extern kw lifetime name ports (newItems ++ items)
|
Part attrs extern kw lifetime name ports items'
|
||||||
where
|
where
|
||||||
Part attrs extern kw lifetime name ports items = orig
|
Part attrs extern kw lifetime name ports items = orig
|
||||||
existingPIs = execWriter $ collectModuleItemsM collectPIsM orig
|
existingPIs = execWriter $ collectModuleItemsM collectPIsM orig
|
||||||
|
|
@ -63,6 +63,13 @@ convertDescription pis (orig @ Part{}) =
|
||||||
uniq l = l' where (l', _, _) = complex l
|
uniq l = l' where (l', _, _) = complex l
|
||||||
newItems = uniq $ map MIPackageItem $ map snd $
|
newItems = uniq $ map MIPackageItem $ map snd $
|
||||||
filter (\(x, _) -> Set.member x neededPIs) pis
|
filter (\(x, _) -> Set.member x neededPIs) pis
|
||||||
|
-- place data declarations at the beginning to obey declaration
|
||||||
|
-- ordering; everything else can go at the end
|
||||||
|
newItemsBefore = filter isDecl newItems
|
||||||
|
newItemsAfter = filter (not . isDecl) newItems
|
||||||
|
items' = newItemsBefore ++ items ++ newItemsAfter
|
||||||
|
isDecl (MIPackageItem (Decl{})) = True
|
||||||
|
isDecl _ = False
|
||||||
convertDescription _ other = other
|
convertDescription _ other = other
|
||||||
|
|
||||||
-- writes down the names of package items
|
-- writes down the names of package items
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@ module top;
|
||||||
localparam BW = 3;
|
localparam BW = 3;
|
||||||
logic [2:0] test;
|
logic [2:0] test;
|
||||||
assign test = BW'(0);
|
assign test = BW'(0);
|
||||||
initial $display(test);
|
initial #1 $display(test);
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@ module top;
|
||||||
localparam BW = 3;
|
localparam BW = 3;
|
||||||
wire [2:0] test;
|
wire [2:0] test;
|
||||||
assign test = 0;
|
assign test = 0;
|
||||||
initial $display(test);
|
initial #1 $display(test);
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue