Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Arithmetic Circuit i. Design a full-adder module, that is, a module that compute

ID: 2248743 • Letter: A

Question

Arithmetic Circuit

i. Design a full-adder module, that is, a module that computes outputs Cout and S from inputs X, Y and Cin, as follows:

ii. Design an 8-bit adder module, that is, a module that computes the sum of two 8-bit operands A and B, and a carry-in Cin:

(A7A6A5A4A3A2A1A0) + (B7B6B5B4B3B2B1B0) + Cin (design this with full-adder modules).

A and B are positive or negative numbers ranging from 12810 to 12710, represented in two’s complement form (8 bits wide).

iii. Design a circuit that computes 2X Y + 1 for 8-bit operands X and Y : 2 (X7X6X5X4X3X2X1X0) (Y7Y6Y5Y4Y3Y2Y1Y0) + 1. X and Y are positive numbers ranging from 0 to 25510. Compute the result in two’s complement notation (8 bits wide). Flag a result that exceeds the range that can be represented

Fall' 17 Arithmetic Circuit i. Design a full-adder module, that is, a module that computes outputs Cout and S from inputs X, Y and Cin, as follows: (design this with logic gates) ii. Design an 8-bit adder module, that is, a module that computes the sum of two 8-bit operands A and B, and a carry-in Cin: (design this with full-adder modules). A and B are positive or negative numbers ranging from -12810 to 12710, represented in two's complement form (8 bits wide) iii. Design a circuit that computes 2X Y1 for 8-bit operands X and Y: X and Y are positive numbers ranging from 0 to 25510. Compute the result in two's complement notation (8 bits wide). Flag a result that exceeds the range that can be represented

Explanation / Answer

/////////////// 1 bit adder ///////////////
module full_adder (
   input a, b, cin,
   output sum, cout
);

wire temp;

assign temp = a ^ b;
assign sum = temp ^ cin;
assign cout = ( (a & b) | (temp & cin) );

endmodule

///////////////// 8bit adder using 1 bit adder //////////////
module adder_8bit (
   input [7:0] a, b,
   output [7:0] s,
   output       cout, overflow
);

wire w1, w2, w3, w4, w5, w6, w7, w8;

full_adder m1 (.a(a[0]), .b(b[0]), .cin(cin), .sum(s[0]), .cout(w1));
full_adder m2 (.a(a[1]), .b(b[1]), .cin(w1), .sum(s[1]), .cout(w2));
full_adder m3 (.a(a[2]), .b(b[2]), .cin(w2), .sum(s[2]), .cout(w3));
full_adder m4 (.a(a[3]), .b(b[3]), .cin(w3), .sum(s[3]), .cout(w4));
full_adder m5 (.a(a[4]), .b(b[4]), .cin(w4), .sum(s[4]), .cout(w5));
full_adder m6 (.a(a[5]), .b(b[5]), .cin(w5), .sum(s[5]), .cout(w6));
full_adder m7 (.a(a[6]), .b(b[6]), .cin(w6), .sum(s[6]), .cout(w7));
full_adder m8 (.a(a[7]), .b(b[7]), .cin(w7), .sum(s[7]), .cout(cout));

assign overflow = w7 ^ cout;

endmodule

////////////////// function creation using 1bit adder //////////////////////
module function_adder (
   input [7:0] a, b, cin,
   output [8:0] s,
   output        cout, overflow
);

wire [8:0] x;
wire [7:0] b_comp;
wire w1, w2, w3, w4, w5, w6, w7, w8;

assign x = {a[7:0], 1'b0}; // right shift by 1 unit is equivalent to multiplication by 2;
assign b_comp = (~b) + 1; // calculate the 2's complement for (-B)

full_adder m1 (.a(x[0]), .b(b_comp[0]), .cin(1'b1), .sum(s[0]), .cout(w1));
full_adder m2 (.a(x[1]), .b(b_comp[1]), .cin(w1),   .sum(s[1]), .cout(w2));
full_adder m3 (.a(x[2]), .b(b_comp[2]), .cin(w2),   .sum(s[2]), .cout(w3));
full_adder m4 (.a(x[3]), .b(b_comp[3]), .cin(w3),   .sum(s[3]), .cout(w4));
full_adder m5 (.a(x[4]), .b(b_comp[4]), .cin(w4),   .sum(s[4]), .cout(w5));
full_adder m6 (.a(x[5]), .b(b_comp[5]), .cin(w5),   .sum(s[5]), .cout(w6));
full_adder m7 (.a(x[6]), .b(b_comp[6]), .cin(w6),   .sum(s[6]), .cout(w7));
full_adder m8 (.a(x[7]), .b(b_comp[7]), .cin(w7),   .sum(s[7]), .cout(w8));
full_adder m9 (.a(x[8]), .b(1'b0),      .cin(w8),   .sum(s[8]), .cout(cout));

assign overflow = w8 ^ cout;
// thus s = (x + b_comp + 1) ==> S = (2*A - B + 1)

endmodule

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote