All Projects → bogdanvuk → pygears

bogdanvuk / pygears

Licence: MIT license
HW Design: A Functional Approach

Programming Languages

python
139335 projects - #7 most used programming language
Verilog
626 projects
Jinja
831 projects
SystemVerilog
227 projects
c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to pygears

icebreaker-amaranth-examples
This repository contains iCEBreaker examples for Amaranth HDL.
Stars: ✭ 26 (-78.69%)
Mutual labels:  fpga, hardware, hdl
gateware-ts
Hardware definition library and environment for designing and building digital hardware for FPGAs, using only open source tools
Stars: ✭ 83 (-31.97%)
Mutual labels:  fpga, hardware, hdl
xeda
Cross EDA Abstraction and Automation
Stars: ✭ 25 (-79.51%)
Mutual labels:  fpga, hardware, hdl
DFiant
DFiant: A Dataflow Hardware Descripition Language
Stars: ✭ 21 (-82.79%)
Mutual labels:  asic, fpga, hdl
VGChips
Video Game custom chips reverse-engineered from silicon
Stars: ✭ 86 (-29.51%)
Mutual labels:  asic, fpga, hdl
Tenyr
Simple, orthogonal 32-bit computer architecture and environment
Stars: ✭ 24 (-80.33%)
Mutual labels:  simulator, fpga, hardware
Axi
AXI SystemVerilog synthesizable IP modules and verification infrastructure for high-performance on-chip communication
Stars: ✭ 227 (+86.07%)
Mutual labels:  asic, fpga, hardware
awesome-hwd-tools
A curated list of awesome open source hardware design tools
Stars: ✭ 42 (-65.57%)
Mutual labels:  asic, fpga, hardware
tapasco
The Task Parallel System Composer (TaPaSCo)
Stars: ✭ 66 (-45.9%)
Mutual labels:  fpga, hardware
riscv-cores-list
RISC-V Cores, SoC platforms and SoCs
Stars: ✭ 651 (+433.61%)
Mutual labels:  asic, fpga
virtio
Virtio implementation in SystemVerilog
Stars: ✭ 38 (-68.85%)
Mutual labels:  fpga, hdl
shdl6800
shdl6800: A 6800 processor written in SpinalHDL
Stars: ✭ 22 (-81.97%)
Mutual labels:  fpga, hdl
DomesdayDuplicator
High-speed LaserDisc RF sampler
Stars: ✭ 39 (-68.03%)
Mutual labels:  fpga, hardware
arv
ARV: Asynchronous RISC-V Go High-level Functional Model
Stars: ✭ 18 (-85.25%)
Mutual labels:  hardware, hdl
basic-ecp5-pcb
Reference design for Lattice ECP5 FPGA. Featuring Raspberry Pi interface and 6 PMODs
Stars: ✭ 71 (-41.8%)
Mutual labels:  fpga, hardware
sphinxcontrib-hdl-diagrams
Sphinx Extension which generates various types of diagrams from Verilog code.
Stars: ✭ 37 (-69.67%)
Mutual labels:  fpga, hdl
async fifo
A dual clock asynchronous FIFO written in verilog, tested with Icarus Verilog
Stars: ✭ 117 (-4.1%)
Mutual labels:  fpga, hdl
community
ROS 2 Hardware Acceleration Working Group community governance model & list of projects
Stars: ✭ 34 (-72.13%)
Mutual labels:  fpga, hardware
clash-spaceinvaders
Intel 8080-based Space Invaders arcade machine implemented on an FPGA, written in CLaSH
Stars: ✭ 45 (-63.11%)
Mutual labels:  fpga, hardware
KRS
The Kria Robotics Stack (KRS) is a ROS 2 superset for industry, an integrated set of robot libraries and utilities to accelerate the development, maintenance and commercialization of industrial-grade robotic solutions while using adaptive computing.
Stars: ✭ 26 (-78.69%)
Mutual labels:  fpga, hardware

Welcome to PyGears

HW Design: A Functional Approach

PyGears is a free framework that lets you design hardware using high-level Python constructs and compile it to synthesizable SystemVerilog or Verilog code. There is a built-in simulator that lets you use arbitrary Python code with its vast set of libraries to verify your hardware modules. PyGears makes connecting modules easy, and has built-in synchronization mechanisms that help you build correct parallel systems.

@gear
def echo(samples: Fixp, *, feedback_gain, sample_rate, delay):

    sample_dly_len = round(sample_rate * delay)
    fifo_depth = ceil_pow2(sample_dly_len)
    feedback_gain_fixp = samples.dtype(feedback_gain)

    dout = Intf(samples.dtype)

    feedback = decouple(dout, depth=fifo_depth) \
        | prefill(dtype=samples.dtype, num=sample_dly_len)

    feedback_attenuated = (feedback * feedback_gain_fixp) \
        | samples.dtype

    dout |= (samples + feedback_attenuated) | samples.dtype

    return dout

Python functions model hardware modules, where function arguments represent module inputs and parameters. Example echo module has a single input port called samples where data of arbitrary signed fixed-point type Fixp can be received. Other three parameters feedback_gain, sample_rate and delay are compile time parameters.

@gear
def echo(samples: Fixp, *, feedback_gain, sample_rate, delay):
    ...

Arbitrary Python code can be used in modules at compile time, for an example to transform input parameters:

sample_dly_len = round(sample_rate * delay)
fifo_depth = ceil_pow2(sample_dly_len)
feedback_gain_fixp = samples.dtype(feedback_gain)

Rest of the echo function code describes the hardware module for applying echo audio effect to the input stream.

images/echo.png

Modules are instantiated using function calls: decouple(dout, depth=fifo_depth), which return module output interfaces that can in turn be passed as arguments to other module functions in order to make a connection between the modules. For conveniance the pipe "|" operator can be used to pass output of one function as argument to the next one. This was used to connect the output of decouple to prefill ("\" is used just to split the line visually):

feedback = decouple(dout, depth=fifo_depth) \
    | prefill(dtype=samples.dtype, num=sample_dly_len)

Again, the echo function returns its output interfaces which is then used to establish the connection with the next module that received the echo output stream:

@gear
def echo(...):
    ...
    return dout

Built-in simulator makes it easy to test and verify the modules while drawing power from the Python vast ecosystem of libraries. For an example, use Python built-in audioop library to read WAV files into an input samples stream for the echo module, and then visualise the input and output waveforms using matplotlib:

images/echo_plot.png

Speedup the simulation by configuring PyGears simulator to use open-source Verilator to simulate hardware modules, or some of the proprietary simulators like Questa, NCSim or Xsim. Implement any part of the system in a standard HDL and debug your design by inspecting the waveforms for an example in open-source wave viewer GTKWave

images/echo_vcd.png

Checkout Echo example description for more in depth information about the echo example.

Installation instructions

Install PyGears package with the Python package manager. On Linux distributions, depending on how your Python was installed you might get an error and need to prefix the command with sudo:

pip3 install pygears

For more detailed installation instructions (including how to install additional software) checkout Installation page.

Read the documentation

PyGears documentation

Checkout the examples

Library of standard modules

Echo: Hardware module that applies echo audio effect to a continuous audio stream.

RISC-V processor: PyGears implementation. Checkout also the RISC-V implementation blog series.

Tests: Contain many examples on how individual PyGears components operate

Contributions

Special thanks to the people that helped develop this framework:

  • Andrea Erdeljan
  • Damjan Rakanović
  • Nemanja Kajtez
  • Risto Pejašinović
  • Stefan Tambur
  • Vladimir Nikić
  • Vladimir Vrbaški

In order to contribute, pull your copy from github repository and create a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].