HDL-Bits Solution: Vector100r

This problem requires reversing the bit order of a 100-bit input vector.

In this implementation, a for loop is used to map each bit from the input to its reversed position in the output. Specifically, in[i] is assigned to out[99 - i], effectively flipping the bit order from LSB to MSB.

 

Here is my code for solving this quiz.

module top_module( 
    input [99:0] in,
    output [99:0] out
);
    always@(*) 
        begin
            int i,j;
            for(i=0,j=99; i<100; i=i+1)
            begin
                out[j-i] = in[i];
        end
    end
        
 
endmodule

Reference:https://hdlbits.01xz.net/wiki/Vector100r

Leave a Reply

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