As discussed before, bigger and complex designs are built by integrating multiple modules in a hierarchical way. Modules are instantiated within other modules and ports can connected to each other for communication between them.

Connection by ordered list

One method of making the connection between the port expressions listed in a module instantiation is by the ordered list. mydesign is a module instantiated of name d0 within another module tb_top where ports are connected by an ordered list. Inputs x, y and z are connected to a[0], b, and a[1] respectively. Output port o is connected to the wire c in tb_top.

  module mydesign ( input  x, y, z,
                    output o);
  module tb_top;
    wire [1:0]  a;
    wire        b, c;
    mydesign d0  (a[0], b, a[1], c);

Note that the order of ports in the design module should be remembered to make the connection. This is very inconvenient as the order might change if a new port is added to the list or when the number of ports in the design is very large.

Login to your free account to read more ...

Was this article helpful ?