One of the tricks I included in F-CPU FC0 was flags associated to each register, holding hidden (and restorable) states about the contents.
One of these flags is the ZERO flag, calculated each time the register is written. This works like a distributed status register.
Another flag is a "valid" flag : the SRB (smooth register backup) steals cycles to save or restore the monolithic register set across thread switches or during IRQ.
Also very interesting is an address valid flag, meaning that the register contains a pointer that has been cleared in the TLB. The tag should also contain the access rights, for example to prevent a store if the page is read-only. More information can be added such as the cache set, or other architecturally-specific details, which accelerates execution of a load/store instruction.
Similarly a flag can indicate whether a register contains a valid instruction pointer, for example for looping or function return. Not only can it say that the TLB should not be checked again, but also indicate the cache line number.
.
As long as you can recover these informations, you can cache them. They might be erased during a context switch, a TLB invalidation, whatever... Restoring the state will add a few cycles of penalty but it will function just as well.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.