Site Search

Hello, I'm Duck.

 

I learned C language and read a certain firmware.

Then the word MMU came out.

Apparently it stands for "Memory Management Unit" and I only knew how to translate it as "memory management unit".

So I asked my senior.

 

Duck "What is this MMU?"

Senpai: "MMU is for address conversion between virtual memory and physical memory in order to launch the farm."

Duck "???"

 

There were so many words I heard for the first time that my head was going to explode.

Therefore, I will explain the meaning of this word in two parts from this time.

What is a memory address

First, let's talk about memory addresses.

There is an address in the memory, which can be said to be the address of the data, and the CPU uses that address to perform processing based on the program.

 

Example) Add data of address 1 and data of address 2 and save to address 3.

Differentiating Memory -Address Space-

For example, consider handling data in actual memory in program ABC as follows.

A square of memory indicates a range of memory of a certain size (eg 4 KB) rather than a single piece of data.

In such a case, you may accidentally rewrite memory that is supposed to be used by another program.

Also, the discontinuity makes it difficult to understand when determining the memory location.

Therefore, it is solved by converting the actual memory address so that it can be easily handled in the program.

 

・Physical address Address of actual memory (physical memory (RAM, etc.))

・Physical address Address of actual memory (physical memory (RAM, etc.))

・Virtual address Memory (virtual memory) address used in the program

・Address conversion Convert virtual memory and physical memory ・MMU address conversion

In this way, address translation is performed between physical and virtual addresses.

This conversion is done in the MMU.

By converting, addresses can be used consecutively within a program.

The range of virtual addresses that can be handled continuously within this program (the area surrounded by the same color in the figure) is called the address space.

Next time, we'll take a closer look at how this MMU does address translation.

I want to remember + α

Of course, this MMU is also installed in ARM® systems, so it can also be used in Altera's SoC devices.

And it can also be used with Altera's Nios® II (soft core processor).

 

ARM Cortex-A9 is installed in Altera's SoC device.

This Cortex-A series requires the use of an MMU in order to use the cache. (I would like to write an article about cache on another occasion.)

 

Nios® II allows you to freely combine peripherals to build your own CPU system.

Nios® II has an MMU function, so you can use that.

In addition, the MMU and MPU (Memory Protection Unit) can be used separately, so you can choose according to your needs.

Incidentally, in Nios® II, you can only enable either the MMU or the MPU. Why is that?
When I asked my senior colleague,

"The MMU also has a protection function, so there's no need to use the MPU."

MMU had such a side as well.

 

Let's clarify this part in the next section on how address translation works.