1. 문제 및 설명
- 모듈의 계층 구조는 한 모듈안에서 다른 모듈을 인스턴스화 함으로써 만들어집니다.
- <module add16 ( input [15:0] a, input [15:0] b, input cin, output [15:0] sum, output cout);> 이 제공될 때 이 모듈을 두 번 인스턴스화 하여 아래 모듈을 설계하세요.

2. 모듈 정의
module top_module(
input [31:0] a,
input [31:0] b,
output [31:0] sum
);
3. 답
module top_module(
input [31:0] a,
input [31:0] b,
output [31:0] sum
);
wire cout, trash;
add16 i0 ( a[15:0], b[15:0], 1'b0, sum[15:0], cout);
add16 i1 ( a[31:16], b[31:16], cout, sum[31:16], trash);
endmodule
'Verilog > HDLbits' 카테고리의 다른 글
| [HDLBits] Module cseladd (0) | 2025.11.18 |
|---|---|
| [HDLBits] Module fadd (0) | 2025.11.18 |
| [HDLBits] Module shift8 (0) | 2025.11.02 |
| [HDLBits] Module shift (0) | 2025.11.02 |
| [HDLBits] Module name (0) | 2025.11.02 |