From dde734be26ad895bde71a599c4a98a47114cb39e Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Wed, 21 Jul 2021 11:56:40 -0400 Subject: [PATCH] handle params with unpacked typenames --- src/Convert/Typedef.hs | 5 +++++ test/core/unpacked_localparam.sv | 3 +++ test/core/unpacked_localparam.v | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/Convert/Typedef.hs b/src/Convert/Typedef.hs index b073e09..d64a82a 100644 --- a/src/Convert/Typedef.hs +++ b/src/Convert/Typedef.hs @@ -76,6 +76,11 @@ traverseDeclM decl = do case decl' of Variable{} -> return decl' Net{} -> return decl' + Param s (UnpackedType t rs1) x e -> do + insertElem x UnknownType + let (tf, rs2) = typeRanges t + let t' = tf $ rs1 ++ rs2 + return $ Param s t' x e Param _ _ x _ -> insertElem x UnknownType >> return decl' ParamType Localparam x t -> do diff --git a/test/core/unpacked_localparam.sv b/test/core/unpacked_localparam.sv index 2955ff2..ec22612 100644 --- a/test/core/unpacked_localparam.sv +++ b/test/core/unpacked_localparam.sv @@ -9,4 +9,7 @@ module top; end end end + typedef byte T [3]; + localparam T X = '{ 5, 3, 2 }; + initial $display("%0d %0d %0d", X[0], X[1], X[2]); endmodule diff --git a/test/core/unpacked_localparam.v b/test/core/unpacked_localparam.v index 8030a82..48ededd 100644 --- a/test/core/unpacked_localparam.v +++ b/test/core/unpacked_localparam.v @@ -9,4 +9,6 @@ module top; end end end + localparam [23:0] X = { 8'd5, 8'd3, 8'd2 }; + initial $display("%0d %0d %0d", X[16+:8], X[8+:8], X[0+:8]); endmodule