Commit 03b6ece9 by Zachary Snow

address type lookup of $unsigned and $signed

parent e5e99b29
......@@ -81,6 +81,10 @@ typeof (Number n) =
r = (RawNum $ size - 1, RawNum 0)
size = numberBitLength n
sg = if numberIsSigned n then Signed else Unspecified
typeof (Call (Ident "$unsigned") (Args [e] [])) =
typeof e
typeof (Call (Ident "$signed") (Args [e] [])) =
typeof e
typeof (Call (Ident x) _) =
typeof $ Ident x
typeof (orig @ (Bit e _)) = do
......
......@@ -112,6 +112,20 @@ module top;
arr = '{default: 'x}; $display("%b", arr);
arr = '{default: 'z}; $display("%b", arr);
end
reg pick;
logic [8:0] w0, w1, w2, w3;
assign w0 = pick ? '1 : $unsigned(4'd0);
assign w1 = pick ? '1 : unsigned'(5'd0);
assign w2 = pick ? '1 : $signed(6'd0);
assign w3 = pick ? '1 : signed'(7'd0);
initial begin
$monitor("%0d %b %b %b %b %b", $time, pick, w0, w1, w2, w3);
#1 pick = 0;
#1 pick = 1;
#1 pick = 0;
#1 pick = 1;
end
endmodule
module M(a, b, c, d);
......
......@@ -107,6 +107,20 @@ module top;
arr = 1'sbx; $display("%b", arr);
arr = 1'sbz; $display("%b", arr);
end
reg pick;
wire [8:0] w0, w1, w2, w3;
assign w0 = pick ? 9'h1FF : 9'h000;
assign w1 = pick ? 9'h1FF : 9'h000;
assign w2 = pick ? 9'h1FF : 9'h000;
assign w3 = pick ? 9'h1FF : 9'h000;
initial begin
$monitor("%0d %b %b %b %b %b", $time, pick, w0, w1, w2, w3);
#1 pick = 0;
#1 pick = 1;
#1 pick = 0;
#1 pick = 1;
end
endmodule
module M(a, b, c, d);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment