4 ??, 16 ?? ???? ?? ?? (????)

Source: Internet
Author: User

Q :???? ??? ??

1. Half-adder

Module half_adder (S, C, x, y); Output S, C; input x, y; XOR (S, x, y); and (C, x, y ); endmodule

2. Full-adder

Module full_adder (S, C, x, y, z); Output S, C; input x, y, z; wire S1, D1, D2; half_adder HA1 (S1, D1, x, Y); half_adder ha2 (S, D2, S1, Z); or G1 (C, D2, D1); endmodule 3. 4bit ripple carry AdderModule ripple_carry_4_bit_adder (output [3: 0] S, output C4, input [3: 0] A, B, input C0); wire C1, C2, C3; full_adder fa0 (s [0], c1, a [0], B [0], C0), fa1 (s [1], C2, a [1], B [1], C1 ), fa2 (s [2], C3, a [2], B [2], C2), fa3 (s [3], C4, a [3], B [3], C3); endmodule 4. 16bit ripple carry AdderModule fulla16 (sum, c_out, A, B, c_in); Output [] sum; Output c_out; input [] A; input [] B; input c_in; wire C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14; full_adder fa0 (sum [0], c0, a [0], B [0], c_in); full_adder fa1 (sum [1], C1, a [1], B [1], C0 ); full_adder fa2 (sum [2], C2, a [2], B [2], C1); full_adder fa3 (sum [3], C3, a [3], B [3], C2); full_adder fa4 (sum [4], C4, a [4], B [4], C3); full_adder fa5 (sum [5], c5, a [5], B [5], C4); full_adder fa6 (sum [6], C6, a [6], B [6], C5 ); full_adder fa7 (sum [7], C7, a [7], B [7], C6); full_adder fa8 (sum [8], C8, a [8], B [8], C7); full_adder fa9 (sum [9], C9, a [9], B [9], C8); full_adder fa10 (sum [10], c10, a [10], B [10], C9); full_adder fa11 (sum [11], C11, a [11], B [11], C10 ); full_adder fa12 (sum [12], C12, a [12], B [12], C11); full_adder fa13 (sum [13], C12, a [13], B [13], C12); full_adder fa14 (sum [14], C12, a [14], B [14], C13); full_adder fa15 (sum [15], c12, a [15], B [15], C14); endmodule 16bit adder simulation results 4bit adder simulation results Answers:?? ?? ??? ???.???? ??? ?? ?? ?? Test environment? ??? ??.??? ??? 4bit ripple carry adder ??? ?? ????? ????????? ??? ???. ???? ?? ??? ??? ????? ? ? ??? ?? ????.

4 ??, 16 ?? ???? ?? ?? (????)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.