[sv-bc] Query on struct assignment

From: Surya Pratik Saha <spsaha_at_.....>
Date: Wed Feb 04 2009 - 21:58:12 PST
Hi,
As per LRM, for a struct assignment by assignment pattern, all members 
of the struct variable have to be covered/assigned. LRM is silent from 
where the error would come, whether from compilation time or run time if 
some members are left. I have checked one standard simulator which 
checks at run-time. For e.g:
case 1:
module top;
    typedef struct {
        bit b;
        int x;
    } st;
    st s;
    initial begin
        s = '{logic: 1, int:2};
    end
endmodule

The error is coming in this case, but if an 'if (0)' is placed before 
the struct assignment then no error comes. Also if const declaration 
present like:
module top;
    typedef struct {
        bit b;
        int x;
    } st;
    const st s = '{logic: 1, int:2};
endmodule

Then before simulation started, the error comes looking like it is 
happening at compilation time. Though I can understand actually it 
happens after elaboration and before simulation when the data propagated 
to const variable.
So what should be ideal place to catch this type of error?

-- 
Regards
Surya




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Feb 4 21:59:10 2009

This archive was generated by hypermail 2.1.8 : Wed Feb 04 2009 - 21:59:53 PST