[sv-ec] RE: [sv-bc] FW: 9.4.2 Event control - example

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Thu Apr 23 2009 - 09:26:38 PDT
Daniel,

One way I like to think about these types of events is by generalizing from (traditional verilog) events on array expressions. Hence: "@(array[index])" and "@(obj.member)" have similar semantics the difference is that in the array expression the index or the value (at the resulting array location) can change whereas in the object expression, the object handle or the member value (of the resulting object) can change. Typically, these expressions will be compiled or interpreted into something similar to the following pseudo code  (while of course other implementations are possible):

array[index] ==> value = *( address(array) + index * element_size )
obj.member ==> value = *( address(obj) + offset(member) )

Where value is the expression evaluation. From the above linearized low-level implementation, you can see the similarity between the two. At this level the most salient difference is what is constant: in the array expression the array address and the element_size are constants, whereas in the object expression the offset of the member is constant. Any non-constant sub-expression change requires the expression to be re-evaluated and can thus trigger an implicit event.

            Arturo

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich, Dave
Sent: Thursday, April 23, 2009 8:16 AM
To: Daniel Mlynek; sv-ec@eda.org
Cc: Neil.Korpusik@Sun.com; Brad.Pierce@synopsys.COM; matthew.r.maidment@intel.com
Subject: [sv-ec] RE: [sv-bc] FW: 9.4.2 Event control - example

Daniel,

Section 9.4.2 says "An implicit event shall be detected on any change in the value of the expression."

That simple rule applies to my answers below

________________________________
From: Daniel Mlynek [mailto:daniel.mlynek@aldec.com]
Sent: Wednesday, April 22, 2009 11:31 PM
To: sv-ec@eda.org
Cc: Neil.Korpusik@Sun.COM; Brad.Pierce@synopsys.com; Rich, Dave; matthew.r.maidment@intel.com
Subject: [sv-bc] FW: 9.4.2 Event control - example

IMHO the example from : 9.4.2 Event control
Is wrong.:

Packet p = new; // Packet 1
Packet q = new; // Packet 2
initial fork
@(p.status); // Wait for status in Packet 1 to change
@ q; // Wait for a change to handle q there should be : @p;// Wait for a change to handle p
# 10 q = p; // triggers @q. there should be : # 10 p = q; // triggers @p.
// @(p.status) now waits for status in Packet 2 to change,
// if not already different from Packet 1
join



This chapter do not describes how above example should work. IMHO there should be explicitly described :

- what should happened if p remains the same and p.status changes

[DR] The expression has changed, an implicit event is generated

-what should happened if handle p changes after waiting on @p.status, and:

    - whole expression p.status is remains the same

[DR] No implicit event is generated

    - whole expression p.status changed

[DR] an implicit event is generated

- what should happened p becomes null after/before @p.status

[DR] The behavior of null handle dereferences is undefined [8.4]

Below 4 cases which behavior definition I cannot find  in LRM :

CASE1  null pointer access at 11?
class C;
int m;
endclass

module top;
        C c;
initial begin
                #1;c=new;
                @(c.m)$display("1",$time);
                #1;c=null;
                @(c.m)$display("2"); //tutaj powinien byc null pointer access
        end
        initial #10 c.m=1;
endmodule

CASE2 null pointer access at 10?
class C;
int m;
endclass

module top;
        C c;
initial begin
                #1;c=new;
                @(c.m)$display("1",$time);
        end
        initial begin
                 #10 c=null;
                #10 c=new;
                #10 c.m =123;
                #1;
        end
endmodule
CASE3 (repeat should work twice?)
class C;
int m;
endclass

module top;
        C c;
initial begin
                #1;c=new;
                repeat (2) @(c.m)$display("1",$time);
        end
        initial begin
                #10 c.m =123;
                #10 c=new;
                #1;
        end
endmodule

CASE 4  displays in 30 40?
class C;
int m;
endclass

module top;
        C c, c1;
initial begin
                #1;c=new;
                forever @(c.m)$display("1",$time);
        end
        initial begin
                #10 c1=c;c=new;
                #10 c1.m=123;
                #10 c.m=234;
                #10 c=c1;
                #10 c1=new; c1.m=123; c=c1;
                #1;
        end
endmodule

DANiel



--
This message has been scanned for viruses and
dangerous content by MailScanner<http://www.mailscanner.info/>, and is
believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Apr 23 09:28:30 2009

This archive was generated by hypermail 2.1.8 : Thu Apr 23 2009 - 09:29:13 PDT