본문 바로가기

Verilog/HDLbits

[HDLBits] Bcdadd100

1. 문제 및 설명

  • 주어진 bcd_fadd라는 BCD 덧셈기를 활용해 100자리 BCD 리플 캐리 덧셈기를 만들시오.
    1. 이 덧셈기는 두 개의 100자리 BCD 숫자와 Cin을 받아 100자리의 합과 Cout을 출력해야한다.
     

2. 모듈 정의

module top_module( 
    input [399:0] a, b,
    input cin,
    output cout,
    output [399:0] sum );

 

 

 

3. 답

module top_module( 
    input [399:0] a, b,
    input cin,
    output cout,
    output [399:0] sum );
    
    wire [99:0] temp_cout;
    assign cout = temp_cout[99];
    
    bcd_fadd i0 [99:0] (a, b, {temp_cout[98:0],cin}, temp_cout[99:0], sum);

endmodule

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

[HDLBits] Kmap2  (0) 2025.12.10
[HDLBits] Kmap1  (0) 2025.12.10
[HDLBits] Adder100i  (0) 2025.12.07
[HDLBits] Popcount255  (0) 2025.12.07
[HDLBits] Vector100r  (0) 2025.12.07