[sv-ec] Invalid randsequence example (18.17.7)

From: Ryan, Ray <Ray_Ryan@mentor.com>
Date: Thu Nov 10 2011 - 07:17:22 PST

In section 18.17.7, Example 1 consists of the following code:
    randsequence( bin_op )
       void bin_op : value operator value // void type is optional
                         { $display("%s %b %b", operator, value[1], value[2]); }
                         ;
      bit [7:0] value : { return $urandom; } ;
       string operator : add := 5 { return "+" ; }
                         | dec := 2 { return "-" ; }
                         | mult := 1 { return "*" ; }
                         ;
    endsequence

This is not a valid randsequence in that productions for 'add', 'dec' and 'mult' are missing. The example could be cleaned up as follows:
    randsequence( bin_op )
       void bin_op : value operator value // void type is optional
                         { $display("%s %b %b", operator, value[1], value[2]); }
                         ;
      bit [7:0] value : { return $urandom; } ;
       string operator : { return "+" ; }
                         | { return "-" ; }
                         | { return "*" ; }
                         ;
    endsequence

I have entered mantis 3919 with a proposal for this.

Regards
Ray Ryan

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Nov 10 07:17:41 2011

This archive was generated by hypermail 2.1.8 : Thu Nov 10 2011 - 07:17:53 PST