Re: 2-state 4-state behaviour

From: Kurt Baty (kurt@wsfdb.com)
Date: Mon Apr 05 2004 - 18:47:35 PDT

  • Next message: Dave Rich: "Re: 2-state 4-state behaviour"

    On Mon, 2004-04-05 at 19:52, Clifford E. Cummings wrote:
    > >>For example, suppose I have the following explicit packed union:
    > >>
    > >>typedef struct packed {
    > >> bit [7:0] byteA;
    > >> reg [7:0] byteB;
    > >>} AB_t;
    > >>
    > >>union packed {
    > >> AB_t AB;
    > >> reg [15:0] V;
    > >>} U;
    > >>
    > >>initial begin
    > >> U.AB.byteA = 8'h55;
    > >> U.AB.byteB = 8'hzz;
    > >> V = V << 4;
    This line should be

            U.V = U.V << 4;

    > >> $displayh(V); // expect to see 5zz0
    This line should be

            $displayh(U.V);

    > >> $displayh({U.AB.byteA,U.AB.byteB}); // expect to see 50z0
    > >
    > >Is this supposed to be 55zz?
    >
    > The first display of shifted V makes sense (5zz0)
    > The second display still seems like it should be 55zz. I don't understand
    > where the 50z0 comes from.
    >

    so if you

    $displayh(U.V[15:8]); you get 5z
    $displayh(U.V[7:0]); you get z0

    and if you

    $displayh(U.AB.byteA); you get 50 not 5z because it's bit (2-state)!!!
    $displayh(U.AB.byteB); you get z0

    so 50z0 OK?



    This archive was generated by hypermail 2.1.4 : Mon Apr 05 2004 - 18:26:06 PDT and
    sponsored by Boyd Technology, Inc.