Basic Circuits ALU design

Discussion in 'Homework Help' started by MikeAlvarez, Mar 10, 2013.

  1. MikeAlvarez

    Thread Starter New Member

    Mar 10, 2013
    2
    0
    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! :)
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    Given a binary value X, how can you get X/2?

    For the log part, worst case you have four 4-input combinatorial logic problems.

    For a more elegant approach, what information do you need to determine if a given bit in the value should be the single 1-bit in the output? Think in terms of information that can come from the left and then be passed to the right.
     
    MikeAlvarez likes this.
  3. MikeAlvarez

    Thread Starter New Member

    Mar 10, 2013
    2
    0
    Given a binary number... to get x/2 I think I should right-shift the most significant bit equal to 1. ex: 1010 = 10 so I shift the most significant 1, 0110 = 5. Am I right? I just don't really know how to implement this. I get the concept just now beginning to learn about alu cells and how it flows. I don't know how to write the logic to perform this. Can I get a hint?
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    Is 0110 really equal to 5?

    Write out the bit patterns for 0 through 15. Now write the bit patterns for each of these divided by 2. What relationship do you see?
     
Loading...