Skip to content

platform-system-interface/thead_cpuinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T-Head cpuinfo

This is a simple CPU information decoder for T-Head cores.

Detailed information is not available regarding model etc. (CPUINFO0).

Per the C906 manual:

The machine mode processor model register (MCPUID) stores the processor model information. Its reset value is determined by the product itself and complies with the Pingtouge product definition specifications to facilitate software identification. By continuously reading the MCPUID register, up to 7 different return values can be obtained to represent C906 product information, as shown in Figure ??.

(translated by Google)

To read out the register, RISC-V CSR 0xfc0:

/// T-Head CPU model register
fn print_cpuid() {
    let mut id: u32;
    for i in 0..7 {
        unsafe { asm!("csrr {}, 0xfc0", out(reg) id) };
        println!("MCPUID {i}: {id:08x}");
    }
}

About

Decode CPU information for T-Head RISC-V cores

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages