Commit 2d7dc00b by Zachary Snow

fix concat of based xz literals with uneven chunks

parent 8e1f2bba
......@@ -313,8 +313,9 @@ instance Semigroup Number where
if kinds1 == 0 && kinds2 == 0
then min base1 base2
else Binary
values = values2 + shiftL values1 size2
kinds = kinds2 + shiftL kinds1 size2
trim = flip mod . (2 ^)
values = trim size2 values2 + shiftL (trim size1 values1) size2
kinds = trim size2 kinds2 + shiftL (trim size1 kinds1) size2
size1 = fromIntegral $ numberBitLength n1
size2 = fromIntegral $ numberBitLength n2
Based _ _ base1 values1 kinds1 = n1
......
......@@ -13,5 +13,16 @@ module top;
`TEST('sh3, 'd0);
`TEST('sh4, 'd0);
`TEST('b0101, 'd0);
`TEST(17'hz, 1'b0);
`TEST(17'hzzzzz, 1'b0);
`TEST(17'hzzzzz, 1'bz);
`TEST(17'hzzzzz, 1'h0);
`TEST(17'hzzzzz, 1'h1);
`TEST(17'hzzzzz, 1'hx);
`TEST(17'hzzzzz, 1'hz);
`TEST(2'hx, 1'h0);
`TEST(2'hx, 1'h1);
`TEST(2'hx, 1'hx);
`TEST(2'hx, 1'hz);
end
endmodule
......@@ -13,5 +13,16 @@ module top;
`TEST(32'sh3, 32'd0);
`TEST(32'sh4, 32'd0);
`TEST(32'sb0101, 32'd0);
`TEST(17'hz, 1'b0);
`TEST(17'hzzzzz, 1'b0);
`TEST(17'hzzzzz, 1'bz);
`TEST(17'hzzzzz, 1'h0);
`TEST(17'hzzzzz, 1'h1);
`TEST(17'hzzzzz, 1'hx);
`TEST(17'hzzzzz, 1'hz);
`TEST(2'hx, 1'h0);
`TEST(2'hx, 1'h1);
`TEST(2'hx, 1'hx);
`TEST(2'hx, 1'hz);
end
endmodule
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