[sv-bc] Question regarding 2-state and 4-state members in packed structs


Subject: [sv-bc] Question regarding 2-state and 4-state members in packed structs
From: Rishiyur S. Nikhil (nikhil@bluespec.com)
Date: Tue Feb 10 2004 - 12:23:11 PST


Dear all,

(Apologies for being so pesky today!)

I'm trying to understand the following statement in Section 3.11:

     "If any data type within a packed structure is 4-state, the whole
      structure is treated as 4-state. Any 2-state members are
      converted as if cast."

Here are some specific questions. Suppose we have:

     struct packed {
         int a; // 2-state
         logic b; // 4-state
         logic c; // 4-state
     } x;

Suppose we have:

     x.a = ... some 4-state value ...; // (1)

     ... = ... x.a ...; // (2)

In (1), does the 4-state value get cast to a 2-state value before the
assignment into x.a?

In (2), is it possible to read out a 4-state value from x.a?

Or, suppose we have:

     x = { a:0, b:1'bx, c:1'bz};

and then we do a shift operation to shift the 4-state values into the
2-state member:

     x = x << 2;

Do 4-state values get shifted into the 2-state member?
Or do they get cast to a 2-state value before shifting in?
What do we get when we now read x.a?

Thanks for any clarifications you can provide,
(i.e., what's the right way to think about mixed 2-state/4-state packed structs,
  from whence the answers to all these questions become obvious?)

Nikhil



This archive was generated by hypermail 2b28 : Tue Feb 10 2004 - 12:30:15 PST