• Stars
    star
    111
  • Rank 314,510 (Top 7 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

VHDL to Discrete Logic on PCB Flow

PCBFlow

Highly experimental set of scripts and a placement tool written in Python that transform a digital circuit described in a hardware description language (VHDL or Verilog) into a discrete transistor circuit on a PCB (Disclaimer: I don't know what I am doing). To be regarded as proof-of-concept.

Makes use of:

  • GHDL
  • Yosys with GHDL plugin
  • ABC (Integrated in Yosys)
  • GTKView
  • NGspice
  • Python3 (Packages: lxml, pandas)
  • PCBPlace - my own placement tool written in Python
  • Freerouting (Optional)
  • Eagle (Optional)
  • EasyEDA (Optional)

Should work in a Linux shell. I am currently using WSL2.

For details see Project logs on HaD.io

Flow Architecture

Flow Architecture

The diagram above shows how the individual steps of the flow are connected. The starting point is the design (A VHDL source file) in the blue file box. In subsequent steps, this design will be transformed by various tools into new intermediate representations (grey). To aid this, technology description files and testbenches are needed (orange). The output at the end of the flow are the three green files, which describe the PCB layout (Gerber), the part list (BOM) and where the parts have to be placed on the PCB (Pick & Place).

At the core of the flow is PCBPlace.py, which is a placement and footprint generation tool written in Python. The remaining steps are covered by existing Open-Source or freely accessible Tools.

Right now, everything is based on shell scripts that have to be invoked manually. The numbers in the process boxes indicate the number of the script that performs this step. Scripts ending on zero (10,20,30) are mandatory steps for the flow, scripts ending on other digits are optional, e.g. for intermediate simulation.

The technology description files and additional data reside in subfolders 10_HDL, 20_SYNTH, 30_PLACE. 10_HDL also holds the design files. All intermediate and output files are stored in the Work folder. It can be cleaned by calling the "clean_all.sh" script.

The output of the automated part of the flow is an unrouted PCB. Routing and design file generation has to be invoked manually with the indicated tools. Please be aware that the placement tool is in a very early experimental stage. Constants in the code may have to be tuned for better results depending on input design.

Examples

The image below shows a basic example, implementing a full adder and an AND gate, going from source code via intermediate representations to the final 3D rendered PCB.

Example

As a more complex example, you can see the synthesized MCPU below. The design consists of 771 transistors and twice as many resistors. Routing was performed with Freerouting. In the current state there is no optimization of power grid or insertion of decoupling capacitances, most likely severely limiting the speed of such a large design.

MCPU

Usage

Most tools needed to implement this toolchain can be found in the OSS CAD Suite, including Yosys with GHDL plugin. The nightly builds should work out-of-the-box under WSL2 and native Linux. No installation is required, other than invoking the environment with source environment in the folder where you unpacked the archive.

Viewing graphical output of NgSpice or GTKWave under Windows in WSL2 requires an XServer. I am using VcXsrv.

See screenshot below for an example of how to invoke the OSS CAD Suite, synthesize the counter example and execute placement. The resulting files can be found in the "Work" folder. Please keep in mind that the toolchain is still highly experimental, right now the placement tool is controlled by variables defined within PCBPlace.py

Invoke Environment and Run Synthesis

Synthesis

Install missing Python Packages (optional)

python

Run Placement

placement

More Repositories

1

light_ws2812

Light weight library to control WS2811/WS2812 based LEDS and LED Strings for 8-Bit AVR microcontrollers.
C
949
star
2

BitNetMCU

Neural Networks with low bit weights on low end 32 bit microcontrollers such as the CH32V003 RISC-V Microcontroller and others
C
226
star
3

MCPU

MCPU - A Minimal 8Bit CPU in a 32 Macrocell CPLD
C
210
star
4

RealCandle

Analysis of the flicker pattern of a real candle
MATLAB
91
star
5

Nanite

Nano-Sized ATtiny85 devboard with USB Bootloader
C
89
star
6

CandleLEDhack

Candle LED reverse engineering and emulation
C
75
star
7

TinyTouchLib

ANSI-C Library for touch-button input on ATtiny AVR microcontrollers with integrated ADC
C
75
star
8

SimPad

Work towards an open source programmer for Padauk MCUs
C
70
star
9

u-wire

Smallest possible USB compliant device with V-USB
C
68
star
10

MisguidedAttention

A collection of prompts to challenge the reasoning abilities of large language models in presence of misguiding information
59
star
11

uTFT-ST7735

Small memory footprint library to control ST7735 TFT Displays
C
43
star
12

TinyTouchButton

A touch controlled light with 4xWS2812 RGB LEDs and ATtiny 10
C
34
star
13

BitNetPDK

A proof-of-concept (hack) to implement neural network inference on a very tiny 8-bit microcontroller.
C
34
star
14

USBasp-t

USBasp for ATtiny85
Assembly
33
star
15

Dice10

Tiny electronic dice based on ATtiny10
C
21
star
16

LPC812breakout

Breakout Board for the LPC812 MCU
Prolog
17
star
17

Gluon

A size optimized bootloader and software library for the AVR ATtiny
C
17
star
18

Gen2-Addressable-RGB

Analysis of the Gen2 Addressable RGB protocol
C
14
star
19

tinytapeout_mcpu5

8 bit CPU optimized for the constraints of tinytapeout
C
10
star
20

Addressable_7-Segment

Addressable 7 Segment Display based on the Padauk PFS154 Microcontroller
C
4
star
21

LLM_HDL_Design

Some hardware design experiments using large language models
Python
2
star
22

LatentSpaceExplorer

Latent Space Explorer for Variational Autoencoders (VAE)
TypeScript
1
star
23

MLpapers

Collection of useful ML papers
Python
1
star