'Use only a subset of output port bits?

This is a general Verilog question. Say I have instantiated some module with a 32-bit output port, but I'm only interested in the low 8-bits.

wire [7:0] my_8bits;
some_module inst (
  ...
  .out_32bit_port(my_8bits);   // out_32bit_port is a 32-bit output port
);

This will generate a warning that the signal I have connected to the output port does not match the port size. Of course, in this case I am completely aware of what I've done and I can just ignore the warning.

How can I code this to eliminate all warnings?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source