RE: [sv-bc] E-mail Ballot: Respond by Oct 14, 2007 8am PDT

From: Steven Sharp <sharp_at_.....>
Date: Sun Oct 14 2007 - 09:25:54 PDT
>From: "Bresticker, Shalom" <shalom.bresticker@intel.com>

>If in SV, I write
>
>module m;
>initial
>	for (int i=0; i<16;i=i+1) begin:a
>		reg r ;
>	end
>endmodule
>
>Can I hierarchically reference r? If so, what is its hierarchical name?

This is equivalent to

module m;
initial
	begin //implicit unnamed block
		int i;
		for (i=0; i<16;i=i+1) begin:a
			reg r;
		end
	end
endmodule

That puts an unnamed block around scope a, making it inaccessible.  The
purpose of the text about the label applying to the implicit scope is
to give you a way to solve that.  It means that

module m;
initial
	b: for (int i=0; i<16; i=i+1) begin:a
		reg r;
	   end
endmodule

should be treated specially as if it were

module m;
initial
	begin:b //implicit block now named
		int i;
		for (i=0; i<16;i=i+1) begin:a
			reg r;
		end
	end
endmodule

with the label applied to the implicit block that is already being
created for the for-loop, rather than inserting another one around
it.  That then lets you use m.b.a.r to refer to it.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Oct 14 09:26:10 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 14 2007 - 09:26:19 PDT