CPU-MMU

The CPU-MMU is used for virtual-to-physical memory address translation.

Introduction

The CPU-MMU diagram is shown in the following figure. A MMU can perform virtual-to-physical memory address translation. This can be used to map an external memory to a certain virtual memory area.

../../_images/cpu_mmu_diagram.svg

MMU virtual address to physical address is illustrated in the following figure. For example, if you want to access physical page 4 ~ 7 through virtual page 0 ~ 3, an MMU entry can be used to map virtual page 0 ~ 3 to physical page 4 ~ 7.

../../_images/mmu_virtual_address_to_physical_address.svg

The chip provides 4 MMU entries.

  • If virtual address is not included in the MMU entry, use virtual address as physical address.

  • If virtual address is included in the MMU entry, physical address should be VAddress + MMU_ENTRYx_OFFSET.

Registers

REMAP以1024Byte为整数倍进行映射,如果要访问的地址VAddress在MMU entry区间内则进行remap,判断条件为 VAddress >=  REG_REMAPxBAR,且 VAddress <= REG_REMAPxEAR,映射后的地址physical address由3部分组成:

  1. physical address[9:0] = VAddress[9:0];

  2. physical address[19:10] = VAddress[19:10] + REG_REMAPxEAR [19:10];

  3. physical address[31:20] = VAddress[31:20].

整个Register Map应该在Secure syson区间,PG时需要 retention 所有的Register,否则CPU1 Wakeup会出错 (Syson不会掉电)

Name

Address offset

Access

Description

REG_REMAP0BAR

000h

R/W

Region EMAP0 Base Address Register

REG_REMAP0EAR

004h

R/W

Region EMAP0 End Address Register

REG_REMAP0OR

008h

R/W

Remap 0 Offset Register

REG_REMAP1BAR

00Ch

R/W

Region EMAP1 Base Address Register

REG_REMAP1EAR

010h

R/W

Region EMAP1 End Address Register

REG_REMAP1OR

014h

R/W

Remap 1 Offset Register

REG_REMAP2BAR

018h

R/W

Region EMAP2 Base Address Register

REG_REMAP2EAR

01Ch

R/W

Region EMAP2 End Address Register

REG_REMAP2OR

020h

R/W

Remap 2 Offset Register

REG_REMAP3BAR

024h

R/W

Region EMAP3 Base Address Register

REG_REMAP3EAR

028h

R/W

Region EMAP3 End Address Register

REG_REMAP3OR

02Ch

R/W

Remap 3 Offset Register

REG_REMAPxBAR

  • Name: Remap x Base Address Register (x={0, 1, 2, 3})

  • Size: 32 bits

  • Address offset: Refer to virtual address base register.

  • Read/write access: R/W

Bit

Symbol

Access

Reset

Description

31:10

REMAP_BASE_x_ADDR

R/W

0x0

Remap region x base address [31:10]

The region address is 1KB aligned.

9:0

RSVD

-

0

Reserved

REG_REMAPxEAR

  • Name: Remap x End Address Register (x={0, 1, 2, 3})

  • Size: 32 bits

  • Address offset: Refer to virtual address end register.

  • Read/write access: R/W

Bit

Symbol

Access

Reset

Description

31:10

REMAP_END_x_OFFSET

R/W

0x0

Remap region x end address [31:10]

The region address is 1KB aligned.

9:0

RSVD

-

0

Reserved

REG_REMAPxOR

  • Name: Remap x Offset Register (x={0, 1, 2, 3})

  • Size: 32 bits

  • Address offset: Refer to actual register address offset.

  • Read/write access: R/W

Bit

Symbol

Access

Reset

Description

31:20

RSVD

-

0

Reserved

19:10

REMAP_x_OFFSET

R/W

0x0

Remap region x offset [19:10]

The output address [19:10] is “Access address[19:10]+ Region_Offset[19:10]”.

9:1

RSVD

-

0

Reserved

0

REMAP_x_ENABLE

R/W

0x0

Remap region x enable