본문 바로가기

Verilog/HDLbits

[HDLBits] Four wires

1. 문제 및 설명

아래 입출력 결과를 가지는 모듈을 만드세요

a -> w
b -> x
b -> y
c -> z

 

 

2. 모듈 정의

module top_module( 
    input a,b,c,
    output w,x,y,z );

 

 

3. 답

입출력 하나씩 연결해줘도 되지만, 묶어서 작성하면 깔끔하게 표현할 수 있다.

module top_module( 
    input a,b,c,
    output w,x,y,z );
    assign {w, x, y, z} = {a, b, b, c};
endmodule

 

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

[HDLBits] Xnorgate  (0) 2025.08.27
[HDLBits] Norgate  (0) 2025.08.27
[HDLBits] AND gate  (0) 2025.06.22
[HDLBits] Inverter  (0) 2025.06.21
[HDLBits] Simple wire  (0) 2025.06.21