Skip to content

cyril0124/verilua

Repository files navigation

Verilua
Verilua

GitHub Actions Workflow Status GitHub Release GitHub commits since latest release GitHub Created At Static Badge Static Badge

🔧 Introduction

Verilua is a versatile simulation framework for Hardware Verification based on LuaJIT. It can be used as a Hardwave Verification Language (HVL) to write testbenches and simulate hardware designs. Or it can be used as a Hardware Script Engine (HSE) to embed Lua scripts into the simulation. It can also can be used as a Waveform Analysis Language(WAL) to analyze the provided waveform files(VCD, FST, FSDB, etc).

🚀 Getting Started

To get started with Verilua, visit our documentation website for comprehensive installation guides, tutorials, API references, and examples. You can also try the guided tour for a hands-on introduction.

📁 Project Structure

verilua/
├── docs/                    # Documentation files (MDX format)
├── docs-website/            # Docusaurus documentation website
├── src/                     # Main source code
│   ├── lua/verilua/         # Lua code entry point
│   ├── testbench_gen/       # Testbench auto-generation tool
│   ├── verilator/           # Verilator simulator main files
│   ├── wave_vpi/            # Waveform simulation backend
│   ├── nosim/               # No-simulation backend for analysis
│   ├── signal_db_gen/       # SignalDB generator
│   ├── dummy_vpi/           # VPI to DPI converter for HSE performance
│   ├── dpi_exporter/        # DPI exporter for signal access
│   ├── cov_exporter/        # Coverage exporter
│   └── include/             # Some common header files
├── libverilua/              # Core VPI implementation (Rust)
├── tests/                   # Test cases (also serves as examples for Verilua API usage)
├── examples/                # Example projects
├── scripts/                 # Build scripts and utility scripts
│   ├── .xmake/              # Xmake build rules and toolchains for various simulators
├── tools/                   # Compiled tool binaries and hardware simulator wrappers for Verilua integration
├── xmake.lua                # Top-level xmake build script
└── DEVELOPMENT.md           # Development guidelines

💡 Why Lua/LuaJIT?

  • 🚀 High Performance: LuaJIT, a Just-In-Time Compiler, transforms Lua code into native machine code, delivering exceptional speed and efficiency.
  • Lightweight & Fast: Lua boasts a minimal runtime and near-instant startup time, outpacing other dynamic languages like Python.
  • 💫 Seamless C Integration: LuaJIT's Foreign Function Interface (FFI) enables efficient calls to C functions and libraries, and even supports calling Rust code, simplifying integration with native code.
  • 👍 Enhanced Development: While Lua is dynamically typed, tools like LuaLS and EmmyLuaLs introduce a comment-based type system, significantly improving code clarity and developer experience.

🌟 Credits

  • LuaJIT - A high-performance Lua implementation powering Verilua's speed and efficiency.
  • Cocotb - A source of inspiration for Verilua's design and functionality.
  • Slang - A robust parser for Verilog/SystemVerilog files, integral to many tools in this repository.
  • Xmake - The foundation of our streamlined and efficient build system.