24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UM-206 7 - Mixed-language simulation<br />

Modules with unnamed ports<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

Verilog allows modules to have unnamed ports, whereas VHDL requires that all ports have<br />

names. If any of the Verilog ports are unnamed, then all are considered to be unnamed, <strong>and</strong><br />

it is not possible to create a matching VHDL component. In such cases, the module may<br />

not be instantiated from VHDL.<br />

Unnamed ports occur when the module port list contains bit-selects, part-selects, or<br />

concatenations, as in the following example:<br />

module m(a[3:0], b[1], b[0], {c,d});<br />

input [3:0] a;<br />

input [1:0] b;<br />

input c, d;<br />

endmodule<br />

Note that a[3:0] is considered to be unnamed even though it is a full part-select. A common<br />

mistake is to include the vector bounds in the port list, which has the undesired side effect<br />

of making the ports unnamed (which prevents the user from connecting by name even in<br />

an all-Verilog design).<br />

Most modules having unnamed ports can be easily rewritten to explicitly name the ports,<br />

thus allowing the module to be instantiated from VHDL. Consider the following example:<br />

module m(y[1], y[0], a[1], a[0]);<br />

output [1:0] y;<br />

input [1:0] a;<br />

endmodule<br />

Here is the same module rewritten with explicit port names added:<br />

module m(.y1(y[1]), .y0(y[0]), .a1(a[1]), .a0(a[0]));<br />

output [1:0] y;<br />

input [1:0] a;<br />

endmodule<br />

"Empty" ports<br />

Verilog modules may have "empty" ports, which are also unnamed, but they are treated<br />

differently from other unnamed ports. If the only unnamed ports are "empty", then the other<br />

ports may still be connected to by name, as in the following example:<br />

module m(a, , b);<br />

input a, b;<br />

endmodule<br />

Although this module has an empty port between ports "a" <strong>and</strong> "b", the named ports in the<br />

module can still be connected to from VHDL.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!