https://github.com/conneroisu/gohard
design hardware with golang. (WIP)
https://github.com/conneroisu/gohard
formatter hdl language-server language-server-protocol lexer lexer-parser lsp parser vhdl
Last synced: 7 months ago
JSON representation
design hardware with golang. (WIP)
- Host: GitHub
- URL: https://github.com/conneroisu/gohard
- Owner: conneroisu
- License: mit
- Created: 2024-06-06T13:30:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T12:01:57.000Z (about 1 year ago)
- Last Synced: 2025-04-04T13:22:02.718Z (about 1 year ago)
- Topics: formatter, hdl, language-server, language-server-protocol, lexer, lexer-parser, lsp, parser, vhdl
- Language: Go
- Homepage: https://conneroisu.github.io/gohard/
- Size: 2.15 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# gohard
Design hardware with golang. (WIP)
[](https://github.com/conneroisu/gohard/actions/workflows/github-code-scanning/codeql)
[](https://github.com/conneroisu/gohard/actions/workflows/dependabot/dependabot-updates)
[](https://github.com/conneroisu/gohard/actions/workflows/flake-actions.yml)
[](https://github.com/conneroisu/gohard/actions/workflows/lint.yml)
[](https://codecov.io/gh/conneroisu/gohard)
[](https://github.com/conneroisu/gohard/releases/)
## Introduction
**gohard** is a modern VHDL development toolkit built in Go that provides formatting, linting, and Language Server Protocol (LSP) support for VHDL hardware description language files.
### Key Features
- **🎨 Intelligent Formatting** - Automatically format VHDL code with consistent style
- **🔍 Advanced Linting** - Catch common issues and enforce best practices
- **🚀 Language Server** - Full LSP support for modern editors (VS Code, Neovim, etc.)
- **⚙️ Project Configuration** - Flexible YAML-based configuration
- **📦 Nix Integration** - Reproducible development environments
## Quick Start
### Installation
Using Nix Flakes:
```bash
# Install globally
nix profile install github:conneroisu/gohard
# Or run directly
nix run github:conneroisu/gohard -- --help
```
### Basic Usage
```bash
# Initialize a new project
gohard init
# Format VHDL files
gohard fmt file.vhd
gohard fmt -w ./... # Format all files recursively
# Lint for best practices
gohard lint src/
# Start LSP server for editor integration
gohard lsp
```
## Demo Videos
We provide interactive terminal recordings showcasing gohard's capabilities. These are built using [VHS.nix](https://github.com/conneroisu/vhs.nix) for reproducible, declarative demos.
### Available Demos
#### Main Demos
| Demo | Purpose | Build Command | Description |
|------|---------|---------------|-------------|
| **Quick Demo** | Social media, quick overview | `nix build .#vhs-gohard-quick` | 30-second overview of core features |
| **Comprehensive** | Documentation, complete guide | `nix build .#vhs-gohard-comprehensive` | Full feature walkthrough with examples |
| **Tutorial** | Learning, step-by-step | `nix build .#vhs-gohard-tutorial` | Educational guide for new users |
| **Presentation** | Conferences, talks | `nix build .#vhs-gohard-presentation` | High-quality demo for presentations |
#### Help Command Demos
| Demo | Build Command | Description |
|------|---------------|-------------|
| **Help Overview** | `nix build .#vhs-help-demo` | General help and command overview |
| **Format Help** | `nix build .#vhs-help-fmt` | Formatting command options |
| **Lint Help** | `nix build .#vhs-help-lint` | Linting command options |
| **LSP Help** | `nix build .#vhs-help-lsp` | Language server options |
#### Formatting Demos
| Demo | Build Command | Description |
|------|---------------|-------------|
| **Single File** | `nix build .#vhs-fmt-file` | Format individual VHDL files |
| **Directory** | `nix build .#vhs-fmt-dir` | Format all files in a directory |
| **Recursive** | `nix build .#vhs-fmt-recur` | Recursive formatting with `./...` |
| **Stdin** | `nix build .#vhs-fmt-stdin` | Format from standard input |
#### Linting Demos
| Demo | Build Command | Description |
|------|---------------|-------------|
| **Single File** | `nix build .#vhs-lint-file` | Lint individual VHDL files |
| **Directory** | `nix build .#vhs-lint-dir` | Lint all files in a directory |
| **Recursive** | `nix build .#vhs-lint-recur` | Recursive linting with `./...` |
### Building Demos
```bash
# Build all demos
nix build .#vhs-gohard-quick .#vhs-gohard-comprehensive .#vhs-gohard-tutorial .#vhs-gohard-presentation
# View a specific demo
nix build .#vhs-gohard-quick && ls -la result/
```
The demos showcase:
- Project initialization with `gohard init`
- Formatting messy VHDL code with `gohard fmt`
- Linting for best practices with `gohard lint`
- LSP server setup for editor integration
### Build Notes
- **Build Time**: Demo recordings may take 2-5 minutes to build as they execute actual commands
- **Platform**: VHS recordings work best on Linux systems with X11/Wayland support
- **Caching**: Built demos are cached in the Nix store for faster subsequent access
#### Troubleshooting
If demo builds fail:
```bash
# Check specific demo build logs
nix log .#vhs-gohard-quick
# Test gohard package builds separately
nix build .#gohard
# Use flake check to validate all outputs
nix flake check
```
## VHDL Best Practices (Enforced by gohard)
- No "Component" in entity name
- Using "'event" with a non-clock signal
- Counters in non-clocked processes
- Do not initialize signals with ':=' (compiles to determinate unit based on tooling)
- having extra signals in the sensitively list (makes sim slower and signals to readers of the code that it could be used)
## Development
### Linting
The project uses [golangci-lint](https://github.com/golangci/golangci-lint) for code quality checks with a comprehensive set of linters. To run the linter:
```bash
# With Nix
nix develop -c lint
# Directly with golangci-lint
golangci-lint run
```
### Documentation
[](https://conneroisu.github.io/gohard/)