RE: [sv-bc] enumerated variable used with an equality operator

From: Brad Pierce <Brad.Pierce@synopsys.com>
Date: Wed Mar 26 2014 - 10:42:58 PDT
In http://www.eda.org/sv-bc/hm/11561.html, Daniel writes



     >static cast that is curently supported is not enough?

     >int'(enum_var) == number



If it's done carefully. A size cast would be safer



module test;

enum integer {XX = 'x, S0 = 'b00, S1='b01, S2='b10} state, next;

always_comb begin

    state = XX;

    next = S0;

    assert( int'(state) === int'(next));

    assert( 32'(state) !== 32'(next));

end

endmodule



-- Brad



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Mar 26 10:43:54 2014

This archive was generated by hypermail 2.1.8 : Wed Mar 26 2014 - 10:43:59 PDT