An open API service indexing awesome lists of open source software.

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)

Awesome Lists containing this project

README

          

# gohard

Design hardware with golang. (WIP)

[![CodeQL](https://github.com/conneroisu/gohard/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/conneroisu/gohard/actions/workflows/github-code-scanning/codeql)
[![Dependabot Updates](https://github.com/conneroisu/gohard/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/conneroisu/gohard/actions/workflows/dependabot/dependabot-updates)
[![Nix Flake actions](https://github.com/conneroisu/gohard/actions/workflows/flake-actions.yml/badge.svg)](https://github.com/conneroisu/gohard/actions/workflows/flake-actions.yml)
[![Lint](https://github.com/conneroisu/gohard/actions/workflows/lint.yml/badge.svg)](https://github.com/conneroisu/gohard/actions/workflows/lint.yml)

[![Codecov](https://codecov.io/gh/conneroisu/gohard/graph/badge.svg?token=X3CZM7GKQK)](https://codecov.io/gh/conneroisu/gohard)
[![GitHub tag](https://img.shields.io/github/tag/conneroisu/gohard?include_prereleases=&sort=semver&color=violet)](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

[![View site - GH Pages](https://img.shields.io/badge/View_site-GH_Pages-2ea44f?style=for-the-badge)](https://conneroisu.github.io/gohard/)