Hi, I have following queries about randsequence. Consider the example below: 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 LRM says: In the example above, the operator and value productions return a string and an 8-bit value, respectively. The production bin_op includes these two value-returning productions. Therefore, the code block associated with production bin_op has access to the following implicit variable declarations: bit [7:0] value [1:2]; string operator; Thus the usage of value and operator(as shown below) are correct. void bin_op : value operator value { $display( "%s %b %b", operator, value[1], value[2] ); } ; My queries are: ------------ 1) if I use 'operator' as shown below: void bin_op : value operator value {{ $display( " %b" ,operator[1]} then its erroroneous or not.I think it should be erroneous because the implicit variable declared for 'operator ' is " string operator ". 2) if I use 'value' as shown below: void bin_op : value{$display("%s", value[1]) ;} operator value {// here only value[1] and value[2] should be mentioned explicitly}; then its erroneous or not . I think it should be erroneous again for the same reason. 3) if I use 'value' as shown below: void bin_op : value{$display("%s", value) ;} operator value {// here only value[1] and value[2] should be mentioned explicitly}; then its erroneous or not . I think it should be correct. Please let me know whether my assumptions are correct or not. Thanks and Regards , Shabnam. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Aug 2 22:29:55 2007
This archive was generated by hypermail 2.1.8 : Thu Aug 02 2007 - 22:30:15 PDT