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

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Sun Apr 19 2009 - 23:17:32 PDT
 
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

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

    - whole expression p.status is remains the same

    - whole expression p.status changed

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

 

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 Mon Apr 20 03:25:20 2009

This archive was generated by hypermail 2.1.8 : Mon Apr 20 2009 - 03:26:33 PDT