jdryg / tis100cpu

TIS-100 CPU in VHDL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SWP in ALU

jdryg opened this issue · comments

Check if it's possible to implement the SWP instruction in a single cycle inside the ALU.

As mentioned by @holmak in #1 SWP can be implemented inside the register file.

For SWP, instead of actually moving values between the ACC and BAK registers, you can just toggle a single flip-flop. Then, any time ACC is read, the state of that flip-flop determines which of the two registers is currently ACC. This is how the Z80 implements its swap instructions, EX and EXX.