Prev Problem
Next Problem

11. Vector Concatenation

module concat8_packer (
    input  [3:0] A,
    input  [1:0] B,
    input        C,
    input        D,
    output [7:0] OUT
);
    assign OUT = {
        A[3:0],   // [7:4]
        B[1:0],   // [3:2]
        ~C,       // [1]
        D         // [0]
    };
endmodule

💡Remember

  • Concatenation builds MSB→LSB from left to right.
  • Slices keep their own order ([3:0] means 3 is the MSB of that slice).
  • Unary ~C flips one bit; it’s fine inside the concat { ... }.