Have to convert a register, adder and subtractor into C++ code.
Note: in the second picture, o means output
| 100% Overview ECE474a/574a Create a program named dpgen (short for datapath generator) that ill convert a behavioral netlist specification into a synthesizable Verilog datapath implementation ECE 574a: After creating the Verilog implementation, the dpgen program should report the critical path of the datapath, reporting either the longest register to register delay or the longest input to register delay Command-line Arguments Your program must be capable of utilizing a command-line argument to specify the input and output files dpgen netlistFile vezilogFile Your program must ensure the user has correctly provided the required command-line arguments and display a usage statement if the provided arguments are incorrect Verilog implementation of Datapath Component Library The Verilog implementation should utlize the parameterized datapath component library created in the previous assignment Modfication to the library may be needed to support signed and unsigned arithmetic. The following summarizes the datapath components required. For signed versions of datapath components, precede the component name listed below with S. Ex: A signed version of the COMP component should be named SCOMP Data Control Description Name Data Control Inputs Inputs OutputsOutputs Register Adder Subtractor Multiplier Determines if a > b,a
include <stdio.h>
//This is the function for Binary Adder
int binaryAddition(int a,int b)
{
int p;
while (b != 0) {
//Firstly we will find carry and shift it left
p = (a & b) << 1;
//Next we will find the sum
a=a^b;
b=p;
}
return a;
}
//This is function for Binary Subtracter
int binarySubtracton(int a, int b)
{
int carryhere;
//First we will get 2\'s compliment of b and add in a
b = binAddition(~b, 1);
while (b != 0) {
//The second step is to find carry and shift it left
carryhere = (a & b) << 1;
//now we will find the sum
a = a ^ b;
b = carryhere;
}
return a;
}
int main()
{
int numberone,numbertwo, binaryAdder, binarySubtracter;
cout<<\"Please input first integer value”;
cin>>numberone;
cout<<\"Input second integer value”;
cin>>numbertwo;
binaryAdder=binryAddition(numberone,numbertwo);
binarySubtracter=binarySubtracton(numberone,numbertwo);
cout<<”the binary addition is”<<binaryAdder;
cout<<”the binary subtraction is”<<binarySubtracter;
return 0;
}