#16209 - poslundc - Tue Feb 10, 2004 5:28 pm
Inspired by the other topic recently posted here, I'm just interested in probing more into the nature of the memory controller and how it works with different instructions.
Take the following example case, running from ROM. We know that this code will take advantage of sequential reads to load the instruction:
But that this one won't, because of the branch:
What about an instruction that loads from the ROM, though? I would assume that it would also cause a miss:
How about an instruction that accesses internal/external RAM instead of the ROM? Does that affect the sequential reading of instructions?
Finally, to look at things from the reverse direction... if I am running code from IWRAM and it is reading data from the ROM, does the memory controller lose its sequentiality between multiple ROM reads if I don't use a ldmia?
For example, the following code running in IWRAM (or anywhere) will take advantage of sequential access:
But if it was done the following way, where the memory controller must load the next instruction from IWRAM, would it be able to maintain sequential reading from ROM:
I realize that there are also pipelining issues to consider in all of these questions - so it would actually be an instruction further down being fetched while the others are being executed - but please bear in mind these are only examples to illustrate the question, and the nature of the problem (which is how the memory controller decides what's sequential) stays the same with or without pipelining.
These are details that I've puzzled over for the past longish while but never really formulated as a proper question. Any help solving the mystery is appreciated. :)
Dan.
Take the following example case, running from ROM. We know that this code will take advantage of sequential reads to load the instruction:
Code: |
mov r1, r0
add r1, r0, r1 |
But that this one won't, because of the branch:
Code: |
b nextstatement
nextstatement: mov r1, r0 |
What about an instruction that loads from the ROM, though? I would assume that it would also cause a miss:
Code: |
mov r0, #0x08000000
ldr r1, [r0] mov r0, r1 @ should be a non-sequential instruction (?) |
How about an instruction that accesses internal/external RAM instead of the ROM? Does that affect the sequential reading of instructions?
Code: |
mov r0, #0x03000000
str r1, [r0] mov r0, r1 @ would this be a sequential instruction or not? |
Finally, to look at things from the reverse direction... if I am running code from IWRAM and it is reading data from the ROM, does the memory controller lose its sequentiality between multiple ROM reads if I don't use a ldmia?
For example, the following code running in IWRAM (or anywhere) will take advantage of sequential access:
Code: |
ldmia r0, {r1, r2} |
But if it was done the following way, where the memory controller must load the next instruction from IWRAM, would it be able to maintain sequential reading from ROM:
Code: |
ldr r1, [r0], #4 @ next ROM read is sequentially ordered...
ldr r2, [r0] @ ... but is it read sequentially if the load instruction must first be read from IWRAM? |
I realize that there are also pipelining issues to consider in all of these questions - so it would actually be an instruction further down being fetched while the others are being executed - but please bear in mind these are only examples to illustrate the question, and the nature of the problem (which is how the memory controller decides what's sequential) stays the same with or without pipelining.
These are details that I've puzzled over for the past longish while but never really formulated as a proper question. Any help solving the mystery is appreciated. :)
Dan.