Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Latest commit

Β 

History

History
108 lines (74 loc) Β· 3.73 KB

File metadata and controls

108 lines (74 loc) Β· 3.73 KB

ProtDSL

Status: Archived Educational Project DSL Research

ProtDSL is an educational sandbox project focused on creating a Domain-Specific Language (DSL) for describing Instruction Set Architecture (ISA) specifications. This prototype demonstrates a Ruby-based DSL for defining computer architectures.

πŸ“ Note: This repository is archived

The code represents a minimal prototype and is preserved for educational purposes.

πŸ—οΈ Project Structure

ProtDSL/
β”œβ”€β”€ Generic/                # Base constructs and core DSL infrastructure
β”‚   β”œβ”€β”€ base.rb             # Fundamental base classes and utilities
β”‚   β”œβ”€β”€ builder.rb          # DSL builder pattern implementation
β”‚   β”œβ”€β”€ scope.rb            # Scope management for symbol resolution
β”‚   └── var.rb              # Variable and operand definitions
β”œβ”€β”€ Target/                 # Target architecture implementations
β”‚   └── RISC-V/             # RISC-V architecture support
β”‚       β”œβ”€β”€ 32I.rb          # RV32I base instruction set definition
β”‚       β”œβ”€β”€ encoding.rb     # Instruction encoding schemes
β”‚       └── regfile.rb      # Register file configuration
└── main.rb                 # Main entry point and examples

🎯 Project Scope

This prototype implements a minimal DSL for ISA description with:

  • Core DSL Framework (Generic/): Reusable components for building architecture descriptions
  • RISC-V RV32I Target (Target/RISC-V/): Partial implementation supporting only two instructions (ADD, SUB)

πŸ› οΈ Implementation Details

Core Components

  • Generic/base.rb: Foundation classes for the DSL
  • Generic/builder.rb: Builder pattern for fluent DSL syntax
  • Generic/scope.rb: Symbol table and scope management
  • Generic/var.rb: Operand and variable definitions

RISC-V Implementation

  • Target/RISC-V/32I.rb: RV32I instruction set definitions
  • Target/RISC-V/encoding.rb: Instruction encoding patterns
  • Target/RISC-V/regfile.rb: Register file specification

Supported Instructions

  • ADD - Integer addition
  • SUB - Integer subtraction

πŸš€ Getting Started

Note: This is a prototype for educational purposes only.

To explore the codebase:

git clone https://github.com/ProteusLab/ProtDSL.git
cd ProtDSL

ruby main.rb

Example Usage

The DSL allows defining instructions in a structured format:

Instruction(:ADD, XReg(:rd), XReg(:rs1), XReg(:rs2)) {
    encoding *format_r_alu(:add, rd, rs1, rs2)
    asm { "ADD #{rd}, #{rs1}, #{rs2}" }
    code { rd[]= rs1 + rs2 }
}

πŸ“š Educational Value

This sandbox project demonstrates:

  • DSL Design Patterns: Builder pattern, fluent interfaces
  • Computer Architecture: Instruction encoding, register files, ISA specification
  • Ruby Metaprogramming: Dynamic class creation, method_missing, DSL implementation techniques

πŸ”¬ Limitations

As an educational prototype:

  • Only supports 2 RISC-V instructions (ADD, SUB)
  • RV32I implementation is incomplete
  • No code generation or simulation capabilities
  • Minimal error handling and validation

🀝 Contributing

This repository is archived and not accepting contributions. It remains public as a reference for educational purposes.

πŸ“„ License

This educational project is provided under the Apache License 2.0.


Educational Purpose: This prototype demonstrates DSL design concepts for computer architecture description. The implementation is minimal and intended for learning rather than production use.