Using any instantiation of the below comparator and adder-subtractor modules and any number of logic gates, make a circu
Posted: Fri Jan 21, 2022 8:40 am
Using any instantiation of the below comparator and adder-subtractor modules and any number of logic gates, make a circuit with four-bit A and B inputs. If ASB is, output y is equal to A + B, and otherwise output y be equal to A - B. Describe the gates with logical operators and assign statements. 2.5 module addsub input [3:0] A, input (3:0) B input cin, input m, output reg (3:0) s, output reg cout ); module comp (A, B, GTI, EQ, LT); always @ (A,B,cin,m) parameter tplh=3, tphl=5, m=3; begin input [m-1:0] A, B; output GTh, EQ, LT: (cout, 3)=A-B-cin; if (m) (cout, 3)=A+B+cin; end assign # (tplh, tphl) GTh=AB, EQ=A===B, LT=A<B; endmodule endmodule