Prev Problem
Next Problem

11. Vector Concatenation

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

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 { ... }.

Code

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

 

Was this helpful?
Upvote
Downvote