Module Fourbitadder.docx

  • Uploaded by: sunandha reddy
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Module Fourbitadder.docx as PDF for free.

More details

  • Words: 70
  • Pages: 3
module fourbitadder(a,b,cin,sum,cout); input [3:0]a; input [3:0]b; output [3:0]sum; input cin; output cout; wire c0,c1,c2; fulladder1 fa0(a[0],b[0],cin,sum[0],c0); fulladder1 fa1(a[1],b[1],c0,sum[1],c1); fulladder1 fa2(a[2],b[2],c1,sum[2],c2); fulladder1 fa3(a[3],b[3],c2,sum[3],cout); endmodule

module fulladder1(input a,input b,input cin,output sum,output cy); wire s1,c1,c2; half_adder ha1(a,b,s1,c1); half_adder ha2(s1,cin,sum,c2); or or1(cy,c1,c2); endmodule

module half_adder(input a,b,output sum,carry); xor(sum,a,b); and(carry,a,b); endmodule

Test beanch:

module tb_fulladder_4(); reg[3:0]a; reg[3:0]b; reg cin; wire[3:0] sum; wire cout; fourbitadder tb_fulladder(a,b,cin,sum,cout); initial begin #10 a=4'b0000;b=4'b0000;cin=0; #10 a=4'b0010;b=4'b0110;cin=0; #20 $finish; end endmodule

Related Documents

Module
November 2019 51
Module
May 2020 40
Module
April 2020 45
Module 11
May 2020 12
Module 4
May 2020 20
Dada Module
November 2019 34

More Documents from ""

Fsm2.docx
November 2019 9
Module Fourbitadder.docx
November 2019 17
Module Decoder P.docx
November 2019 7
Memorryprogram.docx
November 2019 8
Jk1 Nad.docx
November 2019 8