[sv-bc] Enum assignment via packed struct

From: Surya Pratik Saha <surya.pratik.saha@xilinx.com>
Date: Wed Jun 20 2012 - 05:50:11 PDT

Hi,

As per LRM, an enum variable can only be assigned to another enum
variable of same type or enum member. But if it is part of a packed
struct, then the restriction can be overridden. Please see the following
e.g.:

 

module top;

    typedef enum bit [1:0] {X, Y, Z} et;

    typedef struct packed {

        et e;

    } st;

    et e;

    st s;

    initial begin

        s = 4; // Passing

        e = 4; // Failing

    end

endmodule

 

Does LRM say anything about that? Should it not be disallowed by some
way?

 

Regards

Surya

 

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Received on Wed Jun 20 05:50:23 2012

This archive was generated by hypermail 2.1.8 : Wed Jun 20 2012 - 05:50:40 PDT