Article title: SkyEye hardware simulation platform, hardware simulation implementation 3. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. MMU and Memory system structure
Figure 0-1 system structure of MMU and Memory in the arm system
The system structure of MMU and Memory in the arm system is 0 1. However, the time difference between the specific CPU implementation and MMU may be relatively large, which may be simplified and extended. the MMU simulation of SkyEye is based on this and provides a standard interface, it is divided into two main parts: MMU simulation sub-modules irrelevant to the specific CPU type and MMU simulation sub-modules related to the specific CPU type.
2. Basic flowchart of arm data access
The basic process of arm CPU data access is as follows: 0 2.
Figure 0-2 basic process of arm CPU data access
3. Unified MMU interface
Data structure
Typedef struct mmu_state_t {
Armwordcontrol; // CP15 control register
Armwordtranslation_table_base; // CP15 translation table base register
Armworddomain_access_control; // CP15 domain access control register
Armwordfault_status; // CP15 fault status register
Armwordfault_address; // CP15 fault address register
Armwordlast_domain; // last access domain
Armwordprocess_id; // CP15 process id register
Mmu_ops_tops;
Union {
Sa_mmu_tsa_mmu;
Arm7100_mmu_t arm7100_mmu;
} U;
} Mmu_state_t;
Typedef struct mmu_ops_s {
Int (* init) (armul_State * state);/* initilization */
Void (* exit) (armul_State * state);/* free on exit */
Fault_t (* read_byte) (ARMul_State * state, ARMword va, armword * data );
Fault_t (* write_byte) (ARMul_State * state, ARMword va, armword data );
Fault_t (* read_halfword) (ARMul_State * state, ARMword va, armword * data );
Fault_t (* write_halfword) (ARMul_State * state, ARMword va, armword data );
Fault_t (* read_word) (ARMul_State * state, ARMword va, armword * data );
Fault_t (* write_word) (ARMul_State * state, ARMword va, armword data );
Fault_t (* load_instr) (ARMul_State * state, ARMword va, armword * instr );
Void (* mcr) (ARMul_State * state, ARMword instr, armword val );
ARMword (* mrc) (ARMul_State * state, armword instr );
} Mmu_ops_t;
Mmu of the mmu_state_t type in the armul_State data structure represents the MMU state in the simulation. Ops in mmu_state_t provides interface functions for specific mmu, and also includes a joint structure u for the data structure implemented by specific mmu.
4. MMU simulation sub-module unrelated to the specific CPU type
The MMU simulation sub-module unrelated to the specific CPU type is the basis for MMU simulation. it simulates MMU elements such as TLB, TTW, access control, CACHE, Write Buffer, and Read Buffer, it also provides a unified interface that can be flexibly combined to implement specific MMU simulation.
TLB implementation (mmu/tlb. [ch])
TLB is a table whose table items contain address ing information and access control information. The Address Translation information can be searched in the memory through TTW only when the table cannot be queried.
In arm systems, only associated CACHE is implemented. The associated CACHE of a group is divided into multiple groups. a group contains multiple CACHE lines and a 32-bit address can be represented.
Tag Set Word 1 0
Data structure
Cache row
Typedef struct cache_line_t {
Armword tag;/* cache line align address |
Bit2: last half dirty
Bit1: first half dirty
Bit0: cache valid flag
*/
Armword pa;/* physical address */
Armword * data;/* array of cached data */
} Cache_line_t;
Typedef struct cache_set_s {
Cache_line_t * lines;
Int cycle;/* used for cache line allocation */
} Cache_set_t;
Cache structure
Typedef struct cache_s {
Intwidth;/* bytes in a line */
Int way;/* way of set asscociate */
Intset;/* num of set */
Int w_mode;/* write back or write through */
// Int a_mode;/* alloc mode: random or round-bin */
Cache_set_t * sets;
} Cache_t;
Interface functions
/* Cache initialization and release */
Int mmu_cache_init (cache_t * cache_t, int width, int way, int set, int w_mode );
Void mmu_cache_exit (cache_t * cache_t );
/* Cache search and allocation */
Cache_line_t * mmu_cache_search (ARMul_State * state, cache_t * cache_t, armword va );
Cache_line_t * mmu_cache_alloc (ARMul_State * state, cache_t * cache_t, ARMword va, armword pa
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service