mirror of https://github.com/zachjs/sv2v.git
fix type lookup of yet-unresolved types (resolves #111)
This commit is contained in:
parent
7eed2fc58e
commit
e88a6b9d84
|
|
@ -90,12 +90,14 @@ typeof (Call (Ident x) _) =
|
|||
typeof (orig @ (Bit e _)) = do
|
||||
t <- typeof e
|
||||
case t of
|
||||
TypeOf _ -> lookupTypeOf orig
|
||||
TypeOf{} -> lookupTypeOf orig
|
||||
Alias{} -> return $ TypeOf orig
|
||||
_ -> return $ popRange t
|
||||
typeof (orig @ (Range e mode r)) = do
|
||||
t <- typeof e
|
||||
return $ case t of
|
||||
TypeOf _ -> TypeOf orig
|
||||
TypeOf{} -> TypeOf orig
|
||||
Alias{} -> TypeOf orig
|
||||
_ -> replaceRange (lo, hi) t
|
||||
where
|
||||
lo = fst r
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package P;
|
||||
typedef logic [1:0][2:0] T;
|
||||
endpackage
|
||||
|
||||
module top;
|
||||
P::T w;
|
||||
type(w[0]) x;
|
||||
type(x[0]) y;
|
||||
type(w[0][0]) z;
|
||||
|
||||
type(w[1:0]) a;
|
||||
type(w[0][1:0]) b;
|
||||
|
||||
initial begin
|
||||
$display("%b %b %b %b", w, x, y, z);
|
||||
$display("%b %b", a, b);
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
module top;
|
||||
wire [5:0] w;
|
||||
wire [2:0] x;
|
||||
wire y;
|
||||
wire z;
|
||||
|
||||
wire [5:0] a;
|
||||
wire [1:0] b;
|
||||
|
||||
initial begin
|
||||
$display("%b %b %b %b", w, x, y, z);
|
||||
$display("%b %b", a, b);
|
||||
end
|
||||
endmodule
|
||||
Loading…
Reference in New Issue