Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Swapping the values between two registeres in a single step (a single clock cycle)

  1. Feb 10, 2009 #1
    1. The problem statement, all variables and given/known data

    I'm working on a project for my elec class. I have to build a calculator with many functions (such as add, subtract...) and one of the functions is called a SWAP. Basically, I have two registers: RS and R0. Each register holds a 4-bit value (for example, RS could be 0011 and R0 could be 1010). I need to be able to push a button that triggers a clock cycle for the whole calculator, and the four-bit value in RS would be swapped with the four-bit value in R0.

    2. The attempt at a solution

    I've realized since starting this that it is harder than it seems. I tried using three registers (RS, R0, and a "SWAP" register to hold an intermediate value) but that seems to require TWO clock cycles to complete a swap after the first time. How can I do it with a single push of the button rather than two?

    Thanks!
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted