typeof $clog2

This commit is contained in:
Zachary Snow 2020-08-13 19:37:12 -04:00
parent d9e890c88e
commit d4511871ca
3 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,8 @@ typeof (Call (Ident "$unsigned") (Args [e] [])) =
typeof e
typeof (Call (Ident "$signed") (Args [e] [])) =
typeof e
typeof (Call (Ident "$clog2") (Args [_] [])) =
return $ IntegerAtom TInteger Unspecified
typeof (Call (Ident x) _) =
typeof $ Ident x
typeof (orig @ (Bit e _)) = do

View File

@ -31,6 +31,7 @@ module top;
type({x, y}) b = {x, y};
type(FLAG ? x : y) c = FLAG ? x : y;
type(!FLAG ? x : y) d = !FLAG ? x : y;
type($clog2(x)) e = $clog2(x);
$display("%b %d %d", x, $left(x), $right(x));
$display("%b %d %d", y, $left(y), $right(y));
$display("%b %d %d", z, $left(z), $right(z));
@ -38,6 +39,7 @@ module top;
$display("%b %d %d", b, $left(b), $right(b));
$display("%b %d %d", c, $left(c), $right(c));
$display("%b %d %d", d, $left(d), $right(d));
$display("%b %d %d", e, $left(e), $right(e));
end
parameter W = 4;

View File

@ -33,6 +33,7 @@ module top;
reg [31:0] a;
reg [7:0] b;
reg [3:0] c, d;
integer e;
x = 4'b1011;
y = x ^ 3'b111;
z = x ^ 5'b11111;
@ -40,6 +41,7 @@ module top;
b = {x, y};
c = FLAG ? x : y;
d = !FLAG ? x : y;
e = $clog2(x);
$display("%b %d %d", x, 4, 1);
$display("%b %d %d", y, 3, 0);
$display("%b %d %d", z, 4, 0);
@ -47,6 +49,7 @@ module top;
$display("%b %d %d", b, 7, 0);
$display("%b %d %d", c, 3, 0);
$display("%b %d %d", d, 3, 0);
$display("%b %d %d", e, 31, 0);
end
parameter W = 4;