execute from external flash

Started by Gus January 12, 2008
I have compared executing code from external 16-bit flash to executing
from internal flash to see that using internal flash is 10 times faster!
Is this normal or I have something setup wrong? I didn't try it with
THUMB mode

G

An Engineer's Guide to the LPC2100 Series

--- In l..., "Gus" wrote:
>
> I have compared executing code from external 16-bit flash to executing
> from internal flash to see that using internal flash is 10 times faster!
> Is this normal or I have something setup wrong? I didn't try it with
> THUMB mode
>
> G
>

I do not know about the exact speed difference, but isn't that about
the range that would be expected? Using the LP229x as an example, the
internal FLASH is 128 bits wide and so fetches 4 instructions in one
fetch on the ARM local bus. But the external FLASH is only 16 bits
wide and so fetches one instruction with two complete instruction
fetch bus cycles on the AMBA bus. Just the fetches alone are an 8 to
1 difference, not including the speed difference of the two buses. It
seems likely that with that much difference that the external FLASH is
often stalling the ARM instruction fetch pipeline? I know that I have
made some pretty gross over generalizations here, but it does seem to
be not much of a surprise that the internal FLASH will be much faster.
With a 16 bit external memory, THUMB mode can get one instruction for
each instruction fetch on the AMBA bus instead of half an ARM
instruction, so it should be significantly faster?

--Dave
I am all with you on all that. I didn't think about that way but I
guess it make sense now.

But, why executing from SDRAM is much faster than external FLASH? Not
as fast as internal flash.
Both are on the same 16 bit bus with processor going at 72Mhz.

Gus

--- In l..., "derbaier" wrote:
>
> --- In l..., "Gus" wrote:
> >
> > I have compared executing code from external 16-bit flash to
executing
> > from internal flash to see that using internal flash is 10 times
faster!
> > Is this normal or I have something setup wrong? I didn't try it
with
> > THUMB mode
> >
> > G
> > I do not know about the exact speed difference, but isn't that about
> the range that would be expected? Using the LP229x as an example,
the
> internal FLASH is 128 bits wide and so fetches 4 instructions in one
> fetch on the ARM local bus. But the external FLASH is only 16 bits
> wide and so fetches one instruction with two complete instruction
> fetch bus cycles on the AMBA bus. Just the fetches alone are an 8
to
> 1 difference, not including the speed difference of the two buses.
It
> seems likely that with that much difference that the external FLASH
is
> often stalling the ARM instruction fetch pipeline? I know that I
have
> made some pretty gross over generalizations here, but it does seem
to
> be not much of a surprise that the internal FLASH will be much
faster.
> With a 16 bit external memory, THUMB mode can get one instruction
for
> each instruction fetch on the AMBA bus instead of half an ARM
> instruction, so it should be significantly faster?
>
> --Dave
>
I am sorry, but I don't have enough information to answer that
question, Gus. My last post was a gross over simplification that
really only covered the difference between 128 bit access over 16 bit
access for ARM instructions. To thoroughly understand the difference
between 16 bit accesses on the external bus, you really need to go
into the access timing analysis for the different chips and memory
controller involved for the external bus. I may be wrong, but I
believe that I read somewhere that NXP guarantees that the internal
memory can be accessed fast enough not to stall the ARM instruction
fetch pipeline. If that is true, then ARM clock speed would be the
primary factor in instruction execution time. I have not designed with
external memory with NXP parts, but the access timing diagrams that I
have seen all show multiple clock accesses, so you need to calculate
how many clocks are required for each memory type on the external bus.

Sorry that was not more help.
--Dave

--- In l..., "Gus" wrote:
>
> I am all with you on all that. I didn't think about that way but I
> guess it make sense now.
>
> But, why executing from SDRAM is much faster than external FLASH? Not
> as fast as internal flash.
> Both are on the same 16 bit bus with processor going at 72Mhz.
>
> Gus
>
> --- In l..., "derbaier" wrote:
> >
> > --- In l..., "Gus" wrote:
> > >
> > > I have compared executing code from external 16-bit flash to
> executing
> > > from internal flash to see that using internal flash is 10 times
> faster!
> > > Is this normal or I have something setup wrong? I didn't try it
> with
> > > THUMB mode
> > >
> > > G
> > >
> >
> > I do not know about the exact speed difference, but isn't that about
> > the range that would be expected? Using the LP229x as an example,
> the
> > internal FLASH is 128 bits wide and so fetches 4 instructions in one
> > fetch on the ARM local bus. But the external FLASH is only 16 bits
> > wide and so fetches one instruction with two complete instruction
> > fetch bus cycles on the AMBA bus. Just the fetches alone are an 8
> to
> > 1 difference, not including the speed difference of the two buses.
> It
> > seems likely that with that much difference that the external FLASH
> is
> > often stalling the ARM instruction fetch pipeline? I know that I
> have
> > made some pretty gross over generalizations here, but it does seem
> to
> > be not much of a surprise that the internal FLASH will be much
> faster.
> > With a 16 bit external memory, THUMB mode can get one instruction
> for
> > each instruction fetch on the AMBA bus instead of half an ARM
> > instruction, so it should be significantly faster?
> >
> > --Dave
>