Skip to contentSkip to conversation

Recipes for Open Source Verilog and Lattice iCE40 FPGAs tools

PATCH In review Nathan Rossi 5 participants 13 messages Sep 10, 2017 – Oct 2, 2017

lore
Share & tools
lore
#0 lore raw

cover Recipes for Open Source Verilog and Lattice iCE40 FPGAs tools

This series contains a set of a recipes for Open Source FPGA tools which provide a full Verilog to target Bitstream flow for the Lattice iCE40 FPGAs.

This includes the following tools:
* Yosys - Synthesis
* Arachne-PNR - Place and Route
* IceStorm - Bitmapping and JTAG programming

Also included in the series is Icarus Verilog which is useful for simulation of Verilog designs.

All recipes in the series have been tested on native (x86-64), nativesdk (x86-64) and target (armv5/qemuarm). With a relatively complex Verilog design (for iCE40).

For a sample recipe that makes use of these tools within bitbake see:
https://github.com/nathanrossi/gps-clock-project/blob/master/meta-gps-clock/recipes/display-controller/display-controller.bb

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Nathan Rossi (4):
yosys: Add Yosys and ABC recipes
icestorm: Add IceStorm tools for iCE40 FPGAs
arachne-pnr: Add Arachne Place and route for iCE40 FPGAs
icarus-verilog: Add Icarus Verilog recipe

 .../arachne-pnr/arachne-pnr_git.bb                 | 44 +++++++++++++++++
 .../icarus-verilog/icarus-verilog_git.bb           | 33 +++++++++++++
 meta/recipes-devtools/icestorm/icestorm_git.bb     | 51 ++++++++++++++++++++
 meta/recipes-devtools/yosys/berkeley-abc_git.bb    | 30 ++++++++++++
 meta/recipes-devtools/yosys/yosys_git.bb           | 55 ++++++++++++++++++++++
 5 files changed, 213 insertions(+)
 create mode 100644 meta/recipes-devtools/arachne-pnr/arachne-pnr_git.bb
 create mode 100644 meta/recipes-devtools/icarus-verilog/icarus-verilog_git.bb
 create mode 100644 meta/recipes-devtools/icestorm/icestorm_git.bb
 create mode 100644 meta/recipes-devtools/yosys/berkeley-abc_git.bb
 create mode 100644 meta/recipes-devtools/yosys/yosys_git.bb
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/4 yosys: Add Yosys and ABC recipes

Yosys provides a Open Source Verilog synthesis flow for a number of targets including Altera, ASIC flows, Lattice FPGAs/CPLDs, Xilinx, etc. This tool provides the first step in a fully open source HDL/Verilog to bitstream flow.

Also included is its primary dependency Berkeley ABC which is used for the synthesis and formal verification tooling.

---
 meta/recipes-devtools/yosys/berkeley-abc_git.bb | 30 ++++++++++++++
 meta/recipes-devtools/yosys/yosys_git.bb        | 55 +++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 meta/recipes-devtools/yosys/berkeley-abc_git.bb
 create mode 100644 meta/recipes-devtools/yosys/yosys_git.bb
meta/recipes-devtools/yosys/berkeley-abc_git.bb new file +30 -0
new file mode 100644
index 0000000000..8f39c7ab29
@@ -0,0 +1,30 @@
+DESCRIPTION = "Berkeley ABC: System for Sequential Logic Synthesis and Formal Verification"
+HOMEPAGE = "http://www.eecs.berkeley.edu/~alanmi/abc/"
+# License is MIT, but differs from standard license text
+LICENSE = "MIT"
+SECTION = "devel/hardware"
+
+LIC_FILES_CHKSUM = "file://copyright.txt;md5=04eb1ba7f36d87b164b6224e5417b860"
+
+SRC_URI = "hg://bitbucket.org/alanmi/abc;protocol=https;branch=default;module=root"
+SRCREV = "ff5be06"
+
+S = "${WORKDIR}/root"
+
+PV = "1.01+hg${SRCPV}"
+
+DEPENDS = "readline"
+
+# set the ARCHFLAGS to avoid execution of arch_flags during build
+ABC_ARCHFLAGS_x86-64 = "-DLIN64 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8 -DSIZEOF_INT=4"
+ABC_ARCHFLAGS = "-DLIN -DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -fpermissive -w"
+
+do_compile() {
+	oe_runmake ABC_MAKE_VERBOSE=1 ARCHFLAGS="${ABC_ARCHFLAGS}" CC="${CXX}" CXX="${CXX}" LD="${CXX} ${LDFLAGS}"
+}
+
+do_install() {
+	install -Dm 755 ${B}/abc ${D}${bindir}/abc
+}
+
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/yosys/yosys_git.bb new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/4 icestorm: Add IceStorm tools for iCE40 FPGAs

In reply to Nathan Rossi

IceStorm includes tools for packing iCE40 designs into bitstreams as well as the data used in place and route tooling. Also included in IceStorm is JTAG programming (which uses libftdi) and other helper tools to generate iCE40 HDL and verify timing constraints.

---
 meta/recipes-devtools/icestorm/icestorm_git.bb | 51 ++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 meta/recipes-devtools/icestorm/icestorm_git.bb
meta/recipes-devtools/icestorm/icestorm_git.bb new file +51 -0
new file mode 100644
index 0000000000..01d755212b
@@ -0,0 +1,51 @@
+DESCRIPTION = "Project IceStorm aims at reverse engineering, documenting and tools for Lattice iCE40 FPGAs"
+HOMEPAGE = "http://www.clifford.at/icestorm/"
+LICENSE = "ISC"
+SECTION = "devel/fpga"
+
+LIC_FILES_CHKSUM = "file://README;beginline=8;endline=18;md5=8104f3444ed967701dafaeab14d572b9"
+
+SRC_URI = "git://github.com/cliffordwolf/icestorm;protocol=https"
+SRCREV = "69613a26d3e3a5c6f0836a773717b03360df85ce"
+
+S = "${WORKDIR}/git"
+
+PV = "0+git${SRCPV}"
+
+inherit pkgconfig
+
+# diffutils (provided by hosttools)
+DEPENDS = "gawk-native python3-native"
+
+PACKAGECONFIG = "icebox icetime"
+PACKAGECONFIG[iceprog] = ",,libftdi"
+PACKAGECONFIG[icetime] = ",,,python3"
+PACKAGECONFIG[icebox] = ",,,python3"
+
+MAKE_SUBDIRS = "icepack icemulti icepll icebram ${PACKAGECONFIG}"
+
+do_configure () {
+	# remove posioned directories
+	sed -i 's/-I\S*//g' ${S}/config.mk
+	sed -i 's/-L\S*//g' ${S}/iceprog/Makefile
+}
+
+do_compile () {
+	for i in ${MAKE_SUBDIRS}; do
+		oe_runmake -C ${B}/$i PREFIX="${prefix}"
+	done
+}
+
+do_install () {
+	for i in ${MAKE_SUBDIRS}; do
+		oe_runmake -C ${B}/$i PREFIX="${prefix}" DESTDIR="${D}" install
+	done
+}
+
+# populate the chipdb into the sysroot (not enabled by default on -native)
+SYSROOT_DIRS_NATIVE_append = " ${datadir}/icebox"
+
+# package the icebox chipdb files
+FILES_${PN} += "${datadir}/icebox"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.14.1
#3 lore raw

PATCH 3/4 arachne-pnr: Add Arachne Place and route for iCE40 FPGAs

In reply to Nathan Rossi

Arachne Place and Route provides tools to complete the place and route step for iCE40 FPGAs. This allows for processing synthesised designs from Yosys, and generating netlist output which can be processed by IceStorm.

---
 .../arachne-pnr/arachne-pnr_git.bb                 | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 meta/recipes-devtools/arachne-pnr/arachne-pnr_git.bb
meta/recipes-devtools/arachne-pnr/arachne-pnr_git.bb new file +44 -0
new file mode 100644
index 0000000000..2928a9d78b
@@ -0,0 +1,44 @@
+DESCRIPTION = "Arachne Place and Route tool for iCE40 FPGAs"
+HOMEPAGE = "https://github.com/cseed/arachne-pnr"
+LICENSE = "MIT"
+SECTION = "devel/fpga"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=3bb65c4bee625d497d43f50e6dacb4e2"
+
+SRC_URI = "git://github.com/cseed/arachne-pnr;protocol=https"
+SRCREV = "7e135edb31feacde85ec5b7e5c03fc9157080977"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# needs coreutils for 'sum'
+# icestorm is needed for chipdb
+# depends on itself for processing chipdb content
+DEPENDS = "coreutils-native icestorm-native arachne-pnr-native"
+
+# export the path for icestorm chipdb
+export ICEBOX = "${STAGING_DIR_NATIVE}${datadir_native}/icebox"
+
+# set executable for use when processing chipdb
+ARACHNEPNR_class-native = "${B}/bin/arachne-pnr"
+ARACHNEPNR = "arachne-pnr"
+
+do_compile () {
+	oe_runmake bin/arachne-pnr
+
+	# manually build the chipdb.bin files
+	mkdir -p ${B}/share/arachne-pnr
+	for i in 384 1k 8k; do
+		${ARACHNEPNR} -d 384 -c ${ICEBOX}/chipdb-$i.txt --write-binary-chipdb ${B}/share/arachne-pnr/chipdb-$i.bin
+	done
+}
+
+do_install () {
+	oe_runmake PREFIX="${prefix}" DESTDIR="${D}" install
+}
+
+# populate the chipdb into the sysroot (not enabled by default on -native)
+SYSROOT_DIRS_NATIVE_append = " ${datadir}/arachne-pnr"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.14.1
#4 lore raw

PATCH 4/4 icarus-verilog: Add Icarus Verilog recipe

In reply to Nathan Rossi

Icarus Verilog is a multi-purpose tool for simulation and synthesis of Verilog. It is also useful for linting verilog and other tasks.

---
 .../icarus-verilog/icarus-verilog_git.bb           | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 meta/recipes-devtools/icarus-verilog/icarus-verilog_git.bb
meta/recipes-devtools/icarus-verilog/icarus-verilog_git.bb new file +33 -0
new file mode 100644
index 0000000000..d1e4cfdd33
@@ -0,0 +1,33 @@
+DESCRIPTION = "Icarus Verilog is a Verilog simulaton and synthesis tool"
+HOMEPAGE = "http://iverilog.icarus.com/"
+LICENSE = "GPLv2"
+SECTION = "devel/verilog"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "git://github.com/steveicarus/iverilog.git;protocol=https"
+SRCREV = "ac87138c44cd6089046668c59a328b4d14c16ddc"
+
+S = "${WORKDIR}/git"
+
+PV = "10.2+git${SRCPV}"
+
+inherit autotools
+
+EXTRA_OEMAKE_append = ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}"'
+
+# issues with install races
+PARALLEL_MAKEINST = ""
+
+# don't regen aclocal or autoheader
+EXTRA_AUTORECONF += "--exclude=aclocal --exclude=autoheader"
+
+DEPENDS = " \
+	flex-native bison-native \
+	gperf-native \
+	readline ncurses \
+	"
+
+FILES_${PN} += "${libdir}/ivl"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.14.1
#5 lore raw
In reply to Nathan Rossi
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

Ross

#6 lore raw

Nathan, this is awesome!

(haven't tested it yet, but it's great to see this effort!!)

Quoted 9 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

We already have meta-xilinx (and friends) and meta-altera, looks like a meta-lattice is in order?

#8 lore raw
In reply to Burton, Ross
Quoted 10 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

I think a layer for 2 recipes might be too much. Put it under recipes-devtools in meta-oe for now.

Quoted 9 lines

Ross

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#7 lore raw
In reply to Trevor Woerner
Quoted 13 lines · Trevor Woerner

Nathan, this is awesome!

(haven't tested it yet, but it's great to see this effort!!)

Quoted 8 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Quoted 4 lines
Quoted 1 line

Sounds like a dedicated FPGA layer would be ideal.

We already have meta-xilinx (and friends) and meta-altera, looks like a meta-lattice is in order?

For open tools like these I think a meta-fpga layer makes sense. Hopefully then others can build off it.

Thanks,
Alistair

Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#9 lore raw
In reply to Khem Raj
Quoted 9 lines · Khem Raj
Quoted 8 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Quoted 5 lines
Quoted 2 lines

Sounds like a dedicated FPGA layer would be ideal.

I think a layer for 2 recipes might be too much. Put it under recipes-devtools in meta-oe for now.

5?

Am I reading this patch correctly? There are 5 recipes?

#10 lore raw
Quoted 13 lines · Trevor Woerner
Quoted 12 lines · Khem Raj
Quoted 10 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

Quoted 6 lines
Quoted 2 lines

I think a layer for 2 recipes might be too much. Put it under recipes-devtools in meta-oe for now.

5?

Am I reading this patch correctly? There are 5 recipes?

2 or 5 doesnt matter I just meant "too few to be a layer of its own" engineers minds :)

#11 lore raw
Quoted 17 lines · Khem Raj
Quoted 16 lines · Trevor Woerner
Quoted 14 lines · Khem Raj
Quoted 10 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

I think a layer for 2 recipes might be too much. Put it under recipes-devtools in meta-oe for now.

Quoted 6 lines
Quoted 3 lines

5?

Am I reading this patch correctly? There are 5 recipes?

2 or 5 doesnt matter I just meant "too few to be a layer of its own" engineers minds :)

That was my initial thoughts, and I was following your suggestion Khem :).

Though it seems like now is probably a reasonable time as any to create a layer to give a home for recipes in the HDL/FPGA space. After all there are other projects that I would like to look at and probably create recipes for in time, so what is now 5 recipes is likely to increase.

But I don't like the idea of a FPGA or vendor (e.g. lattice/etc) specific layer since that makes it appear like a BSP layer, and there is the problem of the tools 'conflicting' with proprietary tools those vendors provide. I was thinking of following the approach of a language-like layer similar to how meta-python/meta-rust/etc. are setup, something like meta-hdl? Which would cover the recipes in the language space (simulation/high-level hdl) as well as the recipes that translate/compile HDLs for physical targets (FPGA, CPLD, etc).

Regards,
Nathan

#12 lore raw
Quoted 33 lines · Nathan Rossi
Quoted 17 lines · Khem Raj
Quoted 16 lines · Trevor Woerner
Quoted 14 lines · Khem Raj
Quoted 10 lines · Ross
Quoted 5 lines · Nathan Rossi

Please note whilst this series is sent for oe-core it may be better located in another layer? (e.g. meta-oe). However since the recipes and the tools they build are not specific to a single BSP it did not make sense to keep in a BSP specific layer.

Sounds like a dedicated FPGA layer would be ideal.

I think a layer for 2 recipes might be too much. Put it under recipes-devtools in meta-oe for now.

Quoted 6 lines
Quoted 3 lines

5?

Am I reading this patch correctly? There are 5 recipes?

2 or 5 doesnt matter I just meant "too few to be a layer of its own" engineers minds :)

That was my initial thoughts, and I was following your suggestion Khem :).

Though it seems like now is probably a reasonable time as any to create a layer to give a home for recipes in the HDL/FPGA space. After all there are other projects that I would like to look at and probably create recipes for in time, so what is now 5 recipes is likely to increase.

Quoted 8 lines

But I don't like the idea of a FPGA or vendor (e.g. lattice/etc) specific layer since that makes it appear like a BSP layer, and there is the problem of the tools 'conflicting' with proprietary tools those vendors provide. I was thinking of following the approach of a language-like layer similar to how meta-python/meta-rust/etc. are setup, something like meta-hdl? Which would cover the recipes in the language space (simulation/high-level hdl) as well as the recipes that translate/compile HDLs for physical targets (FPGA, CPLD, etc).

For those interested, I have setup a meta-hdl layer and published it on github, it includes all the recipes from this patch series.

https://github.com/nathanrossi/meta-hdl

I've also submitted it to the layer index.

Regards,
Nathan