[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[oc] new special register



Hello !

Suppose you have register set of n registers: R0... Rn-1.
Register R0 is always 0.
If one would use register Rn-1 as stack (value) register,
with meaning:

pop register:        mov Rx,Rn-1
push register:        mov Rn-1,Rx

and:

add Rn-1,Rn-1,Rn-1    would cause Rn-1 = Rn-1 + Rn-1, no stack pointer
change.
add Rx,Rn-1,Rn-1    would cause tmp=pop Rn-1; Rx = tmp + tmp

each push causes dump of Rn-1 into memory, at local stack
with its top address defined in let's say Rn-2.
Doing mem operations on R(n-2), should cause some exception,
like invalid instruction exception.

My opinion is that this extra register would not complicate RISC
arhitecture. At the same time you spare some mem operations
(those with accesing top stack value), thus decreasing power
usage and in some cases it can also bring some speedup.
With faster push and pop, number of registers (n) can be
reduced (to e.g. n=8) -- local data can be easily stored on
stack.

Any criticism is welcomed.

Marko