Domain Specific Language for Instruction Set Architecture descriptions
Project description
ISA DSL - Instruction Set Architecture Domain Specific Language
A powerful Domain Specific Language (DSL) for describing Instruction Set Architectures (ISA) using textX. This DSL enables you to specify instruction formats, registers, instruction encodings, and behavior in RTL (Register Transfer Level) notation, with automatic code generation for simulators, assemblers, disassemblers, and documentation.
Features
- Complete ISA Specification: Define instruction formats, registers (GPRs, SFRs, and vector registers), and instruction encodings
- RTL Behavior: Specify instruction behavior using Register Transfer Level notation with support for:
- Arithmetic and logical operations
- Conditional statements
- Memory access operations
- Vector/SIMD operations
- Automatic Code Generation: Generate production-ready tools:
- Python-based instruction simulators
- Assemblers for your ISA
- Disassemblers for binary code
- Markdown documentation
- SIMD Support: Built-in support for vector registers and SIMD instructions
- Validation: Comprehensive semantic validation of ISA specifications
- Language Server Protocol (LSP) Support: Full IDE integration with VS Code extension providing:
- Real-time syntax highlighting
- Code completion
- Hover documentation
- Error diagnostics
Installation
Prerequisites
- Python 3.8 or higher
- UV (recommended) or pip
Using UV (Recommended)
UV is a fast Python package manager. Install it first:
# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or on Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Then install the project:
# Clone the repository
git clone <repository-url>
cd isa-dsl
# Install the project and dependencies
uv sync
# Or install in development mode with test dependencies
uv sync --dev
Using pip (Alternative)
# Clone the repository
git clone <repository-url>
cd isa-dsl
# Install dependencies
pip install -r requirements.txt
# Or install in editable mode
pip install -e .
Quick Start
-
Define your ISA in a
.isafile (seeexamples/arm_cortex_a9.isafor a multi-file example) -
Generate tools:
# Using UV
uv run isa-dsl generate examples/arm_cortex_a9.isa --output output/
# Or using Python directly
python -m isa_dsl.cli generate examples/arm_cortex_a9.isa --output output/
- Use the generated tools:
# Validate your ISA
uv run isa-dsl validate examples/arm_cortex_a9.isa
# Get ISA information
uv run isa-dsl info examples/arm_cortex_a9.isa
# Run the generated simulator
python output/simulator.py program.bin
Documentation
All technical documentation is available in the docs/ folder:
- INDEX.md: Documentation index and navigation guide - Start here to find what you need
- DSL_Specification.md: Complete DSL specification covering all features including syntax, registers, formats, instructions, RTL behavior, variable-length instructions, bundling, SIMD, and more
- EXAMPLES.md: Detailed documentation of example ISA specifications with learning paths and common patterns
- TESTING.md: Complete testing documentation including test suite overview, how to run tests, and how to add new tests
- LANGUAGE_SERVER.md: Language Server Protocol (LSP) setup and usage guide for VS Code extension
Examples
The examples/ directory contains reference ISA specifications demonstrating best practices:
arm_cortex_a9.isa: Main ARM Cortex-A9 ISA specification (multi-file reference)arm_cortex_a9_registers.isa- Register definitionsarm_cortex_a9_formats.isa- Instruction format definitionsarm_cortex_a9_instructions.isa- Instruction definitions
This demonstrates the multi-file approach using #include directives and cross-file format reference resolution.
Note: Test-specific ISA examples are located in tests/*/test_data/ directories.
To generate tools from the reference example:
uv run isa-dsl generate examples/arm_cortex_a9.isa --output output/
Command-Line Interface
The isa-dsl command provides several subcommands:
Generate Tools
uv run isa-dsl generate <isa_file> --output <output_dir>
Options:
--simulator/--no-simulator: Generate simulator (default: enabled)--assembler/--no-assembler: Generate assembler (default: enabled)--disassembler/--no-disassembler: Generate disassembler (default: enabled)--docs/--no-docs: Generate documentation (default: enabled)
Validate ISA
uv run isa-dsl validate <isa_file>
Display ISA Information
uv run isa-dsl info <isa_file>
Testing
The project includes a comprehensive test suite with 111 automated tests covering:
- Core functionality: ISA parsing, validation, RTL interpretation
- Code generation: Assembler, simulator, disassembler, documentation generators
- Advanced features: Variable-length instructions, instruction bundling, distributed operands
- Integration tests: End-to-end workflows, QEMU verification, ARM toolchain integration
- Multi-file support: Include processing, inheritance, merge modes
- Assembly syntax: Formatting, literal braces, backward compatibility
- VS Code Extension: Language server tests (18 tests) for LSP functionality
Running Tests
# Run all Python tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Run with coverage
uv run pytest --cov
# Run specific test suite
uv run pytest tests/arm/
# Run VS Code extension tests
cd vscode_extension/isa/packages/language && npm test
Test Status:
- ✅ All 111 Python tests passing, 0 skipped, 0 failed
- ✅ All 18 VS Code extension tests passing
- ✅ Continuous Integration (CI) runs all tests automatically on push/PR
Development
Setup Development Environment
# Install UV if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Sync dependencies (including dev dependencies)
uv sync --dev
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov
Code Quality
- All test functions are limited to 50 lines or less
- All test files are limited to 500 lines or less
- Helper functions are organized as class methods in separate files
- Comprehensive test coverage across all major features
Requirements
- Python 3.8+
- textX >= 3.0.0
- Jinja2 >= 3.1.0
- Click >= 8.1.0
For development:
- pytest >= 7.4.0
- pytest-cov >= 4.1.0
Deployment
Production Readiness
✅ Ready for deployment - The project is production-ready with:
- Comprehensive test suite (111 tests, all passing)
- Well-documented API and CLI interface
- Modular, maintainable codebase
- Complete documentation
- Example ISA specifications
- Validation and error handling
Installation for Production
# Using UV (recommended)
uv sync
# Or using pip
pip install -r requirements.txt
pip install -e .
Building Distribution Packages
# Build wheel and source distribution
python -m build
# Or using UV
uv build
License
MIT License
Contributing
Contributions are welcome! Please ensure that:
- All tests pass (
uv run pytest) - Code follows existing style conventions
- Documentation is updated for new features
- Test functions are kept under 50 lines
- Test files are kept under 500 lines
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isa_dsl-0.1.2.tar.gz.
File metadata
- Download URL: isa_dsl-0.1.2.tar.gz
- Upload date:
- Size: 160.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac87264a5daea4ba4ade4f56d3d1a25e36923b8f671802b8f584dbdea3f7d67
|
|
| MD5 |
7a46b219e2f8d763a5c811bfb4d380ea
|
|
| BLAKE2b-256 |
aa5cae35d8a1d1c05d191e2f6285690c2b1095d18f84b64756e93b1876dd5097
|
Provenance
The following attestation bundles were made for isa_dsl-0.1.2.tar.gz:
Publisher:
publish-to-pypi.yml on ajithpadman/isadsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
isa_dsl-0.1.2.tar.gz -
Subject digest:
2ac87264a5daea4ba4ade4f56d3d1a25e36923b8f671802b8f584dbdea3f7d67 - Sigstore transparency entry: 798328526
- Sigstore integration time:
-
Permalink:
ajithpadman/isadsl@62908409035251d7aa7156f1c96db7b80afce3aa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ajithpadman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@62908409035251d7aa7156f1c96db7b80afce3aa -
Trigger Event:
release
-
Statement type:
File details
Details for the file isa_dsl-0.1.2-py3-none-any.whl.
File metadata
- Download URL: isa_dsl-0.1.2-py3-none-any.whl
- Upload date:
- Size: 59.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a2f7972f698489e106d9d4ade18ea5a4cec68680ed973fc5a8364a05bda4c90
|
|
| MD5 |
decdd6e721fe92f8a78d6b5f8966db3f
|
|
| BLAKE2b-256 |
a0b700ef3e93605e8d3177d474ed6a7feadc882383fc0c513a82fe8691076efd
|
Provenance
The following attestation bundles were made for isa_dsl-0.1.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on ajithpadman/isadsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
isa_dsl-0.1.2-py3-none-any.whl -
Subject digest:
6a2f7972f698489e106d9d4ade18ea5a4cec68680ed973fc5a8364a05bda4c90 - Sigstore transparency entry: 798328528
- Sigstore integration time:
-
Permalink:
ajithpadman/isadsl@62908409035251d7aa7156f1c96db7b80afce3aa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ajithpadman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@62908409035251d7aa7156f1c96db7b80afce3aa -
Trigger Event:
release
-
Statement type: