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

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Thu Apr 23 2009 - 08:52:23 PDT
I know how implicit event works. The problem which I'm asking about is
different. How should event control on dynamic references work. 
When control flow goes by @(hnd.item) then what is really tested expression
hnd.item or item from object pointed by hnd. If later hnd changes what
"@(hnd.item)" executed before is waiting for? 
I suspect that @(hnd.item) waits on expression so when hnd changes we are
wating for whole expression hnd.item change.
2nd option would be that we are waiting on changes of object pointed by hnd
at the moment when @(hnd.item) was executed - so all later changes of hnd
are ignored.
This is what I think is not strictly defined.
 
 
 
Anyway the main problem is that I think the example in 9.4.2 Event control
is wrong. Comments says:  "// @(p.status) now waits for status in Packet 2
to change, // if not already different from Packet 1"  but p is not changed
in the example at all. If it would be assigned with handle pointing on
object "Packet 1" then example would be ok. My proposal is to change :

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

 
DANiel

  _____  

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: 23 kwietnia 2009 17:16
To: Daniel Mlynek; sv-ec@eda.org
Cc: Neil.Korpusik@Sun.COM; Brad.Pierce@synopsys.com;
matthew.r.maidment@intel.com
Subject: 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, and is
believed to be clean.
Received on Thu Apr 23 08:58:10 2009

This archive was generated by hypermail 2.1.8 : Thu Apr 23 2009 - 08:58:53 PDT