Question

In: Electrical Engineering

Using full adders and some other gates, design subtractor that subtracts an 8-bit binary number [Y7...

Using full adders and some other gates, design subtractor that subtracts an 8-bit binary number [Y7 …. Y0] from 8-bit binary number [X7 … X0]. Write necessary equations. Draw detailed circuit diagram and explain steps & write verilog code

Solutions

Expert Solution

the blocks here are full adders:

verilog code for 8-bit adder subtractor:

hierarchical

Half adder

then using HA to make full adder

module HA(a,b,s,cout);
input a,b;
output s,cout;
assign s=a^b;
assign cout=a & b;
endmodule
module FA(a,b,cin,s,cout);
input a,b,cin;
output s,cout;
wire s1,c1,c2;
HA h1(a,b,s1,c1);
HA h2(cin,s1,s,c2);
or rrr1(cout,c1,c2);
endmodule

module four_bit_adder(a,b,cin,s,cout);
input [3:0] a,b;
input cin;
output [3:0] s;
output cout;
wire c0,c1,c2;
FA f0(a[0],b[0],cin,s[0],c0);
FA f1(a[1],b[1],c0,s[1],c1);
FA f2(a[2],b[2],c1,s[2],c2);
FA f3(a[3],b[3],c2,s[3],cout);
endmodule


module four_bit_add_Sub(a,b,M,sum_diff,carry);
input [7:0] a,b;
input M;
output [7:0] sum_diff;
output carry;
wire [7:0] b_out;
wire c1;
  
xor x1(b_out[0],b[0],M);
xor x2(b_out[1],b[1],M);
xor x3(b_out[2],b[2],M);
xor x4(b_out[3],b[3],M);
xor x5(b_out[4],b[4],M);
xor x6(b_out[5],b[5],M);
xor x7(b_out[6],b[6],M);
xor x8(b_out[7],b[7],M);
  
four_bit_adder f111(a[3:0],b_out[3:0],M,sum_diff[3:0],c1);
four_bit_adder f121(a[7:4],b_out[7:4],M,sum_diff[7:4],carry);
endmodule


Related Solutions

Advanced Digital System Design Build a 1-bit subtractor and scale it up to become an 8-bit...
Advanced Digital System Design Build a 1-bit subtractor and scale it up to become an 8-bit subrtactor. Include truth tables and gate level diagrams for the 1-bit version.
Design and implementation 4-bit binary full adder with fast carry using behavioral and structural style of...
Design and implementation 4-bit binary full adder with fast carry using behavioral and structural style of modelling. (LS 7483) I want logic diagram and its truth table also i want code for it in VDHL software
Design and implementation 4-bit binary full adder with fast carry using behavioral and structural style of...
Design and implementation 4-bit binary full adder with fast carry using behavioral and structural style of modelling. (LS 7483) i want logic diagram and truth table
Design of 4 Bit Adder/Subtractor using Loops (Behavior Modeling Style) (verilog Code) -
Design of 4 Bit Adder/Subtractor using Loops (Behavior Modeling Style) (verilog Code) -
Design a logic circuit that takes 2-bit input A and 2-bit input B and subtracts the...
Design a logic circuit that takes 2-bit input A and 2-bit input B and subtracts the two numbers using full adders and inverters with full adders diagram, which input is subtracted dos not matter.
Make a 2 bit binary adder subtractor multiplier on verilog and display it on seven segment...
Make a 2 bit binary adder subtractor multiplier on verilog and display it on seven segment using fpga
Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit...
Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit thermometer code. An n-bit thermometer code represents an integer m, with m 1s followed by (n-m) 0s. 1-bit bubble is an error in coding when a solitary 0 (or 1) is found in between two 1s (or 0s). What is the size of your circuit in terms of the number of NOR gates used? Implement using structural verilog and include a test bench.
Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit...
Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit thermometer code. An n-bit thermometer code represents an integer m, with m 1s followed by (n-m) 0s. 1-bit bubble is an error in coding when a solitary 0 (or 1) is found in between two 1s (or 0s). Implement using structural verilog. Please do not answer unless familiar with Xilinx and verilog.
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT