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§
- Cache
Info - Cache information
- Extension
Entry - Extension entry with name and description
- Extension
Info - Extension info with category and support status
- Hardware
Ids - Hardware IDs from RISC-V CSRs
- Riscv
Info - RISC-V specific information only (excludes generic system info)
- System
Info - Complete system information for JSON serialization
- Vector
Info - 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
implicationsmodule). 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
Gexpansion) extensions asExtensionInfo, including ones inferred via implication/composition (e.g.BfromZba+Zbb+Zbs, per issue #10). Extensions the ISA string names directly havederived: false; inferred ones havederived: 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 havederived: 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 havederived: true.