Subject: Re: [sv-bc] Re: implicit instantiation of top-level modules?
From: Michael McNamara (mac@verisity.com)
Date: Thu Jul 10 2003 - 17:44:52 PDT
Steven Sharp writes:
 > 
 > >X-Authentication-Warning: max.boyd.com: majordomo set sender to 
 > owner-etf@boyd.com using -f
 > >From: Michael McNamara <mac@verisity.com>
 > 
 > > Actually, what this allows is an additional fairly powerfull
 > > capability: Easy reference to a sibling.
 > 
 > > 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
 > 
 > This does not work.  Module names will only match ancestors.  To match
 > a sibling requires using an instance name.  Note that with an ancestor,
 > there is a unique match for the module name.  There could be multiple
 > siblings that were instances of the same module.
 > 
 > What this allows is a reference to something in a parent or other
 > ancestor without needing to know the instance name that that parent
 > got instantiated with.
 > 
Memo to self: quit posting code snippets from places where you don't
have the ability to present the code first to a tool to check syntax
before annoying one's colleagues with the code.
Of course what I meant to code was:
module jtag_ff(D, CLK, JTAG_D, JTAG_C, Q, Q_);
   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(JTAG_D, JTAG_C);
   input JTAG_D, JTAG_C;
   always @(JTAG_C) jtag_ff.flip_flop.Q = JTAG_D;
endmodule // add_jtag
module ff (D, CLK, Q, Q_);
   input D, CLK;
   output Q, Q_;
   reg 	  Q;
   always @(CLK) Q = D;
   assign Q_ = ~Q;
endmodule // ff
where indeed, this feature allows one to refer to a sibling, by using
one's parent's MODULE NAME followed by the sibling's INSTANCE NAME
rather than needing to know one's parents INSTANCE NAME.
Without this feature such creation of a jtag_ff would be
uninstantiable (more than once).
-mac
This archive was generated by hypermail 2b28 : Thu Jul 10 2003 - 17:53:56 PDT