- #1
pedrossi
- 1
- 0
Homework Statement
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!