Skip to main content

Crate riscfetch_core

Crate riscfetch_core 

Source
Expand description

RISC-V system information library

Provides functions to detect and query RISC-V specific system information including ISA extensions, hardware IDs, vector capabilities, and more.

§Example

use riscfetch_core::*;

if is_riscv() {
    println!("ISA: {}", get_isa_string());
    println!("Extensions: {}", get_extensions_compact());
}

Structs§

CacheInfo
Cache information
ExtensionEntry
Extension entry with name and description
ExtensionInfo
Extension info with category and support status
HardwareIds
Hardware IDs from RISC-V CSRs
RiscvInfo
RISC-V specific information only (excludes generic system info)
SystemInfo
Complete system information for JSON serialization
VectorInfo
Vector extension information

Constants§

STANDARD_EXTENSIONS
Standard extension definitions Format: (char, name, description)
S_CATEGORY_NAMES
Category display names for S-extensions
S_EXTENSIONS
S-extension definitions (Privileged/Supervisor) Format: (pattern, name, description, category)
Z_CATEGORY_NAMES
Category display names for Z-extensions
Z_EXTENSIONS
Z-extension definitions (Unprivileged) Format: (pattern, name, description, category)

Functions§

collect_all_info
Collect all information into a single struct
collect_riscv_info
Collect RISC-V specific information only (excludes generic system info)
compute_derived_extension_names
Compute every extension name that is implied or composed from the extensions the ISA string reports directly, but that the ISA string itself does not mention (see the implications module). These are the names that should be shown in parentheses.
get_all_s_extensions_with_status
Get ALL S-extensions with support status based on ISA string
get_all_standard_extensions_with_status
Get ALL standard extensions with support status
get_all_z_extensions_with_status
Get ALL Z-extensions with support status based on ISA string
get_board_info
Get board/model information from device tree
get_cache_info
Get cache information
get_extensions_compact
Get compact extension list (e.g., “I M A F D C V”)
get_extensions_explained
Get extensions with explanations
get_extensions_with_derived
Get standard (single-letter, including G expansion) extensions as ExtensionInfo, including ones inferred via implication/composition (e.g. B from Zba+Zbb+Zbs, per issue #10). Extensions the ISA string names directly have derived: false; inferred ones have derived: true.
get_extensions_with_derived_for_system
Get standard extensions, including ones inferred via implication/composition (issue #10). Inferred entries have derived: true.
get_hardware_ids
Get hardware IDs (mvendorid, marchid, mimpid)
get_hart_count
Get hart count as formatted string
get_hart_count_num
Get hart count as number
get_isa_string
Get raw ISA string (e.g., rv64imafdcv_zicsr_...)
get_kernel_info
Get kernel version
get_memory_bytes
Get memory information as bytes
get_memory_info
Get memory usage as formatted string
get_os_info
Get OS name from /etc/os-release
get_s_category_name
Get category display name for S-extensions
get_s_extensions
Get S-extensions as compact string
get_s_extensions_explained
Get S-extensions with explanations
get_s_extensions_with_category
Get S-extensions with category info
get_s_extensions_with_category_and_derived
Get S-extensions with category info, including ones inferred via implication/composition (issue #10). Inferred entries have derived: true.
get_uptime
Get uptime as formatted string
get_uptime_seconds
Get uptime in seconds
get_vector_detail
Get vector extension details (VLEN, ELEN)
get_z_category_name
Get category display name for Z-extensions
get_z_extensions
Get Z-extensions as compact string
get_z_extensions_explained
Get Z-extensions with explanations
get_z_extensions_with_category
Get Z-extensions with category info
get_z_extensions_with_category_and_derived
Get Z-extensions with category info, including ones inferred via implication/composition (issue #10). Inferred entries have derived: true.
group_by_category
Group extensions by category
is_riscv
Check if the current system is RISC-V architecture
parse_extensions_compact
Parse extensions from ISA string (pure function for testing)
parse_extensions_explained
Parse extensions with explanations (pure function for testing)
parse_s_extensions
Parse S-extensions from ISA string (pure function for testing)
parse_s_extensions_explained
Parse S-extensions with explanations (pure function for testing)
parse_s_extensions_with_category
Parse S-extensions with category info
parse_s_extensions_with_category_and_derived
Same as parse_s_extensions_with_category, plus S-extensions inferred via implication/composition (see issue #10). Inferred entries have derived: true.
parse_vector_from_isa
Parse vector details from ISA string (pure function for testing) Returns None if no vector extension, Some(details) otherwise
parse_z_extensions
Parse Z-extensions from ISA string (pure function for testing)
parse_z_extensions_explained
Parse Z-extensions with explanations (pure function for testing)
parse_z_extensions_with_category
Parse Z-extensions with category info
parse_z_extensions_with_category_and_derived
Same as parse_z_extensions_with_category, plus Z-extensions inferred via implication/composition (see issue #10). Inferred entries have derived: true.