Commit 0aa59165 by Zachary Snow

fix size of empty strings to be one byte

parent a293002a
...@@ -225,7 +225,7 @@ typeof (String str) = ...@@ -225,7 +225,7 @@ typeof (String str) =
return $ IntegerVector TBit Unspecified [r] return $ IntegerVector TBit Unspecified [r]
where where
r = (RawNum $ len - 1, RawNum 0) r = (RawNum $ len - 1, RawNum 0)
len = if null str then 1 else 8 * unescapedLength str len = if null str then 8 else 8 * unescapedLength str
typeof other = lookupTypeOf other typeof other = lookupTypeOf other
-- length of a string literal in characters -- length of a string literal in characters
......
...@@ -34,6 +34,10 @@ module top; ...@@ -34,6 +34,10 @@ module top;
$display($size(Ram[0])); $display($size(Ram[0]));
$display($bits(foo)); $display($bits(foo));
$display("bits %0d", $bits("AB"));
$display("bits %0d", $bits("A"));
$display("bits %0d", $bits(""));
$display("args %b", $size(RamPair, 1)); $display("args %b", $size(RamPair, 1));
$display("args %b", $size(RamPair, 1'b1)); $display("args %b", $size(RamPair, 1'b1));
$display("args %b", $size(RamPair, '1)); $display("args %b", $size(RamPair, '1));
......
...@@ -31,6 +31,10 @@ module top; ...@@ -31,6 +31,10 @@ module top;
$display(16); $display(16);
$display(3); $display(3);
$display("bits %0d", $bits("AB"));
$display("bits %0d", $bits("A"));
$display("bits %0d", $bits(""));
$display("args %b", 2); $display("args %b", 2);
$display("args %b", 2); $display("args %b", 2);
$display("args %b", 2); $display("args %b", 2);
......
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