Uploaded by Eren Tezel

ARM Video - 12 Memory

advertisement
Hello fellas welcome back.
So in this lesson we shall look at another essential component of the embedded system,
the memory.
An embedded system has to have some form of memory to store and execute code.
And when we're looking at memory we can compare them in terms of price, performance
and power consumption.
For instance if a memory has to run twice as fast to maintain design bandwidth with the
memory power consumption
requirements may be higher.
This curve depicts the memory hierarchy.
First you must know that all computer systems have memory arranged in some form of
hierarchy.
This graph shows the memory tradeoff. The fastest memory is the cache memory and is
physically
located nearer to the ARM processor core and the slowest memory is the secondary
storage which is set
further away from the ARM processor.
Generally speaking the closer the memory is to the processor the more it costs and the
smaller its
capacity. The cache is placed between the main memory and the core and it's used to
speed up data transfer
between the processor and the main memory. We shall examine the cache on its own
later.
But for now you only need to remember that the cache provides an overall increase in
performance and
it comes with a loss of predictable execution time though.
And this only becomes a problem when you are building a real time application. The
main memory is large,
it's in Megabytes mostly and sometimes even in gigabyte depending on the application,
and the
main memory is generally a separate chip from the ARM processor. As we shall see later
load and store
instructions access the main memory unless the values have been stored in the cache
for fast access.
You can think of the secondary memory as your every day flush disk, your hard disk or
your CD-ROM.
Now let's take a look at some parameters we pay attention to when looking at memory.
So let's start with the memory width. The memory width is basically a number of bits the
memory returns
on each access.
And it comes in the sizes of 16-bit 32-bit and 64-bit. The memory has direct effect on
overall
performance.
For instance if you have a system without cache memory using 32-bit ARM instructions
and 16-bit
wide memory chips, the processor will have to make two memory fetches per instruction
because each fetch can
only carry 16-bit load.
This of course has the effect of reducing system performance.
But the upside is 16-bit memory is less expensive.
In contrast if the ARM core executes 16-bit THUMB instructions it will achieve better
performance with
a 16-bit memory because the core will make a single fetch to memory to load an
instruction. As we shall
see in this cause the ARM processor is capable of executing three instruction sets. The
ARM instruction set which
has 32 bits instructions.
The THUMB instruction set which has 16-bit instructions and the THUMB 2 instruction
set which uses
both 16-bit and 32-bit instructions.
Let's see how the arm and thumb instructions compare when using different memory
width.
The ARM instruction set
is 32-bit in size like we mentioned.
So if the width of the memory is 8 bits the processor would need 4 cycles to fetch a
single instruction.
If the width of the memory is 16 bits the processor will require 2 cycles per instruction
and if the
width of the memory is 32 bits then the processor will require a single cycle per
instruction.
On the other hand the THUMB instruction set has instructions with 16 bits of size.
Therefore with an 8-bit memory width, the processor uses two cycles to fetch a single
instruction
and with a 16-bit memory width the processor will require a single cycle to fetch a single
instruction.
With a 32-bit of memory width the processor will still require a single cycle to fetch a
single instruction.
Now let's take a look at some of the commonly used memory types
we find in embedded devices. The ROM cannot be reprogrammed and a flash ROM is a
type of ROM that can
be written to as well as read.
But it is slow to write to
so it's not used for holding dynamic data.
It's main use for holding the device firmware or storing long term data that needs to be
preserved after
that power is off. The dynamic Random Access Memory is the most commonly used type
of ROM for devices.
It has the lowest cost per megabyte compared with other types of RAM. The SRAM
which stands for static random
access memory is faster than the DRAM.
It's access time is considerably shorter than the equivalent DRAM because SRAM does
not require pauses
between data access. The SDRAM is a subcategory of the RAM and is capable of
running at faster clock frequencies.
The EPROM which stands for the electrically erasable programmable read only memory
is used for program
code storage most often for saving critical with data.
Not all ARM chips have an on-chip EPROM.
Now let's look at a simplified memory space allocation diagram for an ARM device.
Typically ARM has 4
Gbytes of directly accessible memory space.
Now why is that?
Remember ARM cores are 32-bit cores and there are 32-bit cores because the internal
registers are 32-bit
the data paths are 32-bit and the bus interfaces are 32-bits.
The bit size allows the CPU to address a memory for an individual process. So an expert
can handle
2^x bytes of memory.
The higher the bit size the higher the performance.
Therefore a 32-bit can handle approximately 4 GB of memory.
The ARM memory space can be divided into 5 sections.
The on chip peripheral and IO register section which can occupy any of the empty areas
here depending
on the particular silicone manufacturer. The SRAM section which is used for the data
variables and the stack.
the EPROM section and the flash the section.
The SFR section indicated up here is for special function registers.
We should talk about the ARM registers in coming sections. So this is all there is to it.
To summarize the SRAM is used by the CPU for data variables and stac,k whereas the
EPROMS are considered
to be the memory that
you can add externally to the chip. The flush ROM is used for program code while the
EPROM is used most
often for critical system data that must not be lost if power is cut to the system.
This all there is to it and I'll see you in the next lesson.
Download