[En-Nut-Discussion] RAM vs. program memory speed

José Vallet jose.vallet at hut.fi
Thu Nov 2 12:27:33 CET 2006

Hello all.

While reading the FAQ I have noticed that, in order to save RAM, it is 
possible to access string variables straight from ROM by defining the 
string literals as prog_char.

In my application I have quite some strings that are suitable for this 
change, but I am concerned about speed issues because my application 
uses those strings intensively.

So, my question is, is it faster/slower to access data straight from 
program memory than from RAM in Ethernut 2.1?

My thoughts:
In the AVR manual it says that for the internal RAM it takes 2 clk 
cycles to fetch the data. Considering the cpu freq=14.7456MHz, a single 
clock takes 67.81ns, and therefore internal RAM access takes 135.6ns.
I haven't found anything about the ROM timing access, but I would expect 
it to be fast because the program data is fetch in a single clk cycle.

Also the external memory speed has to be considered, which about the 
specs says that the "Read cycle time" is minimum 55ns. Therefore less 
than a clk cycle. However, external RAM access takes more cycles than 
internal, due to the address latch and so on.

 From this I might assume that ROM access is, in average, faster than 
RAM access (taking into account internal and external), unless I am 
missing  something (most likely).

Any comments, please? (appreciated)


More information about the En-Nut-Discussion mailing list