I am to create a ALU cell that can perform these operations:
mode
m1 m0
----------
0 0 y = 2^(floor(log(2a))*i.e. Set all bits to 0 except most significant 1
------------------------
0 1 y = A + B/2
1 0 y = A
1 1 y = A+B
I have been working on this for a while, trying to figure it out. I am allowed to use an infinite amount of 2-to-1 Muxes with one select input, an infinite amount of 4-to-1 Muxes, and ONLY 1 full adder.
I am having extreme difficulty figuring out how to do modes 00 and 01. I don't know how I should compare the bits to know which one is the most significant. Please help point me in the correct direction. Keep in mind I am using 1 ALU cell symbol in Quartus to create a 4-bit ALU with inputs A3-A0, B3-B0, m1, m0, and outputs Y3-Y0. Thanks!
mode
m1 m0
----------
0 0 y = 2^(floor(log(2a))*i.e. Set all bits to 0 except most significant 1
------------------------
0 1 y = A + B/2
1 0 y = A
1 1 y = A+B
I have been working on this for a while, trying to figure it out. I am allowed to use an infinite amount of 2-to-1 Muxes with one select input, an infinite amount of 4-to-1 Muxes, and ONLY 1 full adder.
I am having extreme difficulty figuring out how to do modes 00 and 01. I don't know how I should compare the bits to know which one is the most significant. Please help point me in the correct direction. Keep in mind I am using 1 ALU cell symbol in Quartus to create a 4-bit ALU with inputs A3-A0, B3-B0, m1, m0, and outputs Y3-Y0. Thanks!