HDLBits – Module pos

This problem is similar to the previous one (module). You are given a module named mod_a that has 2 outputs and 4 inputs, in that order. You must connect the 6 ports by position to your top-level module’s ports out1out2abc, and d, in that order.

You are given the following module: See the HDLBits page for a diagram.


There’s not much to say here, since once you’ve instantiated one module, you’ve instantiated one million. The catch here is that we’re required to connect ports by position, which should not be done over connecting ports by name. We’ll break that rule here, but I do so under protest. Make sure to check out the module solution if you need more context:

module top_module (
  input  logic a, b, c, d,
  output logic out1, out2 );
  // Port connections by position just feels wrong
  mod_a mod_a_i (out1, out2, a, b, c, d);
endmodule : top_module

Leave a Reply

Your email address will not be published. Required fields are marked *