$changed can work for 2 dimensional array

Hi

i have to detect changed in 2 dimensional array i am tryin using $changed[7:0][7:0],

but even though values getting changed i am seeing failure in assertion

what could be the best way to detect change in 2 dimensional array ?

In reply to abhiverif1715:

You will have to show us what you tried. Works for me.

In reply to dave_59:
Dave,
It works for me too, but I have a followup question:


$changed ( expression [ , [ clocking_event ] ] )
// Is a 2d array an expression?  
// Which one of these defines a 2d array as an "expression"?
expression ::= // 1800
   primary
 | unary_operator { attribute_instance } primary
 | inc_or_dec_expression
 | ( operator_assignment )
 | expression binary_operator { attribute_instance } expression
 | conditional_expression
 | inside_expression
 | tagged_union_expression

primary ::=
   primary_literal
 | [ class_qualifier | package_scope ] hierarchical_identifier select
 | empty_unpacked_array_concatenation
 | concatenation [ [ range_expression ] ]
 | multiple_concatenation [ [ range_expression ] ]
 | function_subroutine_call
 | let_expression
 | ( mintypmax_expression )
 | cast
 | assignment_pattern_expression
 | streaming_concatenation

| sequence_method_call
| this41
| $42
| null



import uvm_pkg::*; `include "uvm_macros.svh" 
module top; 
  bit clk; 
  bit d2 [7:0][7:0];  
  initial forever #10 clk=!clk;

 ap_changed2: assert property(@ (posedge clk) $changed(d2));  
 
   initial begin : ini1 
     repeat(10) begin :rpt1
       repeat(3) @(posedge clk) #1;  
       if (!randomize (d2) ) `uvm_error("MYERR", "This is a randomize error");
     end : rpt1
     $stop;  
   end  : ini1
endmodule  

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home.html
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448

  1. SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy
  2. Free books: Component Design by Example https://rb.gy/9tcbhl
    Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb
  3. Papers:

In reply to ben@SystemVerilog.us:

Ben,

A hierarchical_identifier could be a variable of any type. The BNF does not deal with type compatibilities, only syntax. You need to look at the text of the LRM to see the semantic rules and restrictions.