|
1 | | -# litex-conda-eda |
| 1 | +# Conda EDA |
2 | 2 |
|
3 | | -Conda recipes for FPGA EDA tools (for synthesis, place and route and bitstream |
4 | | -generation). |
| 3 | +<p align="center"> |
| 4 | + <a href="https://hdl.github.io/conda-eda/"><img width=550px src="docs/_static/banner.png"/></a> |
| 5 | +</p> |
5 | 6 |
|
6 | | -# Synthesis |
| 7 | +Conda recipes for FPGA EDA tools (for synthesis, place and route and bitstream generation). |
7 | 8 |
|
8 | | - * [Yosys](https://github.com/YosysHQ/yosys) |
9 | | - * TODO: [GHDL Synthesis](https://github.com/tgingold/ghdlsynth-beta) |
| 9 | +## Synthesis |
10 | 10 |
|
11 | | -# Place and Route |
| 11 | +* [Yosys](https://github.com/YosysHQ/yosys) |
| 12 | +* TODO: [GHDL Synthesis](https://github.com/tgingold/ghdlsynth-beta) |
12 | 13 |
|
13 | | - * [arachne](https://github.com/cseed/arachne-pnr) |
14 | | - * [nextpnr (iCE40, ECP5, generic)](https://github.com/YosysHQ/nextpnr) |
15 | | - * [Versatile Place and Route (vpr)](https://github.com/verilog-to-routing/vtr-verilog-to-routing) |
| 14 | +## Place and Route |
16 | 15 |
|
17 | | -# Bitstream |
| 16 | +* [arachne](https://github.com/cseed/arachne-pnr) |
| 17 | +* [nextpnr (iCE40, ECP5, generic)](https://github.com/YosysHQ/nextpnr) |
| 18 | +* [Versatile Place and Route (vpr)](https://github.com/verilog-to-routing/vtr-verilog-to-routing) |
18 | 19 |
|
19 | | - * [Project Icestorm](https://github.com/cliffordwolf/icestorm) |
20 | | - * [Project Trellis](https://github.com/SymbiFlow/prjtrellis) |
21 | | - * TODO: [Project X-Ray](https://github.com/SymbiFlow/prjxray) |
| 20 | +## Bitstream |
22 | 21 |
|
23 | | -# Simulation |
| 22 | +* [Project Icestorm](https://github.com/cliffordwolf/icestorm) |
| 23 | +* [Project Trellis](https://github.com/SymbiFlow/prjtrellis) |
| 24 | +* TODO: [Project X-Ray](https://github.com/SymbiFlow/prjxray) |
24 | 25 |
|
25 | | - * TODO: [GHDL](http://ghdl.free.fr/) |
26 | | - * [Icarus Verilog](http://iverilog.icarus.com/) |
27 | | - * [Verilator](https://www.veripool.org/wiki/verilator) |
| 26 | +## Simulation |
28 | 27 |
|
29 | | -# Formal |
| 28 | +* TODO: [GHDL](http://ghdl.free.fr/) |
| 29 | +* [Icarus Verilog](http://iverilog.icarus.com/) |
| 30 | +* [Verilator](https://www.veripool.org/wiki/verilator) |
30 | 31 |
|
31 | | - * [Symbiyosys](https://github.com/YosysHQ/SymbiYosys) |
| 32 | +## Formal |
32 | 33 |
|
33 | | -# Building |
34 | | - |
35 | | -This repository is set up to be built by Travis CI, using the GitHub |
36 | | -integration to Travis CI. |
37 | | - |
38 | | -See [`.travis.yml`](.travis.yml) for the build configuration given to |
39 | | -Travis CI, and the [`.travis`](.travis) directory for scripts referenced. |
40 | | - |
41 | | -The Travis CI output can be found on the https://travis-ci.com/ for the |
42 | | -GitHub account and GitHub repository. For instance, for the main: |
43 | | - |
44 | | -https://github.com/litex-hub/litex-conda-eda |
45 | | - |
46 | | -GitHub repository, the Travis CI results can be seen at: |
47 | | - |
48 | | -https://travis-ci.com/litex-hub/litex-conda-eda |
49 | | - |
50 | | -On a successful build in the `litex-hub` Travis CI, the resulting packages |
51 | | -are uploaded to: |
52 | | - |
53 | | -https://anaconda.org/litex-hub/repo |
54 | | - |
55 | | -and can be installed with: |
56 | | - |
57 | | -``` |
58 | | -conda install --channel "LiteX-Hub" package |
59 | | -``` |
60 | | - |
61 | | -These packages are mostly used by |
62 | | -[`litex-buildenv`](https://github.com/litex-hub/litex-buildenv). |
63 | | - |
64 | | -## Building via Travis CI in your own repository |
65 | | - |
66 | | -If you [enable Travis CI on your GitHub |
67 | | -fork](https://travis-ci.com/getting_started) of `litex-conda-eda` |
68 | | -then your Travis CI results will be at: |
69 | | - |
70 | | -``` |
71 | | -https://travis-ci.org/${GITHUB_USER}/litex-conda-eda |
72 | | -``` |
73 | | - |
74 | | -Since the repository includes `.travis.yml` and all the other Travis CI |
75 | | -setup, you should just need to turn on the Travis CI integration at GitHub, |
76 | | -and push changes to your GitHub repo, to trigger a Travis CI build, then |
77 | | -watch the https://travis-ci.org/ site for the build progress. |
78 | | - |
79 | | -A full build of everything will take the Travis CI infrastructure a few |
80 | | -hours if it all builds successfully. |
81 | | - |
82 | | -## Common Travis CI build failures |
83 | | - |
84 | | -If the build fails, see the [common Travis CI build |
85 | | -problems](https://docs.travis-ci.com/user/common-build-problems/) |
86 | | -for assistance investigating the issues. Common issues with this |
87 | | -repository include package dependencies (eg, where Conda has changed), |
88 | | -output log file size (Travis CI has a 4MB maximum, and some package |
89 | | -builds like `gcc` generate a *lot* of output), and builds timing out |
90 | | -(either for maximum time allocation, or for ["no output" for more than |
91 | | -10 minutes](https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received)). |
92 | | - |
93 | | -## Testing conda builds locally |
94 | | - |
95 | | -It is recommend to build these packages in a fresh disposable environment |
96 | | -such as a clean container (Docker, Podman etc.). |
97 | | -While the goal is for the conda environment to be totally self contained, |
98 | | -there is a constant battle to make sure this happens. |
99 | | - |
100 | | -The commands from the following subsections were tested to be enough to build |
101 | | -a package in a clean container based on `ubuntu` (`16.04`-`20.04`) or `debian` |
102 | | -(`8`-`10`) Docker image. |
103 | | - |
104 | | -### Prerequisites |
105 | | - |
106 | | -Apart from cloning this repository to a local directory, the following |
107 | | -prerequisites are required: |
108 | | -* [Git](https://git-scm.com/), |
109 | | -* Conda installed and initialized, e.g., using |
110 | | -[Miniconda](https://docs.conda.io/en/latest/miniconda.html) |
111 | | -(which includes self contained versions of the required *python3* with |
112 | | -*pip* and *setuptools* tooling), |
113 | | -* [conda-build-prepare](https://github.com/litex-hub/conda-build-prepare). |
114 | | - |
115 | | -On Debian and Ubuntu, these requirements can be satisfied using the following |
116 | | -commands: |
117 | | - |
118 | | -<!-- name="install-prerequisites" --> |
119 | | -```bash |
120 | | -# Install git and wget (might require using `sudo`) |
121 | | -apt-get update |
122 | | -apt-get install -y git wget |
123 | | - |
124 | | -# Download Miniconda and install in CONDA_PATH |
125 | | -CONDA_PATH=~/conda |
126 | | -wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh |
127 | | -chmod a+x Miniconda3-latest-Linux-x86_64.sh |
128 | | -./Miniconda3-latest-Linux-x86_64.sh -p $CONDA_PATH -b -f |
129 | | - |
130 | | -# Initialize Conda in the shell |
131 | | -eval "$("$CONDA_PATH/bin/conda" "shell.bash" 'hook' 2> /dev/null)" |
132 | | - |
133 | | -# Install `conda-build-prepare` |
134 | | -python3 -m pip install git+https://github.com/litex-hub/ [email protected]#egg=conda-build-prepare |
135 | | - |
136 | | -# Clone the `conda-eda` repository |
137 | | -git clone https://github.com/hdl/conda-eda.git |
138 | | -cd conda-eda |
139 | | -``` |
140 | | - |
141 | | -### Required environment variables |
142 | | - |
143 | | -Some recipes require exporting additional environment variables. |
144 | | -Such variables must be set before preparing the recipe, which is done |
145 | | -with one of the commands from the next subsection. |
146 | | - |
147 | | -Currently there are no such variables and recipes in this repository, |
148 | | -although there are a few such cases in other `hdl/conda-*` repositories. |
149 | | - |
150 | | -The `DATE_NUM` and `DATE_STR` environment variables are required by the most of |
151 | | -this repository's recipes. |
152 | | -Values of these variables are commonly used as `build/number` and |
153 | | -`build/string` keys in the recipes. |
154 | | - |
155 | | -If the `DATE_STR` hasn't been set in the environment then it is set during the |
156 | | -preparation based: |
157 | | -* on the latest commit's committer date if the recipe belongs to a git |
158 | | - repository, |
159 | | -* on the latest file modification date after checking all recipe files |
160 | | - otherwise, |
161 | | -using UTC timezone and `%Y%m%d_%H%M%S` time format, e.g., `20210216_155420`. |
162 | | - |
163 | | -The `DATE_NUM` is always automatically set with all `DATE_STR` digits. |
164 | | -In case of the aforementioned `DATE_STR` example, `20210216155420` would be |
165 | | -used as the `DATE_NUM` value. |
166 | | - |
167 | | -### Preparing and building the package |
168 | | - |
169 | | -After getting all prerequisites and setting the required variables, it is |
170 | | -recommended to prepare the recipe with *conda-build-prepare* before building, |
171 | | -as it gives you the advantages described [on the tool's GitHub |
172 | | -page](https://github.com/litex-hub/conda-build-prepare). |
173 | | -Since it's also used within the CI, the locally built packages will be much |
174 | | -more similar to the ones built by the CI workflow. |
175 | | - |
176 | | -#### Preparing the recipe with *conda-build-prepare* |
177 | | - |
178 | | -The *conda-build-prepare* is a Python module with a CLI. |
179 | | -Its calling signature is: |
180 | | -``` |
181 | | -python3 -m conda_build_prepare |
182 | | -[-h] |
183 | | -[--channels CHANNEL [CHANNEL ...]] |
184 | | -[--packages PACKAGE [PACKAGE ...]] |
185 | | ---dir DIRECTORY |
186 | | -RECIPE |
187 | | -``` |
188 | | - |
189 | | -The required arguments are: |
190 | | -* `--dir DIRECTORY` – the path for a new directory that will be created with |
191 | | - output files, |
192 | | -* `RECIPE` – the path to the recipe corresponding to the package chosen to be |
193 | | - built. |
194 | | - |
195 | | -To build a package similarly to how the packages are built in the CI it is |
196 | | -recommended to pass the following optional arguments: |
197 | | -* `--channels litex-hub` – to search for build dependencies in the LiteX-Hub |
198 | | - channel in addition to the recipe-specific channels (from its `condarc` file), |
199 | | -* `--packages python=3.7` – to use the same versions of |
200 | | - packages that influence building as in the CI. |
201 | | - |
202 | | -After preparing, the output `DIRECTORY` will contain subdirectories: |
203 | | -* `conda-env` with a clean Conda environment to host the build process, |
204 | | -* `git-repos` with source git repositories cloned and slightly adjusted, |
205 | | -* `recipe` with an adjusted recipe (locked requirements, version set etc.). |
206 | | - |
207 | | -More details can be found on [the *conda-build-prepare* |
208 | | -GitHub page](https://github.com/litex-hub/conda-build-prepare). |
209 | | - |
210 | | -#### Building the package |
211 | | - |
212 | | -To build the package using the prepared subdirectories: |
213 | | -* activate the Conda environment from `DIRECTORY/conda-env`, |
214 | | -* run `conda-build` tool with `DIRECTORY/recipe`. |
215 | | - |
216 | | -#### Script to prepare the recipe and build the package |
217 | | - |
218 | | -All of the following commands are meant to be run from the repository root. |
219 | | - |
220 | | -If the provided commands are to be used unmodified, it is important to first |
221 | | -set the `RECIPE_PATH` variable with the proper recipe's path to build the |
222 | | -chosen package and the variables mentioned in the previous subsection, if the |
223 | | -recipe requires such. |
224 | | -By default, the `yosys` package will be built. |
225 | | - |
226 | | -The `PREPARED_RECIPE_OUTPUTDIR` variable sets the directory that will be |
227 | | -created with the already described `conda-build-prepare`'s output |
228 | | -subdirectories. |
229 | | -By default, the `cbp-outdir` will be created in the repository root. |
230 | | - |
231 | | -<!-- name="prepare-and-build" --> |
232 | | -```bash |
233 | | -# Some defaults for the variables used in subsequent commands |
234 | | -PREPARED_RECIPE_OUTPUTDIR=${PREPARED_RECIPE_OUTPUTDIR:-cbp-outdir} |
235 | | -RECIPE_PATH=${RECIPE_PATH:-syn/yosys} |
236 | | - |
237 | | -# Prepare the RECIPE with `conda-build-prepare` |
238 | | -ADDITIONAL_PACKAGES="python=3.7" |
239 | | -python3 -m conda_build_prepare \ |
240 | | - --channels litex-hub \ |
241 | | - --packages $ADDITIONAL_PACKAGES \ |
242 | | - --dir $PREPARED_RECIPE_OUTPUTDIR \ |
243 | | - $RECIPE_PATH |
244 | | - |
245 | | -# Activate prepared environment where `conda build` will be run |
246 | | -conda activate $PREPARED_RECIPE_OUTPUTDIR/conda-env |
247 | | - |
248 | | -# Build the package |
249 | | -conda build $PREPARED_RECIPE_OUTPUTDIR/recipe |
250 | | -``` |
251 | | - |
252 | | -### Additional information |
253 | | - |
254 | | -Expect packages like `binutils` to take 3-5 minutes to build, packages |
255 | | -like `gcc/nostdc` to take 10-15 minutes to build, and packages like |
256 | | -`gcc/newlib` to take 25-40 minutes to build, on a relatively fast |
257 | | -build system (eg, SSD, i7, reasonable amount of RAM). Beware that |
258 | | -`gcc/newlib` wants to see `gcc/nostdc` *of the same version* already |
259 | | -installed before it will build; this means that `gcc/newlib` is |
260 | | -non-trivial to build individually. |
261 | | - |
262 | | -To build one architecture of tools, without any cleanup will need a |
263 | | -VM with maybe 12-15GiB of space available (a 10GiB disk image is not |
264 | | -quite big enough). Building more architectures at once will need more |
265 | | -disk space. |
266 | | - |
267 | | -**NOTE**: By preference only packages built by Travis CI should be |
268 | | -uploaded to the Anaconda repository, so that the externally visible |
269 | | -packages have consistent package versions (and do not conflict). But |
270 | | -it can be useful to build locally to debug `conda-build` config issues |
271 | | -without waiting for a full Travis CI cycle. |
| 34 | +* [Symbiyosys](https://github.com/YosysHQ/SymbiYosys) |
0 commit comments