Building A Rotate Right Circuit for An ALU in Logisim

Discussion in 'Homework Help' started by TayRMurray, Jun 4, 2016.

  1. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    The title says it all. Basically, we are supposed to take a shift left circuit, and then produce a rotate right circuit from looking at it.
    Attached is the image that we are given to decide how to build this circuit.

    Any and all help is appreciated.
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    Do you understand how the shift left circuit implements a shift left?

    If so, do you see how to modify it to create a shift right circuit?

    Do you understand the difference between a shift left operation and a rotate left operation?

    If so, going back to the shift left circuit, do you see how to modify it to create a rotate left circuit?

    If so, do you see how to apply that modification to your shift right circuit to make it a rotate right circuit?
     
  3. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    I get confused about how it works after the XOR gate. I know that the ground will add a 0 at the 0th bit place on the splitter. I don't know how the V, C, En or splitter after that work.

    I do not.

    A shift left adds a 0 from the right to the left, a rotate left replaces the right most bit with the C value, and rotates everything to the left.

    The C flag would be used to replace the 0 position bit instead of a ground, but I'm not sure how the rest would work.

    No I do not.
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    Okay, so let's take things one step at a time.

    Before trying to understand how the circuit implements the desired functions, let's make sure that you understand what the desired functions are.

    So describe, in your own words, what the various inputs and outputs are and how the circuit is supposed to behave. Focus on what it is supposed to accomplish without worrying about how it goes about accomplishing it.
     
  5. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    The desired function of a shift left circuit would be to take an input binary number and move the bits one space to the left while adding a binary 0 at the end. If we assume a 2's complement, the shift is essentially multiplying by 2.

    A rotate right function, I'm not sure what it's supposed to do.
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    You've only partially described your shift left circuit.

    You have three inputs, A, Cin, and En. You have three outputs, Result, Cout, and V.

    How is the circuit supposed behave in response to each of the inputs. You can't hope to implement a circuit that does something unless you understand what it is supposed to do.

    What is the V output? What does it mean?

    Does Cin have any effect for this circuit?

    What is the En output? What are the outputs supposed to do in response to the signal applied to this input?
     
  7. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    V output is the overflow condition. If 1, then the operation the circuit is attempting to do is out of range. I don't know if Cin has an effect. I assume it does if it's a value of 1. Otherwise, a value of 0 won't do anything.

    I have no idea what En does at all period.
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    The description for what V means is correct up to a point -- but what does it mean for the operation to be "out of range"?

    What do you thing En stands for?

    Look at the circuit implementation and see if Cin is used in any way.
     
  9. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    In the case of a circuit. I do not understand how it works. I know that in signed binary functions, it would mean that the equation being performed, i.e. addition its not in the range.

    I think En means Enable, it would essentially be a power switch.

    Cin does not look to be used in this implementation.
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    So let's see if we can figure out how it works based on what it means. As you say, we are talking about signed binary operations -- specifically two's complement. Also, as you noted before, an arithmetic shift left (ASL) is the same thing as multiplying the original number by two.

    So consider the following possibilities:

    1) We start with a positive number and when we multiply it by two we get a value that is valid.
    2) We start with a positive number and when we multiply it by two we get a value that is not valid.
    3) We start with a negative number and when we multiply it by two we get a value that is valid.
    4) We start with a negative number and when we multiply it by two we get a value that is not valid.

    Play around with some examples and make a note of how the sign bit behaves before and after the multiplication. Then consider the implementation of V in light of that.

    Yes, it means enable, but I don't know that thinking of it as a power switch is best -- but it might be reasonable in this implementation. Look at the circuit and ask what all of the outputs are if En is LO. Then consider what the effect of En is when it is HI.

    That is correct. In an ASL the Cin is forced to be LO. Some processors will use an actual Cin bit, but most will behave as if it is LO.
     
  11. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    So in the case of the circuit, the V bit would just become which ever value is 1 from the splitter?

    The outputs would all be 0 if it's in LO, and if it's in HI it could be 1 or 0, depending on what was input into it.

    How I would i begin to change it from an ASL to an ASR?
     
  12. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    What splitter?

    Forget about the implementation of V for now and focus on what V means and how to determine whether V should be HI or LO based on the inputs.

    Go back to the four questions I asked and answer each one of them as far as what happens to the sign bit in each case.

    Yes. Or another way to put it is to say that if the Enable is LO, all of the outputs are forces LO, while if the Enable is HI the outputs are allowed to be whatever the logic in the circuit would have made it. This is known as "gating" a signal.

    Let's first make sure that you understand what the functionality of the ASL circuit is, okay?
     
  13. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    The input value A goes into a splitter, connected to another splitter. The wires come off the 8th and 7th bit and connect into a XOR gate.

    1. The sign bit would retain the value of 0.
    2. The sign bit would change values to 1.
    3. The sign bit would retain the value of 1.
    4. The sign bit would change values to 0.

    That's the pattern I began to see in the examples I've done.
     
  14. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    That's the pattern that you should see. Now let's examine that pattern to see if we can simplify it.

    In cases 1 and 3 (which are the cases that produce valid outputs), the sign bit RETAINS its original value, while in cases 2 and 4 (which are the cases that produce invalid outputs), the sign bit CHANGES from its original value. In other words, if the output is valid, the old sign bit and the new sign bit are the same, while if the output is invalid, they are different.

    Now, the old sign bit is A[7] of the input.

    Which input signal is the new sign bit?

    What logic gate will tell you if two signals are the same or different?
     
  15. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    The new sign bit would be input signal A[6].
    The XOR logic gate seems to be the one that determines if it remains the same or changes.
     
  16. WBahn

    Moderator

    Mar 31, 2012
    17,725
    4,788
    Correct.

    So now you should have a good understanding of how this ASL circuit works.

    Functional description:

    The En input, when LO, forces ALL of the outputs LO.
    When the En input is HI:
    The Result output is the A input shifted left one place with the low order bit forced to be 0 (since multiplying by two results in an even number).
    The Cout output is the high order bit of the A input.
    The V output is HI to indicate an output that does NOT represent the input multiplied by two.

    The next incremental step would be to either figure out how to do a shift right circuit or how to do a rotate left circuit. The easiest one of the two is to modify the ASL circuit to make it a rotate left circuit.
     
  17. TayRMurray

    Thread Starter New Member

    Jun 4, 2016
    9
    0
    Okay yeah. I understand that description now.

    Yeah, let's modify the circuit into a rotate left circuit.
     
Loading...