case-generate grammar issues.


Subject: case-generate grammar issues.
From: Krishna Garlapati (krishna@synplicity.com)
Date: Wed Aug 22 2001 - 17:06:24 PDT


Folks,

  I came across a weird grammar problem while
  reading stuff about case-generate statement from
  Vlog2001:D6. This is purely a syntax issue and
  nothing to do with semantics.

  The problem is that there is no delimiter, to separate
  case branches. See A.4.2
  Here is an example :

  module top(input a,b,ci, output sum, co);
        parameter TYPE = 100;
        parameter X = 10;
        parameter Y = 100;

        generate
        case (TYPE)
                X : inst1 my_inst(a,b,ci,sum,co);
                Y*10-Y+100 : inst2 my_inst(a,b,ci,sum,co);
                default : inst3 my_inst(a,b,ci,sum,co);
        endcase
        endgenerate

   endmodule

   since case branch here is essentially a generate_item
   it gets real ugly to determine if the parser was reading
   another instantiation or another branch on reading 'Y'
   after it finishes with branch 1.

   This problem is definitely solvable with some extra
   look ahead and other creative means, but it would be much
   better and infinitely more readable if the branches start
   and end with a begin-end pair.

   I propose syntax something like :

   generate
    case(expression)
                   const_expression ":" begin generate_item_or_null end
                   const_expression ":" begin generate_item_or_null end
                   const_expression ":" begin generate_item_or_null end
                   default ":" begin generate_item_or_null end
    endcase
   endgenerate

  Is this reasonable ???
  Thanks for any feedback.

-- 
- Krishna.
(408)215-6152



This archive was generated by hypermail 2b28 : Wed Aug 22 2001 - 17:18:41 PDT