enso wrote:
2 cycles works out only if the LDA xxxx fits in the 4-byte fetch.
No, it works out all the time, because you remember bytes you don't consume.
Clearly it needs spelling out.
Say, you have (all hex) LDA 2211, LDA 4433, LDA 6655, LDA 8877, LDA AA99, RTS
in memory at 0000, which is :
0000 : AD, 11, 22, AD
0004 : 33, 44, AD, 55
0008 : 66, AD, 77, 88
000C : AD, 99, AA, 60
Now suppose you have a previous word register (PW), a previous word address
register (PWA), both initially empty, and an instruction register (IR). Initial
read, done because PW and PWA are empty, and which will stall the processor
(as, in the simplest implementation, would need to happen after any control
flow change) reads from 0000, loading 0000 into PWA and AD, 11, 22, AD into PW.
Now we can begin.
First instruction (PC = 0000) : 32-bit read @ PWA+4 (0004) obtains 33, 44, AD,
55. Combines with PW, PWA and PC to write AD, 11, 22 into IR. 32-bit read was
superfluous, so PW and PWA unchanged.
Second instruction (PC = 0003) : 32-bit read @ PWA+4 (0004) obtains 33, 44, AD,
55. Combines with PW, PWA and PC to write AD, 33, 44 into IR. 32-bit read was
contributing, so PWA and PW updated to 0004 and 33, 44, AD, 55.
Third instruction (PC = 0006) : 32-bit read @ PWA+4 (0008) obtains 66, AD, 77,
88. Combines with PW, PWA and PC to write AD, 55, 66 into IR. 32-bit read was
contributing, so PWA and PW updated to 0008 and 66, AD, 77, 88.
Fourth instruction (PC = 0009) : 32-bit read @ PWA+4 (000C) obtains AD, 99, AA,
60. Combines with PW, PWA and PC to write AD, 77, 88 into IR. 32-bit read was
superfluous, so PW and PWA unchanged.
Fifth instruction (PC = 000C) : 32-bit read @ PWA+4 (000C) obtains AD, 99, AA,
60. Combines with PW, PWA and PC to write AD, 99, AA into IR. 32-bit read was
contributing, so PWA and PW updated to 000C and AD, 99, AA, 60.
And you simply use IR instead of whatever registers you had for opcode and
argument bytes.
See ? One read per instruction is all it takes.
enso wrote:
You are really talking out your butt.
See above. And check the attitude, pal.