# US 12,007,902 B2 · Configurable memory system and memory managing method thereof

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,007,902 B2
- Document ID: US12007902B2
- Status: Granted
- Kind: B2
- Application number: 17/984,189
- Filed: 2022-11-09
- Published: 2024-05-09
- Granted: 2024-06-11
- Earliest claimed: 2022-11-09
- Assignees: Andes Technology Corporation
- Applicants: Andes Technology Corporation
- Inventors: Chih-Ming Shen; Cheng-Yen Huang
- Web page: https://patentgrep.com/patent/US12007902B2

## CPC

- G06F 12/0638: {Combination of memories, e.g. ROM and RAM such as to permit replacement or supplementing of words in one module by words in another module (address formation of the next microinstruction G06F9/26; masking faults in memories by using spares or by reconfiguring G11C29/70)}
- G06F 12/10: Address translation
- G06F 12/109: for multiple virtual address spaces, e.g. segmentation (G06F12/1036 takes precedence)
- G06F 12/1441: {for a range}
- G06F 12/1491: {in a hierarchical protection system, e.g. privilege levels, memory rings}
- G06F 12/145: {the protection being virtual, e.g. for virtual blocks or segments before a translation mechanism}
- G06F 2212/1024: Latency reduction
- G06F 2212/1028: Power efficiency
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/1052: Security improvement
- G06F 2212/657: Virtual address space management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The invention provides a configurable memory system including an interface layer, an overlay application layer, and a memory relocatable layer. The interface layer has a physical memory attribute module and a physical memory protection module. The interface layer manages memory attributes and memory security. The overlay application layer is coupled to the interface layer and executes an exception handler process to check if an overlay exception has occurred. The memory relocatable layer, coupled to the interface layer and the overlay application layer, having a plurality of resident service program within a first memory space, an overlay physical region within a second memory space, and a plurality of overlay virtual regions having application processes within a third memory space. The application processes of one of the overlay virtual regions is determined to be executed by the PMA module and is copied from the overlay virtual region to the overlay physical region by a processor.

## Claims

### Claim 1

A configurable memory system, comprising:
an interface layer, having a physical memory attribute (PMA) module and a physical memory protection (PMP) module, managing a plurality of memory attributes and memory security;
an overlay application layer, coupled to the interface layer and executing an exception handler process to check if an overlay exception has occurred; and
a memory relocatable layer, coupled to the interface layer and the overlay application layer, having a plurality of resident service program within a first memory space, an overlay physical region within a second memory space, and a plurality of overlay virtual regions having corresponding application processes within a third memory space,
wherein the corresponding application processes of one of plurality of overlay virtual regions is determined to be executed by the PMA module and is copied from the overlay virtual region to the overlay physical region by a processor.

### Claim 2 (depends on 1)

The memory system as claimed in claim 1, wherein translating each of the addresses of the plurality of overlay virtual regions is determined according to a fixed hardwire connection pre-set by an overlay management system.

### Claim 3 (depends on 1)

The memory system as claimed in claim 1, wherein each of the addresses of the plurality of overlay virtual regions is determined according to an address information stored in an address register, wherein the address information is adjusted by an overlay relocating process when the application process is under execution.

### Claim 4 (depends on 1)

The memory system as claimed in claim 1, wherein a memory size of the first memory space, a memory size of the second memory space, and a memory size of the third memory space are determined according to an overlay management system.

### Claim 5 (depends on 1)

The memory system as claimed in claim 1, wherein a memory size of the first memory space, a memory size of the second memory space, and a memory size of the third memory space are determined according to a corresponding memory size information stored in a corresponding memory size register, wherein the memory size information is adjusted by an overlay relocating process when the application processes are under execution.

### Claim 6 (depends on 1)

The memory system as claimed in claim 1, wherein a configurable memory size of the memory relocatable layer is 2K+L*(an overlay size), wherein the configurable memory size is less than or equal to an addressable memory size of the memory relocatable layer.

### Claim 7 (depends on 1)

The memory system as claimed in claim 1, wherein a maximum number of overlay space comprising the overlay physical region and the plurality of overlay virtual regions is (2K−1)*2L+1.

### Claim 8 (depends on 7)

The memory system as claimed in claim 7, wherein a number of overlay space actually used by the system is controlled and determined by the overlay application layer through the interface layer and a user interface.

### Claim 9 (depends on 1)

The memory system as claimed in claim 1, wherein a size of the plurality of resident service processes is (2L−1)*(an overlay size).

### Claim 10 (depends on 9)

The memory system as claimed in claim 9, wherein the overlay size actually used by the system is flexibly controlled by the PMA module, the PMP module, or an embedded PMP module according to system requirements.

### Claim 11 (depends on 1)

The memory system as claimed in claim 1, wherein an overlay management system is implemented in a local memory space of the processor, a SRAM space, and a main memory space.

### Claim 12 (depends on 1)

The memory system as claimed in claim 1, wherein the overlay physical region is adapted for either an instruction memory or a data memory.

### Claim 13 (depends on 1)

The memory system as claimed in claim 1, wherein the memory system is not influenced by operation mechanism of cache, and wherein the memory system is either implemented independently or with cache.

### Claim 14 (depends on 1)

The memory system as claimed in claim 1, wherein the memory system uses either a single privilege mode of the processor or a plurality of privilege modes of the processor to execute privilege instructions.

### Claim 15 (depends on 1)

The memory system as claimed in claim 1, wherein the interface layer uses configurations and address registers of the PMA module, the PMP module, or an embedded PMP module of RISC-V/ARM architecture, wherein the interface layer uses a trap and exception mechanism of RISC-V/ARM architecture.

### Claim 16 (depends on 15)

The memory system as claimed in claim 15, wherein the PMA module of RISC-V uses a memory type attribute (MTYP) to define the cacheability and idempotency of memory regions, wherein a type 15 of the MTYP is defined as an empty hole which is designed to trigger an overlay swapping by a predetermined instruction sets comprising an instruction access fault, a load access fault, and a store access fault.

### Claim 17 (depends on 1)

The memory system as claimed in claim 1, wherein the application layer implements a plurality of management application programming interfaces (APIs) related to the overlay exception in the exception handler process.

### Claim 18 (depends on 1)

The memory system as claimed in claim 1, wherein when the exception handler process determines to execute an overlay swapping, the processor controls a direct memory access (DMA) controller of the memory system to update the application process in the overlay virtual region and to move updated application process into the overlay physical region, or the processor directly updates the application process in the overlay virtual region and moves updated application process into the overlay physical region.

### Claim 19

A memory managing method, comprising:
providing a first signal to an interface layer upon switching a first overlay region to a second overlay region, wherein the interface layer comprises a physical memory attribute (PMA) module and a physical memory protection (PMP) module and is responsible for managing a plurality of memory attributes and memory security;
shifting to an overlay application layer;
executing an exception handler process of the application layer to check if an overlay exception has occurred;
translating a first address of the second overlay region in a memory relocatable layer into a second address of the second overlay region;
copying application processes of the second overlay region from one of plurality of overlay virtual regions of the memory relocatable layer to an overlay physical region of the memory relocatable layer by a processor; and
determining to execute the second overlay region by the PMA module,
wherein the overlay physical region receives the application processes from one overlay virtual region at a time.

### Claim 20 (depends on 19)

The method as claimed in claim 19, wherein translating the first address into the second address is determined according to a fixed hard wire connection pre-set by an overlay management system or according to an address information stored in an address register, wherein the address information is adjusted by an overlay relocating process when the application process is under execution.
