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

From: Rich, Dave <Dave_Rich_at_.....>
Date: Thu Apr 23 2009 - 08:16:09 PDT
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:19:45 2009

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