local module scopes and name spaces



Hello,

I'm playing around with writing a verilog compiler(translator) and I
have a few questions about local module scopes and name spaces.

For the following trivial module_declarations:

module m0(out0, in0, in1);
output out0;
input in0, in1;
wire out0, in0, in1;
endmodule

module m1(.po0(out0), .pi0(in0), .pi1(in1));
output out0;
input in0, in1;
wire out0, in0, in1;
endmodule

1) Am I correct in thinking that when I encounter a module_declaration,
that I have a new scope and that this scope has 2 name spaces - the
module name space and the port name space?

2) For module m0 above, all of out0, in0, and in1 are entered into the
module's port name space because of the port (input/output)
declarations and also all of out0, in0, and in1 are entered into the
module's module name space because of the net declarations?

3) For module m1 above, the same goes as in 2)? What about the
externally-visible port names po0, pi0, and pi1? They are just part of
the module's module name space?

I am trying to put this together from the 1364-1995 spec:

<excerpt from 1364-1995, 3.11 Name spaces>
The module name space is introduced by the module, macromodule, and
primitive constructs. It unifies the definition of functions, tasks,
named blocks, instance names, net type of declaration, and register
type of declaration....

The port name space is introduced by the module, macromodule,
primitive, function, and task constructs. It provides a means of
structurally defining connections between two objects that are in two
different name spaces. The connection can be unidirectional (either
input or output) or bidirectional (inout). The port name space
overlaps the module and the block name spaces. Essentially, the port
name space specifies the type of connection between names in different
name spaces. The port type of declarations include input, output, and
inout (see 12.3). A port name introduced in the port name space may be
reintroduced in the module name space by declaring a register or a wire
with the same name as the port name.

<excerpt from 1364-1995, 12.5 Scope rules>
The following four elements deÞne a new scope in Verilog:
-Modules
-Tasks
-Functions
-Named blocks
An identifier shall be used to declare only one item within a scope.
This rule means it is illegal to declare two or more variables that
have the same name, or to name a task the same as a variable within the
same module, or to give a gate instance the same name as the name of
the net connected to its output.

Thanks in advance,
Mike

.



Relevant Pages

  • Re: biztalk lag time
    ... the send port to determine if a message was transmitted successfully. ... Put the send shape inside a scope ... Set the send port "delivery notification" property to "transmitted" ... If transmission fails, whatever you put in the exception handler will run. ...
    (microsoft.public.biztalk.general)
  • `default_nettype none scope
    ... I'm trying to debug a project I inherited that is littered with port ... many created by implicit wire ... port declarations. ... scope covers other modules as well. ...
    (comp.lang.verilog)
  • Re: Serial port
    ... >>the serial port. ... Why I cannot see on my scope the data signal if I put ... > Connect your scope ground to SIGNAL GROUND in the serial port ... select the setup options, and 'advanced', and set 'flow control', to ...
    (sci.electronics.design)
  • Connecting SCT to desktop
    ... It houses a Schmidt-Cassegrain telescope with a wedge and permanent mount. ... the scope connected to a laptop using the serial port to run the scope and the parallel port for the web cam. ...
    (sci.astro.amateur)
  • Re: usb problems
    ... And Gene did reply: ... specified USB port, a port I know there is something on the other ... I have a new digital 100mhz dual trace scope, so I guess I'll have to ... US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS ...
    (Ubuntu)