Skip to main content

Language Overview

SHDL (Simple Hardware Description Language) is a minimalist hardware description language designed for clarity and ease of use.

This is the Language Reference

This section documents SHDL - the language syntax and semantics. For information on using the PySHDL Python library to compile and simulate circuits, see Using PySHDL.

Basic Structure

Every SHDL file contains one or more component definitions:

component ComponentName(inputs) -> (outputs) {
# Instances and constants

connect {
# Connections
}
}

Design Philosophy

  • Simplicity: Minimal syntax, maximum clarity
  • Hierarchy: Build complex circuits from simple building blocks
  • Explicitness: All connections are explicitly declared
  • 1-based Indexing: All bit indices start at 1 (LSB = 1)

Key Concepts

ConceptDescription
ComponentsReusable circuit modules with inputs and outputs
InstancesConcrete occurrences of components
SignalsWires that carry digital values
ConnectionsHow signals flow between ports and instances
GeneratorsLoop-like constructs for repetitive patterns
ConstantsFixed bit patterns for use in circuits

Reserved Keywords

KeywordPurpose
componentDeclares a new component
useImports components from modules
connectBegins the connection block

Primitive Gates

Built-in gates available without imports:

GateInputsOutputFunction
ANDA, BOO = A ∧ B
ORA, BOO = A ∨ B
NOTAOO = ¬A
XORA, BOO = A ⊕ B
NANDA, BOO = ¬(A ∧ B)
NORA, BOO = ¬(A ∨ B)

What's Next?

Explore each aspect of the language in detail: