PyHCL is a hardware construct language like Chisel but more lightweight and more relaxed to use.
As a novel hardware construction framework embedded in Python, PyHCL supports several useful features include object-oriented, functional programming,
and dynamically typed objects.
The goal of PyHCL is providing a complete design and verification tool flow for heterogeneous computing systems flexibly using the same design methodology.
PyHCL is powered by FIRRTL, an intermediate representation for digital circuit design.
PyHCL-generated circuits can be compiled to the widely-used HDL Verilog.
Attention: The back end of the compilation is highly experimental.
Getting Started
Writing A Full Adder
PyHCL defines modules using only simple Python syntax that looks like this:
from pyhcl import *
class FullAdder(Module):
io = IO(
a=Input(Bool),
b=Input(Bool),
cin=Input(Bool),
sum=Output(Bool),
cout=Output(Bool),
)
# Generate the sum
io.sum @= io.a ^ io.b ^ io.cin
# Generate the carry
io.cout @= io.a & io.b | io.b & io.cin | io.a & io.cin
PyHCL
PyHCL is a hardware construct language like Chisel but more lightweight and more relaxed to use. As a novel hardware construction framework embedded in Python, PyHCL supports several useful features include object-oriented, functional programming, and dynamically typed objects.
The goal of PyHCL is providing a complete design and verification tool flow for heterogeneous computing systems flexibly using the same design methodology.
PyHCL is powered by FIRRTL, an intermediate representation for digital circuit design.
PyHCL-generated circuits can be compiled to the widely-used HDL Verilog.
Attention: The back end of the compilation is highly experimental.
Getting Started
Writing A Full Adder
PyHCL defines modules using only simple Python syntax that looks like this:
Compiling To High FIRRTL
Compiling module by calling
compile_to_highform:Will generate the following FIRRTL codes:
Compiling To Lowered FIRRTL
Compiling module by calling
compile_to_lowform:Will generate the following FIRRTL codes:
Compiling To Verilog
Compiling module by calling
compile_to_verilog:Then
FullAdder.vwill be generated:Features
UInt,SInt,Vector,Bundle,Clock,Memory, and casual combination between them.UInts,SInts,Vectors andBundles.TODO