Question: binSub.v: A digital circuit that subtracts two 8 - bit 2 ' s complement numbers. Your task in this assignment part is to create a

binSub.v: A digital circuit that subtracts two 8-bit 2's complement numbers.
Your task in this assignment part is to create a digital circuit that calculates difference = minuend - subtrahend for three numbers minuend, subtrahend, and difference all encoded as 8-bit 2's complement numbers.
Input and output format: The interface to the binary subtraction logic is given in binSub.v.
Hints: The demonstration code for a 8-bit negator that finds the negated value of a 8-bit 2's complement number in the negator/ directory should be useful. You may also want to read about half-adders and full-adders for additional hints for this part. The logic for this part can be co
mpleted in under 150 lines of code.
Here is given binSub.v:
input [7:0] minuend;
input [7:0] subtrahend;
output [7:0] difference;
wire inv_subtrahend_7;
wire inv_subtrahend_6;
wire inv_subtrahend_5;
wire inv_subtrahend_4;
wire inv_subtrahend_3;
wire inv_subtrahend_2;
wire inv_subtrahend_1;
wire inv_subtrahend_0;
wire negator_carry_0;
wire negator_carry_1;
wire negator_carry_2;
wire negator_carry_3;
wire negator_carry_4;
wire negator_carry_5;
wire negator_carry_6;
wire negator_carry_7;
wire neg_subtrahend_7;
wire neg_subtrahend_6;
wire neg_subtrahend_5;
wire neg_subtrahend_4;
wire neg_subtrahend_3;
wire neg_subtrahend_2;
wire neg_subtrahend_1;
wire neg_subtrahend_0;
assign inv_subtrahend_7= ~ subtrahend[7];
assign inv_subtrahend_6= ~ subtrahend[6];
assign inv_subtrahend_5= ~ subtrahend[5];
assign inv_subtrahend_4= ~ subtrahend[4];
assign inv_subtrahend_3= ~ subtrahend[3];
assign inv_subtrahend_2= ~ subtrahend[2];
assign inv_subtrahend_1= ~ subtrahend[1];
assign inv_subtrahend_0= ~ subtrahend[0];
assign negator_carry_0= inv_subtrahend_0;
assign negator_carry_1= negator_carry_0 & inv_subtrahend_1;
assign negator_carry_2= negator_carry_1 & inv_subtrahend_2;
assign negator_carry_3= negator_carry_2 & inv_subtrahend_3;
assign negator_carry_4= negator_carry_3 & inv_subtrahend_4;
assign negator_carry_5= negator_carry_4 & inv_subtrahend_5;
assign negator_carry_6= negator_carry_5 & inv_subtrahend_6;
assign negator_carry_7= negator_carry_6 & inv_subtrahend_7;
assign neg_subtrahend_0= ~ inv_subtrahend_0;
assign neg_subtrahend_1= negator_carry_0^ inv_subtrahend_1;
assign neg_subtrahend_2= negator_carry_1^ inv_subtrahend_2;
assign neg_subtrahend_3= negator_carry_2^ inv_subtrahend_3;
assign neg_subtrahend_4= negator_carry_3^ inv_subtrahend_4;
assign neg_subtrahend_5= negator_carry_4^ inv_subtrahend_5;
assign neg_subtrahend_6= negator_carry_5^ inv_subtrahend_6;
assign neg_subtrahend
_7= negator_carry_6^ inv_subtrahend_7;
Here is example input and outputs:
TestCase0:
0
0
Answer0:
difference =0
TestCase1:
1
0
Answer1:
difference =1
TestCase2:
2
1
Answer2:
difference =1
TestCase3:
0
1
Answer3:
difference =255
TestCase4:
1
2
Answer4:
difference =255
TestCase5:
2
2
Answer5:
difference =0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!