본문 바로가기

Verilog/HDLbits

[HDLBits] Vector5

1. 문제 및 설명

  • 다섯 개의 1비트 신호(a, b, c, d, e)가 주어졌을 때, 아래 연산을 수행하는 모듈을 만드세요.

 

 

2. 모듈 정의

module top_module (
    input a, b, c, d, e,
    output [24:0] out );

 

 

 

3. 답

module top_module (
    input a, b, c, d, e,
    output [24:0] out );
    
    assign out = ~{{5{a}},{5{b}},{5{c}},{5{d}},{5{e}}}^{5{a,b,c,d,e}};

endmodule
 

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

[HDLBits] Module  (0) 2025.11.02
[HDLBits] Vector5  (0) 2025.11.02
[HDLBits] Vector4  (0) 2025.09.08
[HDLBits] Vectorr  (0) 2025.09.08
[HDLBits] Vector3  (1) 2025.08.27