Re: [sv-bc] Queries related to pattern matching in case statement.

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Thu May 11 2006 - 09:45:05 PDT
Surya,

I agree that the BNF and examples are inconsistent and would suppose
that the BNF is wrong.

A somewhat related Mantis item is

  http://eda.org/svdb/bug_view_page.php?bug_id=951

See also --

  http://eda.org/svdb/bug_view_page.php?bug_id=1316
  http://eda.org/svdb/bug_view_page.php?bug_id=927
  http://eda.org/svdb/bug_view_page.php?bug_id=941
  http://eda.org/svdb/bug_view_page.php?bug_id=1332
  http://eda.org/svdb/bug_view_page.php?bug_id=1319
  http://eda.org/svdb/bug_view_page.php?bug_id=1445

-- Brad

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Surya Pratik Saha
Sent: Wednesday, May 10, 2006 10:20 PM
To: sv-bc@eda.org
Subject: [sv-bc] Queries related to pattern matching in case statement.


Hi,
I have some quaries related to pattern matching in case statement.

For pattern matchin case statement the rule is-
 case_statement ::= [ unique_priority ] case_keyword ( expression )
matches case_pattern_item { case_pattern_item } endcase

 case_keyword ::= case | casez | casex

 case_pattern_item ::= pattern [ &&& expression ] : statement_or_null
                       | default [ : ] statement_or_null

pattern ::=  . variable_identifier
           | .*
           | constant_expression
           | tagged member_identifier [ pattern ]
           | '{ pattern { , pattern } }
           | '{ member_identifier : pattern { , member_identifier :
pattern } }

and there is an example in SV LRM(IEE std 1800-2005 Standered for system
verilog) on page no -134
...
case (instr) matches
tagged Add '{reg2:.r2,regd:.rd,reg1:.r1} &&& (rd != 0): rf[rd] = rf[r1]
+ rf[r2];
tagged Jmp (tagged JmpU .a) : pc = pc + a;
tagged Jmp (tagged JmpC '{addr:.a,cc:.c}) : if (rf[c]) pc = a;
endcase
...

So my questions are -
 a) in the ablove rules there is no '(' or ')' used with the pattern.So
is this example is valid one?
b) If it is valid one then whether that '(' and ')' will be used  from
the 2nd recursivly used pattern?
c) is this exmaple is valid or not-
case (instr) matches
tagged Add '{reg2:.r2,regd:.rd,reg1:.r1} &&& (rd != 0): rf[rd] = rf[r1]
+ rf[r2];
(tagged Jmp (tagged JmpU .a) ): pc = pc + a;
(tagged Jmp  tagged JmpC '{addr:.a,cc:.c}) : if (rf[c]) pc = a;
endcase
Thanks and regards.
Surya
Received on Thu May 11 09:45:07 2006

This archive was generated by hypermail 2.1.8 : Thu May 11 2006 - 09:45:15 PDT