Skip to content

Conversation

AFOliveira
Copy link
Collaborator

IMPORTANT: The scope of this PR is not to fully generate Binutils, rather to make the development of new/custom extensions much faster as it automates a big chunk of that process.

Implement a binutils generator that creates binutils-compatible opcode table entries from RISC-V UDB instruction definitions. The generator produces C source files and headers following the binutils-gdb format used in opcodes/riscv-opc.c.

Key features:

  • Extension-aware instruction class mapping with built-in and custom support
  • Operand format conversion from UDB assembly syntax to binutils format
  • MATCH/MASK constant generation with proper bit manipulation
  • Configurable architecture support (RV32, RV64, BOTH)
  • Comprehensive documentation and integration guidelines

Components:

  • binutils_generator.py: Main generator with CLI interface
  • binutils_parser.py: Core parsing and conversion logic
  • extract_riscv_operand_bits.py: Operand bit extraction utilities
  • insn_class_config.py: Extension to instruction class mappings
  • naming_config.py: User-defined naming and preference configurations
  • README.md: Comprehensive documentation and usage examples

This is a WiP PR and I know I am creating tech debt on my own PRs, but I guess I am more keen on creating new solutions than finishing

Implement a comprehensive binutils generator that creates binutils-compatible
opcode table entries from RISC-V UDB instruction definitions. The generator
produces C source files and headers following the binutils-gdb format used in
opcodes/riscv-opc.c.

Key features:
- Extension-aware instruction class mapping with built-in and custom support
- Operand format conversion from UDB assembly syntax to binutils format
- MATCH/MASK constant generation with proper bit manipulation
- Configurable architecture support (RV32, RV64, BOTH)
- Comprehensive documentation and integration guidelines

Components:
- binutils_generator.py: Main generator with CLI interface
- binutils_parser.py: Core parsing and conversion logic
- extract_riscv_operand_bits.py: Operand bit extraction utilities
- insn_class_config.py: Extension to instruction class mappings
- naming_config.py: User-defined naming and preference configurations
- README.md: Comprehensive documentation and usage examples

Signed-off-by: Afonso Oliveira <[email protected]>
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.05%. Comparing base (b5d25b9) to head (87e0992).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1072   +/-   ##
=======================================
  Coverage   46.05%   46.05%           
=======================================
  Files          11       11           
  Lines        4942     4942           
  Branches     1345     1345           
=======================================
  Hits         2276     2276           
  Misses       2666     2666           
Flag Coverage Δ
idlc 46.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ThinkOpenly ThinkOpenly added the generators Related to backend/generator label Sep 18, 2025
@ThinkOpenly ThinkOpenly moved this to Backlog in UDB Generators Sep 22, 2025
@ThinkOpenly ThinkOpenly moved this from Backlog to In progress in UDB Generators Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generators Related to backend/generator

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants