aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: ea1f7b063a8ae000586ce802333a4bac3c895737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# ghdlsynth-beta
VHDL synthesis (based on ghdl)

This is awfully 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.

## How to build as a module

Get and install yosys.

Get ghdl from github.

Get the latest version of GNAT:
```sh
$ sudo apt-get install gnat-8
```

From ghdl, build and install `libghdlsynth.so`. You may need sudo permission.
```sh
$ make libghdlsynth.so
$ make install.libghdlsynth.shared
```

From ghdlsynth-beta:

```sh
make GHDL_PREFIX=/usr/local/
```

This generates `ghdl.so`, which can be used directly:

```sh
$ yosys -m ghdl.so
```

To install the module:

```sh
make GHDL_PREFIX=/usr/local/ install
```

## How to build as part of yosys (not recommended)

Get ghdl from github,
build and install
build and install `libghdlsynth.a`:
```sh
$ make libghdlsynth.a
$ make install.libghdlsynth
```

Get yosys.

From ghdlsynth-beta:
Patch yosys sources using `yosys.diff`
Copy the `ghdl/` directory in `yosys/frontends`

### Configure yosys.
In Makefile.conf, add:
```makefile
ENABLE_GHDL := 1
GHDL_DIR := <ghdl install dir>
```

Build yosys.

### How to use

Example for icestick:

```sh
ghdl -a leds.vhdl
ghdl -a spin1.vhdl
yosys -p 'ghdl leds; synth_ice40 -blif leds.blif'
arachne-pnr -d 1k -o leds.asc -p leds.pcf leds.blif
icepack leds.asc leds.bin
iceprog leds.bin
```