본문 바로가기

Verilog/HDLbits

[HDLBits] Vector100r

1. 문제 및 설명

  • 100비트 입력 벡터 [99:0]가 주어졌을 때, 그 비트 순서를 역순으로 바꾸시오.

2. 모듈 정의

module top_module( 
    input [99:0] in,
    output [99:0] out
);

 

 

 

3. 답

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

endmodule

'Verilog > HDLbits' 카테고리의 다른 글

[HDLBits] Adder100i  (0) 2025.12.07
[HDLBits] Popcount255  (0) 2025.12.07
[HDLBits] Gates100  (0) 2025.12.07
[HDLBits] Reduction  (0) 2025.12.07
[HDLBits] Conditional  (0) 2025.12.07