yosys是linux系统,VHDL support for open-source FPGA toolchain YoSys

ghdlsynth-beta: VHDL synthesis (based onghdl

andyosys

)

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 installyosys

.

Get sources, build and installghdl

. 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, setGHDL

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 toYOSYS_PREFIX/share/yosys/plugins/ghdl.so

, whereYOSYS_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.

Getyosys

sources.

Get ghdlsynth-beta and:

Patch yosys sources usingyosys.diff

.

Copysrc/*

toyosys/frontends/ghdl

.

Configure yosys by adding (to)Makefile.conf

:

ENABLE_GHDL := 1

GHDL_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 imageghdl/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 withdocker

installed, the image is automatically downloaded the first time invoked.

Furthermore, the snippet above can be extended in order to P&R the design withnextpnr

and generate a bitstream withicestorm

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 useiceprog

throughghdl/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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值