errata/566: 9.5: case item expression ambiguity

From: Brad Pierce (Brad.Pierce@synopsys.com)
Date: Fri Mar 19 2004 - 17:00:00 PST

  • Next message: Karen Pieper: "Fwd: Generate proposal again"

    >Number: 566
    >Category: errata
    >Originator: "Brad Pierce" <Brad.Pierce@synopsys.com>
    >Description:

    Subclause 9.5 may not be not clear enough about what
    a 'case item expression' is. Apparently, the case item
    expression can include several expressions, and, if any of
    them match, then the case item expression matches. "The case
    item expressions shall be evaluated and compared in the exact
    order in which they are given. During the linear search,
    if one of the case item expressions matches the case expression
    given in parentheses, then the statement associated with that
    case item shall be executed and the linear search shall terminate."
    If the comma separated list were composed of individual case item
    expressions, then the above would mean that the following *must*
    display 1 and could not legally display 2.

    module m ( o1, o2 ) ;
    output [1:0] o1, o2 ;
    reg [1:0] o1, o2 ;

    function f ;
    input i ;
    begin
      o1 = o1 + 1 ;
      f = i ;
    end
    endfunction

    always begin
       o1 = 0 ;
       o2 = 0 ;
       case ( 1'b1 )
         f(1'b1) , f(1'b0) : o2 = o2 + 1 ;
         default ;
       endcase
       $display("couldn't this be 2? -- is %d", o1 );
    end

    endmodule



    This archive was generated by hypermail 2.1.4 : Fri Mar 19 2004 - 17:00:11 PST and
    sponsored by Boyd Technology, Inc.