Verilog Full Adder Code

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
module FA(
    input A,
    input B,
    input Cin,
    output Cout,
    output S
    );
    assign {Cout,S} = A+B+Cin;
endmodule

'Study' 카테고리의 다른 글

Verilog Half Adder Constraints File  (0) 2019.05.26
Verilog Dsp7Seg.v Code  (0) 2019.05.26
Verilog Half Adder Code  (0) 2019.05.26
Verilog Add 4 Bit Code  (0) 2019.05.26
Verilog Lab_4_Bit_Adder Code  (0) 2019.05.26

Verilog Add 4 Bit Code

`timescale 1ns / 1ps

//////////////////////////////////////////////////////////////////////////////////
module Add4bit(
    input [3:0] A,
    input [3:0] B,
    output Cout,
    output [3:0] S
    );
    wire [2:0] tmp;
    HA U0(.A(A[0]),.B(B[0]),.Cout(tmp[0]),.S(S[0]));
    FA U1(.A(A[1]),.B(B[1]),.Cin(tmp[0]),.Cout(tmp[1]),.S(S[1]));
    FA U2(.A(A[2]),.B(B[2]),.Cin(tmp[1]),.Cout(tmp[2]),.S(S[2]));
    FA U3(.A(A[3]),.B(B[3]),.Cin(tmp[2]),.Cout(Cout),.S(S[3]));
endmodule

 

'Study' 카테고리의 다른 글

Verilog Full Adder Code  (0) 2019.05.26
Verilog Half Adder Code  (0) 2019.05.26
Verilog Lab_4_Bit_Adder Code  (0) 2019.05.26
면접은 암기다?  (0) 2019.03.01
병자호란과 대한민국  (0) 2018.07.23
`timescale 1ns / 1ps

//////////////////////////////////////////////////////////////////////////////////

// Lab 4bit adder : 

// A[3:0],B[3:0],clk,rst --> AN[7:0], Seg[7:0]

//////////////////////////////////////////////////////////////////////////////////

module LabAdd4bit(
    input [3:0] A,
    input [3:0] B,
    input clk,
    input rst,
    output [7:0] AN,
    output [7:0] Seg
    );
    
    wire [3:0] carry, sum;
    assign carry[3:1] = 3'b000;

    Add4bit U1(.A(A), .B(B), .Cout(carry[0]), .S(sum));
    Dsp7Seg U2(.X0(A), .X1(B), .X2(carry), .X3(sum), .clk(clk), .rst(rst), .AN(AN),.dsp(Seg));
endmodule

Verilog Lab_4_Bit_Adder Code

'Study' 카테고리의 다른 글

Verilog Half Adder Code  (0) 2019.05.26
Verilog Add 4 Bit Code  (0) 2019.05.26
면접은 암기다?  (0) 2019.03.01
병자호란과 대한민국  (0) 2018.07.23
The Secrets of Universe, 우주의 비밀에 대해서 공부  (0) 2018.07.23

+ Recent posts