Re: [sv-bc] Re: implicit instantiation of top-level modules?


Subject: Re: [sv-bc] Re: implicit instantiation of top-level modules?
From: Greg Jaxon (Greg.Jaxon@synopsys.com)
Date: Thu Jul 10 2003 - 10:42:43 PDT


Michael McNamara wrote:

> [T]his allows is an additional fairly powerfull
> capability: Easy reference to a sibling.
>
> Let us say you have a module, implementing a Flip Flop:
>
> module ff (input D, CLK, output reg Q, Q_)
> always @(CLK) Q = D;
> assign Q_ = ~Q;
> endmodule
>
> Then say you want to reuse this module to define the JTAG
> version. Using upward relative references you could:
>
> module jtag_ff(input D, CLK, JTAG_D, JTAG_C, output Q, Q_)
> ff flip_flop (D, CLK, Q, Q_);
> add_jtag jt (JTAG_D, JTAG_C);
> endmodule
>
> module add_jtag(input JTAG_D, JTAG_C);
> always @(JTAG_C) ff.Q = JTAG_D;
> endmodule
>
> The difference here is that the add_jtag doesn't need to know the
> instance name of the ff it is mucking with: the rules of 12.4 require
> the simulator to find the nearest neighbor up the hierarchy that
> instanticate an 'ff' module. It does not affect every 'ff' module,
> just the first one found using the upwards relative refernecing rules
> defined in 12.4.1
>
> -mac

I could not find the 12.4 "nearest neighbor" prescription - which document
are you citing? In 1364-2001 section 12.5 says:

"It shall only search in higher enclosing modules for the name, not instances."

I understand the use of upward references to module_names to be analogous to
C++ class references: i.e. something you'd use only to reach static data, typedefs,
local functions, or other entities shared by all instances of the module.

Greg



This archive was generated by hypermail 2b28 : Thu Jul 10 2003 - 10:44:12 PDT