Skip to content

Latest commit

Β 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Project Banner

πŸš€ RISC-V Instruction Set Explorer

A zero-setup RISC-V analysis tool that parses, validates, and visualizes ISA structureβ€”revealing hidden relationships across extensions.


πŸ–ΌοΈ Preview


🎯 Overview

A complete 3-tier implementation that transforms raw RISC-V instruction data into:

  • πŸ” Structured extension groups
  • πŸ”— ISA cross-references
  • πŸ§ͺ Verified outputs via unit tests
  • πŸ“Š Interactive graph visualizations

✨ Why This Stands Out

  • ⚑ Zero-setup browser execution (offline)
  • 🧠 Smart normalization across inconsistent naming
  • πŸ”¬ Cross-validation with official ISA manual
  • πŸ“ˆ Graph-based insight into extension relationships
  • πŸ§ͺ Test-backed correctness (38 tests)

🧰 Implementations

File Language Network
riscv-explorer.html JavaScript ❌ Offline
src/explorer.py Python βœ… Required

⚑ Quick Start

🌐 Browser (Recommended)

start riscv-explorer.html

πŸ‘‰ πŸ‘‰ Click β–Ά RUN ALL TIERS to execute all three tiers instantly

🐍 Python CLI

python src/explorer.py --all

Run specific tiers:

python src/explorer.py --tier1
python src/explorer.py --tier2
python src/explorer.py --tier3

Run tests:

python -m unittest tests/test_explorer.py -v

πŸ“Š Core Features

🧩 Tier 1 β€” Instruction Parsing

  • Parses 245+ instructions
  • Groups by extension
  • Detects overlaps

πŸ”— Tier 2 β€” Cross-Reference

  • Matches against ISA manual
  • Normalizes naming differences
  • Identifies mismatches

πŸ“ˆ Tier 3 β€” Graph Analysis

  • Extension relationships
  • Shared instruction mapping
  • Interactive visualization

πŸ“Š Sample Output

🧩 Tier 1 β€” Instruction Parsing

  • βœ… 245 instructions processed
  • πŸ“¦ 262 total extension mappings
  • πŸ” 17 multi-extension overlaps detected

Top Extensions:

rv_i β†’ 40 instructions
rv_d β†’ 28 instructions
rv_c β†’ 26 instructions
rv_f β†’ 26 instructions

Multi-Extension Examples:

ADD.UW β†’ rv_zba, rv64_zba
AES64DS β†’ rv64_zknd, rv64_zkne
ANDN β†’ rv_zbb, rv_zbkb


πŸ”— Tier 2 β€” ISA Cross-Reference

  • πŸ“„ 42 ISA files scanned
  • πŸ” 847 candidate tokens extracted

Results:

  • βœ… Matched: 23
  • ❌ JSON-only: 0
  • ⚠️ Manual-only: 63 (expected noise)

Example Matches:

rv_a ↔ a
rv_c ↔ c
rv_zba ↔ zba


πŸ“ˆ Tier 3 β€” Graph Analysis

Top Relationships (by shared instructions):

rv_zbb ──[5]── rv_zbkb
rv_zbc ──[2]── rv_zbkc
rv_zba ──[1]── rv64_zba


🧠 Visualization Output

The browser version renders a live interactive graph:

  • πŸ”΅ Node size β†’ instruction count
  • πŸ”— Edge weight β†’ shared instructions
  • 🎨 Color β†’ extension family
  • πŸ–± Hover β†’ full instruction list

🧠 Key Insights

πŸ”Ή 1. Core ISA dominates instruction distribution

The base integer extension (rv_i) contains the highest number of instructions (~40), confirming its role as the foundational layer of the RISC-V architecture.

πŸ‘‰ Insight: Most other extensions build on top of this core, reinforcing a modular ISA design philosophy.


πŸ”Ή 2. Significant overlap between specialized extensions

Multiple instructions belong to more than one extension (e.g., ANDN, CLMUL, AES64DS).

πŸ‘‰ Insight: RISC-V extensions are not strictly isolatedβ€”they share functionality, especially in:

  • Bit manipulation (rv_zb*)
  • Cryptography (rv_zk*)

This suggests intentional reuse and composability, not duplication.


πŸ”Ή 3. Strong clustering in bit-manipulation extensions

Extensions like:

  • rv_zbb
  • rv_zbkb
  • rv_zbc

show the highest number of shared instructions.

πŸ‘‰ Insight: Bit-manipulation extensions form a tightly coupled cluster, indicating:

  • High internal cohesion
  • Designed to be used together

πŸ”Ή 4. Clean JSON coverage vs ISA manual mismatch

  • βœ… JSON-only extensions: 0
  • ⚠️ Manual-only tokens: 63

πŸ‘‰ Insight: The instruction dictionary is complete and consistent, while the ISA manual introduces:

  • Extra tokens (e.g., section names, abbreviations)
  • Expected parsing noise

This validates the reliability of structured JSON over raw documentation parsing.


πŸ”Ή 5. Graph structure reveals extension relationships

The force-directed graph highlights:

  • Dense clusters (bitmanip group)
  • Sparse links (specialized extensions like rv_zba ↔ rv64_zba)

πŸ‘‰ Insight: RISC-V follows a hybrid structure:

  • Dense clusters β†’ general-purpose extensions
  • Sparse edges β†’ niche or architecture-specific features

πŸ”Ή 6. Design favors scalability over rigidity

Normalization required:

  • Removing prefixes (rv32_, rv64_)
  • Case harmonization

πŸ‘‰ Insight: RISC-V naming conventions are flexible but inconsistent, reinforcing the need for:

  • Programmatic normalization
  • Rule-based parsing instead of hardcoding

🎯 Final Takeaway

RISC-V’s design emphasizes:

  • 🧩 Modularity β€” extensions build on a strong base
  • πŸ”— Interoperability β€” shared instructions across domains
  • πŸ“ˆ Scalability β€” easy to extend without breaking structure

This project transforms raw instruction data into actionable architectural insights about the RISC-V ecosystem.


πŸ“ Project Structure

RISC-V-instruction-explorer/
β”œβ”€β”€ README.md
β”œβ”€β”€ riscv-explorer.html
β”œβ”€β”€ src/
β”œβ”€β”€ tests/
β”œβ”€β”€ output/

βš™οΈ Key Design Decisions

πŸ”Ή Normalization Strategy

  • Regex-based (^rv\d*_)
  • Lowercase transformation
  • No hardcoding β†’ future-proof

πŸ”Ή Offline Browser Mode

  • Embedded dataset
  • No CORS issues
  • Instant execution

πŸ”Ή Efficient Graph Model

  • Adjacency dictionary
  • Fast lookups
  • Easy visualization

πŸ“Œ Assumptions

  • Flexible JSON schema supported
  • Missing extensions β†’ _unknown
  • Manual parsing may include noise (expected)

πŸ“Œ Key Result

  • βœ” 0 missing extensions in JSON dataset
  • βœ” 23 validated ISA matches
  • βœ” 17 cross-extension overlaps identified

πŸ‘‰ Confirms both data completeness and structural interconnectivity


🧾 Conclusion

This project demonstrates that RISC-V’s instruction set is not merely a collection of isolated extensions, but a deeply interconnected and modular architecture.

Through systematic parsing, normalization, and cross-referencing, several structural characteristics emerge:

  • The base ISA (rv_i) acts as a stable foundation, with higher-level extensions layering functionality rather than redefining it
  • Extension boundaries are intentionally porous, enabling instruction reuse across domains such as bit manipulation and cryptography
  • The observed clustered graph topology reflects design intentβ€”dense regions correspond to general-purpose capability groups, while sparse connections highlight specialized features

From a data perspective, the contrast between structured JSON and unstructured ISA documentation reinforces a key observation:

machine-readable specifications enable far more reliable analysis than textual standards alone

The necessity of normalization further indicates that RISC-V prioritizes extensibility over strict naming uniformity, a trade-off that favors long-term scalability at the cost of tooling complexity.


🎯 Broader Implication

The findings suggest that RISC-V is best understood not as a fixed ISA, but as an evolving ecosystem of interoperable instruction subsets.

This has direct implications for:

  • Compiler design β†’ optimization across overlapping extensions
  • Hardware implementation β†’ selective inclusion of tightly coupled instruction groups
  • Tooling & analysis β†’ need for abstraction layers over raw specification formats

πŸ” Final Perspective

By combining parsing, validation, and visualization, this work transforms static instruction data into a dynamic representation of architectural intent.

Ultimately, this project highlights how even low-level ISA data, when properly structured and analyzed, can reveal higher-order design principles underlying modern computing architectures.


About

RISC-V instruction parser, validator, and visualization tool with interactive graph insights

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages