VHDL support for open-source FPGA toolchain YoSys

栏目: IT技术 · 发布时间: 5年前

内容简介:NOTE: GHDL must be built with the latest version of GNAT (HINT: The default build prefix isHINT: If ghdl is not available in the PATH, set

ghdlsynth-beta: VHDL synthesis (based on ghdl and yosys )

This is experimental and work in progress!

TODO: explain purpose of program.

  • What is the relationship with GHDL? Is it going to be integrated in GHDL once it is fully featured?
  • What kind of VHDL do we want to support? (GHDL fully supports the 1987, 1993, 2002 versions of the IEEE 1076 VHDL standard, and partially the latest 2008 revision, according to the website)
  • Explain expected input and outputs.
  • Create table with features of VHDL that are supported, WIP and pending.

Build as a module (shared library)

  • Get and install yosys .
  • Get sources, build and install ghdl . Configure ghdl using at least --enable-libghdl and --enable-synth :
$ ./configure --enable-libghdl --enable-synth
$ make
$ make install

NOTE: GHDL must be built with the latest version of GNAT ( gnat-8 ).

HINT: The default build prefix is /usr/local . Sudo permission might be required to install tools there.

  • Get and build ghdlsynth-beta:
make

HINT: If ghdl is not available in the PATH, set GHDL explicitly, e.g.: make GHDL=/my/path/to/ghdl .

The output is a shared library ( ghdl.so on GNU/Linux), which can be used directly:

$ yosys -m ghdl.so

To install the module, the library must be copied to YOSYS_PREFIX/share/yosys/plugins/ghdl.so , where YOSYS_PREFIX is the installation path of yosys. This can be achieved through a make target:

make install

Alternatively, the shared library can be copied/installed along with ghdl:

cp ghdl.so "$GHDL_PREFIX/lib/ghdl_yosys.so"

yosys-config --exec mkdir -p --datdir/plugins
yosys-config --exec ln -s "$GHDL_PREFIX/lib/ghdl_yosys.so" --datdir/plugins/ghdl.so

Build as part of yosys (not recommended)

  • Get and build ghdl as in the previous section.

  • Get yosys sources.

  • Get ghdlsynth-beta and:

    • Patch yosys sources using yosys.diff .
    • Copy src/* to yosys/frontends/ghdl .
    • Configure yosys by adding (to) Makefile.conf :
ENABLE_GHDL := 1
GHDL_DIR := <ghdl install dir>
  • Build and install yosys.

Usage

Example for icestick, using ghdl, yosys, nextpnr and icestorm:

cd examples/icestick/

# Analyse VHDL sources
ghdl -a leds.vhdl
ghdl -a spin1.vhdl

# Synthesize the design.
# NOTE: if ghdl is built as a module, set MODULE to '-m ghdl' or '-m path/to/ghdl.so'
yosys $MODULE -p 'ghdl leds; synth_ice40 --json leds.json'

# P&R
nextpnr-ice40 --package hx1k --pcf leds.pcf --asc leds.asc --json leds.json

# Generate bitstream
icepack leds.asc leds.bin

# Program FPGA
iceprog leds.bin

Alternatively, it is possible to analyze, elaborate and synthesize VHDL sources at once, instead of calling ghdl and yosys in two steps. In this example: yosys $MODULE -p 'ghdl leds.vhdl spin1.vhdl -e leds; synth_ice40 --json leds.json .

Docker

Docker image ghdl/synth:beta includes yosys, and the ghdl module (shared library). These can be used to synthesize designs straightaway. For example:

docker run --rm -t \
  -v $(pwd):/src \
  -w /src \
  ghdl/synth:beta \
  yosys -m ghdl -p 'ghdl icestick/leds.vhdl icestick/blink.vhdl -e leds; synth_ice40 -blif leds.blif'

In a system with docker installed, the image is automatically downloaded the first time invoked.

Furthermore, the snippet above can be extended in order to P&R the design with nextpnr and generate a bitstream with icestorm tools:

DOCKER_CMD="$(command -v winpty) docker run --rm -it -v /$(pwd)://wrk -w //wrk"

$DOCKER_CMD ghdl/synth:beta     yosys -m ghdl -p 'ghdl leds.vhdl rotate4.vhdl -e leds; synth_ice40 -json leds.json'
$DOCKER_CMD ghdl/synth:nextpnr  nextpnr-ice40 --hx1k --json leds.json --pcf leds.pcf --asc leds.asc
$DOCKER_CMD ghdl/synth:icestorm icepack leds.asc leds.bin

iceprog leds.bin

NOTE: on GNU/Linux, it should be possible to use iceprog through ghdl/synth:icestorm . On Windows and macOS, accessing USB/COM ports of the host from containers seems not to be supported yet. Therefore, iceprog is required to be available on the host.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

网络英雄传

网络英雄传

郭羽、刘波 / 江苏凤凰文艺出版社 / 2018-6 / 59.80元

“商战鬼才郭羽、营销奇才刘波强强联手,凝集十年实战经验,倾力打造商战巨作。” 这是一个商业竞争和资本激战交织的惊心动魄的创业交锋故事。 由郭天宇、刘帅共同创立的在线旅游公司万全天盛凭借其出色的商业模式异军突起,与老牌巨头“51旅游网”两强相争,但国际巨头通远来势汹汹,国内在线旅游市场进入战火纷飞的“三国杀”时代,分踞杭、沪、京三地互相“搏杀”。中国新兴的互联网公司面对国际巨头的入侵,毫不退缩......一起来看看 《网络英雄传》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器