diff --git a/src/Convert/TypeOf.hs b/src/Convert/TypeOf.hs index c423b66..16b021d 100644 --- a/src/Convert/TypeOf.hs +++ b/src/Convert/TypeOf.hs @@ -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 diff --git a/test/basic/typeof_alias.sv b/test/basic/typeof_alias.sv new file mode 100644 index 0000000..03f14f6 --- /dev/null +++ b/test/basic/typeof_alias.sv @@ -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 diff --git a/test/basic/typeof_alias.v b/test/basic/typeof_alias.v new file mode 100644 index 0000000..a7454c1 --- /dev/null +++ b/test/basic/typeof_alias.v @@ -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