Skip to content
Proyek

Tentang

PypelineC: bahasa deskripsi perangkat keras (HDL) yang menambahkan pipeline otomatis seperti sintesis tingkat tinggi (HLS) sebagai konstruksi bahasa dan fitur compiler.

Bahasa pemrograman dan runtime

Cara angka ini diukur

755 bintang65 Fork +1 dalam 24 jam

Pertumbuhan bintang terukur

dalam 24 jam
+1
dalam 7 hari
+1
dalam 15 hari
0
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli
██████╗ ██╗   ██╗██████╗ ███████╗██╗     ██╗███╗   ██╗███████╗ ██████╗
██╔══██╗╚██╗ ██╔╝██╔══██╗██╔════╝██║     ██║████╗  ██║██╔════╝██╔════╝
██████╔╝ ╚████╔╝ ██████╔╝█████╗  ██║     ██║██╔██╗ ██║█████╗  ██║     
██╔═══╝   ╚██╔╝  ██╔═══╝ ██╔══╝  ██║     ██║██║╚██╗██║██╔══╝  ██║     
██║        ██║   ██║     ███████╗███████╗██║██║ ╚████║███████╗╚██████╗
╚═╝        ╚═╝   ╚═╝     ╚══════╝╚══════╝╚═╝╚═╝  ╚═══╝╚══════╝ ╚═════╝

Painted PypelineC

What is PypelineC?

A hardware description language (HDL) adding high level synthesis(HLS)-like automatic pipelining as a language construct/compiler feature. The goal is a portable HDL: one design you can take between FPGA and ASIC targets and clock rates without re-implementing it to meet timing.

If a computation can be written as a pure function without side effects (i.e. no registers/static variables) then it can be auto-pipelined. Conceptually similar to technologies like Intel's variable latency Hyper-Pipelining and Xilinx's retiming options. Sharing some of the compiler driven pipelining design goals of Google's XLS Project, the DFiantHDL language, and certain CIRCT dialects as well.

PypelineC consists of Pypeline (new, Python based) and PipelineC (legacy, C based). Pypeline is a work in progress in becoming feature complete with PipelineC, but already has many new features that PipelineC lacks.

Show me what you got. Be inspired by some awesome PypelineC projects others have done, see the showcase. Reach out to have your project added.

Example code for blinking an LED:

Pypeline (examples/pypeline/blink.py) PipelineC (examples/blink.c)
# 'Called'/'Executing' every 40ns (25MHz)
@MAIN(25.0)
def blink() -> uint1_t:
    # 25000000 iterations * 40ns each = 1 sec
    counter: Reg[uint32_t] = 0

    # LED on/off state
    led: Reg[uint1_t] = 0

    # If reached 1 second
    if counter == (25000000 - 1):
        led = ~led  # Toggle led
        counter = 0  # Reset counter
    else:
        counter += 1 # one 40ns increment

    return led
// 'Called'/'Executing' every 40ns (25MHz)
#pragma MAIN_MHZ blink 25.0
uint1_t blink()
{
  // 25000000 iterations * 40ns each = 1sec
  static uint25_t counter = 0;

  // LED on off state
  static uint1_t led = 0;

  // If reached 1 second
  if(counter==(25000000-1))
  {
    // Toggle led
    led = !led;
    // Reset counter
    counter = 0;
  }
  else
  {
    counter += 1; // one 40ns increment
  }
  return led;
}
Pypeline PipelineC
Getting started /docs directory GitHub wiki
Easy to understand software-like syntax Yes Yes
Timing feedback from synthesis+pnr tools Yes Yes
Automatic pipelining of comb. logic Yes Yes
Dev board specific support packages Yes Yes
VHDL Output Yes (human readable) Yes (human readable)
VHDL based existing module import Yes Yes
Verilog Output Yes (machine converted) Yes (machine converted)
Verilog based existing module import No No
Traditional HDL simulator support Yes Yes
Native Simulation Yes No
Waveforms (VCD/FST) from native simulation, with named signals (New) Yes No
Valid-Ready handshaking Yes Yes
Globally visible point to point wires Yes Yes
Multiple clock domains / Clock domain crossings Yes Yes
Synchronous resets of registers, pipelines and library blocks Yes No (manual reset logic)
Parameterized/Template Functions+Types Yes No
Operator overloading Yes Yes (hacky)
User-visible automatic pipeline latency Yes No
Multi-cycle path constraints Yes Yes
Automatic multi-cycle path tuning (New) Yes No
Combinational area / delay optimization (New, experimental) Yes No
Automatic resource-shared state machines (New, experimental) Yes No
Single-cycle RISC-V CPU RV32I with machine-mode traps, memory-mapped devices, a UART console, and exportable firmware Macro cores with a separate firmware build
SoC system bus helpers No Yes
Design diagram webpage (files, MAINs, wires, call hierarchy) (New) Yes Yes (whole wires)
Generates software Helper Code Yes Yes
match statements on enums (New) Yes No (switch, #76)
Derived FSM style code No Yes
Documentation Comprehensive, planned Ad-hoc, organic
Compiler tests Many, Automated Limited, Hand-run

Tools:

Currently Supported Tools (Linux only):
Synthesis: 
  Xilinx Vivado, 
  OpenXC7 (Xilinx 7-series: GHDL+Yosys+nextpnr-xilinx+Project X-Ray),
  Intel Quartus, 
  Lattice Diamond, 
  GHDL+Yosys+nextpnr (ECP5/iCE40),
  Gowin EDA, 
  Efinix Efinity,
  Cologne Chip Toolchain,
  PyRTL Models,
  sky130 ASIC timing models (GHDL+Yosys+built-in liberty STA)
Simulation: 
  Modelsim, 
  Verilator,
  cocotb,
  CXXRTL, 
  EDAPlayground

PypelineC Tool Flow

Why Pypeline?

A portable HDL. Moving a traditional RTL design to a new FPGA, an ASIC process, or a higher clock rate usually means re-implementing parts of it just to meet timing: adding or moving pipeline stages, re-balancing multi-cycle paths, rewriting state machines. PypelineC keeps that work in the compiler instead. You write the logic once as pure functions, and the compiler pipelines them for each target, using timing feedback from that target's synthesis tools. Only the parts that really are clock-by-clock hardware (registers, RAMs, interconnect) are written cycle by cycle, so a design does not need to be rewritten for each new device or operating frequency.

Pypeline describes hardware directly, but replaces much of the ceremony of traditional RTL with compact Python syntax and reusable abstractions:

  • RTL semantics without event-driven boilerplate. A typed function is a hardware module, ordinary locals are combinational wires, and Reg[T] is explicit state. There are no sensitivity lists or separate combinational and clocked process templates to maintain; the execution model states exactly what becomes wiring, a MUX, a register, or a module instance.
  • Reusable, parameterized hardware. Ordinary compile-time Python can create specialized functions and types with factory functions, including width- and type-parameterized structs, arrays, streams, FIFOs, and arithmetic blocks.
  • Interfaces with direction and structure. @interface bundles bidirectional ports, including forward payloads and reverse ready/credit signals, while interface functions can generate reverse-path wiring instead of requiring every signal to be connected by hand.
  • Composition instead of port-map repetition. Calling a hardware function instantiates a module; types and return values carry connections through a hierarchy using normal function composition.
  • A real elaboration language. Compile-time Python supports loops, constants, type introspection, user-defined factories, and custom operators, enabling libraries to express higher-level hardware patterns rather than repeatedly manipulating individual wires.
  • Automation with conventional HDL output. Pure functions can use automatic pipelining and other implementation strategies, with synthesis timing feedback guiding the result. Higher-level parameterization is elaborated before Pypeline emits human-readable VHDL, rather than depending on every downstream tool to implement equivalent HDL language features. A raw VHDL escape hatch for existing IP or vendor-specific primitives keeps the generated design in established FPGA and simulation flows.

Fundamental design elements are state machines/stateful elements(registers, rams, etc), auto-pipelined stateless pure functions, and interconnects (wires,cdc,async fifos,etc).

By isolating complex logic into auto-pipelineable functions, and only writing literal clock by clock hardware description when absolutely necessary, PypelineC designs do not need to be rewritten for each new target device / operating frequency. The hope is to build shared, high performance, device agnostic, hardware designs described in a familiar and powerfully composable software-like look.

For software folks writing PypelineC should feel like solving a programming puzzle - the rules of the puzzle hide/imply hardware concepts. For hardware folks PypelineC is a better hardware description language trying to find middle ground between traditional RTL and HLS. It is my language of choice as an FPGA engineer :).

Jelajahi proyek terkait

Memuat…