mirror of https://github.com/zachjs/sv2v.git
fix typeof incorrectly propagating implicit types
This commit is contained in:
parent
8eb3a251f7
commit
58e5bfa6d3
|
|
@ -41,9 +41,10 @@ traverseDeclM decl = do
|
||||||
item <- traverseModuleItemM (MIPackageItem $ Decl decl)
|
item <- traverseModuleItemM (MIPackageItem $ Decl decl)
|
||||||
let MIPackageItem (Decl decl') = item
|
let MIPackageItem (Decl decl') = item
|
||||||
case decl' of
|
case decl' of
|
||||||
Variable Local UnknownType ident [] Nil -> do
|
Variable Local (Implicit sg rs) ident [] Nil -> do
|
||||||
-- functions with no return type implicitly return a single bit
|
-- implicit types, which are commonly found in function return
|
||||||
insertElem ident UnitType
|
-- types, are recast as logics to avoid outputting bare ranges
|
||||||
|
insertElem ident $ IntegerVector TLogic sg rs
|
||||||
return decl'
|
return decl'
|
||||||
Variable d t ident a e -> do
|
Variable d t ident a e -> do
|
||||||
let t' = injectRanges t a
|
let t' = injectRanges t a
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
module top;
|
||||||
|
typedef logic [1:0] T;
|
||||||
|
function automatic [1:0] flip;
|
||||||
|
input [1:0] inp;
|
||||||
|
flip = ~inp;
|
||||||
|
endfunction
|
||||||
|
initial begin
|
||||||
|
case (flip(2'b00)) inside
|
||||||
|
2'b11: $display("good");
|
||||||
|
default: $display("default");
|
||||||
|
endcase
|
||||||
|
case (T'(flip(2'b00))) inside
|
||||||
|
2'b11: $display("good");
|
||||||
|
default: $display("default");
|
||||||
|
endcase
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
module top;
|
||||||
|
initial begin
|
||||||
|
$display("good");
|
||||||
|
$display("good");
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue