cast_nettype.sv 502 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
`define TEST_CAST(expr, prefix, typ) \
    initial begin \
        localparam type T = type(prefix``typ); \
        logic [63:0] x; \
        T y; \
        x = T'(expr); \
        y = expr; \
        r``typ = expr; \
        tmp = r``typ; \
        $display(`"%b => prefix``typ %b %b %b`", expr, T'(expr), x, y); \
    end

module top;
    wire foo;
    type(foo) bar;
    initial bar = 1;

    `include "cast_nettype.vh"

    `TEST('1)
    `TEST('x)
    `TEST(1)
    `TEST(2)
    `TEST(-1)
endmodule