|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": { |
| 6 | + "tags": [] |
| 7 | + }, |
| 8 | + "source": [ |
| 9 | + "### Basm, Shared Object and Alveo u50 example ###" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "markdown", |
| 14 | + "metadata": {}, |
| 15 | + "source": [ |
| 16 | + "This is the usal way to import the BondMachine toolkit into your python environment." |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "code", |
| 21 | + "execution_count": null, |
| 22 | + "metadata": { |
| 23 | + "tags": [] |
| 24 | + }, |
| 25 | + "outputs": [], |
| 26 | + "source": [ |
| 27 | + "import os\n", |
| 28 | + "BONDMACHINE_DIR=\"/home/\"+os.environ[\"USER\"]+\"/bin\"\n", |
| 29 | + "os.environ[\"BONDMACHINE_DIR\"]=BONDMACHINE_DIR\n", |
| 30 | + "os.environ[\"PATH\"]=os.environ[\"PATH\"]+\":\"+os.environ[\"BONDMACHINE_DIR\"]" |
| 31 | + ] |
| 32 | + }, |
| 33 | + { |
| 34 | + "cell_type": "code", |
| 35 | + "execution_count": null, |
| 36 | + "metadata": { |
| 37 | + "tags": [] |
| 38 | + }, |
| 39 | + "outputs": [], |
| 40 | + "source": [ |
| 41 | + "os.environ['XILINX_HLS'] = '/tools/Xilinx/Vitis_HLS/2023.2'\n", |
| 42 | + "os.environ['XILINX_VIVADO'] = '/tools/Xilinx/Vivado/2023.2'\n", |
| 43 | + "os.environ['XILINX_VITIS'] = '/tools/Xilinx/Vitis/2023.2'\n", |
| 44 | + "os.environ['PATH']=os.environ[\"PATH\"]+\":\"+os.environ['XILINX_HLS']+\"/bin:\"+os.environ['XILINX_VIVADO']+\"/bin:\"+os.environ['XILINX_VITIS']+\"/bin:\"" |
| 45 | + ] |
| 46 | + }, |
| 47 | + { |
| 48 | + "cell_type": "markdown", |
| 49 | + "metadata": {}, |
| 50 | + "source": [ |
| 51 | + "Let's import also some other useful libraries as display." |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "metadata": { |
| 58 | + "tags": [] |
| 59 | + }, |
| 60 | + "outputs": [], |
| 61 | + "source": [ |
| 62 | + "from IPython import display" |
| 63 | + ] |
| 64 | + }, |
| 65 | + { |
| 66 | + "cell_type": "code", |
| 67 | + "execution_count": null, |
| 68 | + "metadata": { |
| 69 | + "tags": [] |
| 70 | + }, |
| 71 | + "outputs": [], |
| 72 | + "source": [ |
| 73 | + "!bmhelper doctor" |
| 74 | + ] |
| 75 | + }, |
| 76 | + { |
| 77 | + "cell_type": "markdown", |
| 78 | + "metadata": {}, |
| 79 | + "source": [ |
| 80 | + "Let's ckeck the project configuration." |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "cell_type": "code", |
| 85 | + "execution_count": null, |
| 86 | + "metadata": { |
| 87 | + "tags": [] |
| 88 | + }, |
| 89 | + "outputs": [], |
| 90 | + "source": [ |
| 91 | + "%%bash\n", |
| 92 | + "cat local.mk" |
| 93 | + ] |
| 94 | + }, |
| 95 | + { |
| 96 | + "cell_type": "markdown", |
| 97 | + "metadata": {}, |
| 98 | + "source": [ |
| 99 | + "This project is configured to use the Alveo U50 board. It introduces the following parameters:\n", |
| 100 | + "- `BOARD`: alveou50\n", |
| 101 | + "- `PLATFORM`: xilinx_u50_gen3x16_xdma_5_202210_1 ## This is the platform name, is the same we would use in the vitis environment.\n", |
| 102 | + "- `SOURCE_BASM`: program.basm ## This is the name of the basm file that will be generated by the compiler. This workflow is not using the compiler but the assembler directly." |
| 103 | + ] |
| 104 | + }, |
| 105 | + { |
| 106 | + "cell_type": "code", |
| 107 | + "execution_count": null, |
| 108 | + "metadata": { |
| 109 | + "tags": [] |
| 110 | + }, |
| 111 | + "outputs": [], |
| 112 | + "source": [ |
| 113 | + "!cat alveou50_maps.json" |
| 114 | + ] |
| 115 | + }, |
| 116 | + { |
| 117 | + "cell_type": "markdown", |
| 118 | + "metadata": {}, |
| 119 | + "source": [ |
| 120 | + "Let's check the code we are going to assemble." |
| 121 | + ] |
| 122 | + }, |
| 123 | + { |
| 124 | + "cell_type": "code", |
| 125 | + "execution_count": null, |
| 126 | + "metadata": { |
| 127 | + "tags": [] |
| 128 | + }, |
| 129 | + "outputs": [], |
| 130 | + "source": [ |
| 131 | + "%%bash\n", |
| 132 | + "cat program.basm" |
| 133 | + ] |
| 134 | + }, |
| 135 | + { |
| 136 | + "cell_type": "markdown", |
| 137 | + "metadata": {}, |
| 138 | + "source": [ |
| 139 | + "As always, we need to create a `BondMachine` object to interact with the board." |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "cell_type": "code", |
| 144 | + "execution_count": null, |
| 145 | + "metadata": { |
| 146 | + "tags": [] |
| 147 | + }, |
| 148 | + "outputs": [], |
| 149 | + "source": [ |
| 150 | + "%%bash\n", |
| 151 | + "make bondmachine" |
| 152 | + ] |
| 153 | + }, |
| 154 | + { |
| 155 | + "cell_type": "markdown", |
| 156 | + "metadata": {}, |
| 157 | + "source": [ |
| 158 | + "And as always, we can see the diagram of the bondmachine." |
| 159 | + ] |
| 160 | + }, |
| 161 | + { |
| 162 | + "cell_type": "code", |
| 163 | + "execution_count": null, |
| 164 | + "metadata": { |
| 165 | + "tags": [] |
| 166 | + }, |
| 167 | + "outputs": [], |
| 168 | + "source": [ |
| 169 | + "!SHOWRENDERER=\"dot -Tpng > working_dir/bondmachine.png\" make show\n", |
| 170 | + "display.Image(\"working_dir/bondmachine.png\")" |
| 171 | + ] |
| 172 | + }, |
| 173 | + { |
| 174 | + "cell_type": "markdown", |
| 175 | + "metadata": {}, |
| 176 | + "source": [ |
| 177 | + "Let's apply the configuration, this task will incorporate all the auxiliary files into the project." |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "code", |
| 182 | + "execution_count": null, |
| 183 | + "metadata": { |
| 184 | + "tags": [] |
| 185 | + }, |
| 186 | + "outputs": [], |
| 187 | + "source": [ |
| 188 | + "!make apply" |
| 189 | + ] |
| 190 | + }, |
| 191 | + { |
| 192 | + "cell_type": "markdown", |
| 193 | + "metadata": {}, |
| 194 | + "source": [ |
| 195 | + "Let's clean the workspace." |
| 196 | + ] |
| 197 | + }, |
| 198 | + { |
| 199 | + "cell_type": "code", |
| 200 | + "execution_count": null, |
| 201 | + "metadata": { |
| 202 | + "tags": [] |
| 203 | + }, |
| 204 | + "outputs": [], |
| 205 | + "source": [ |
| 206 | + "!make hdl" |
| 207 | + ] |
| 208 | + }, |
| 209 | + { |
| 210 | + "cell_type": "code", |
| 211 | + "execution_count": null, |
| 212 | + "metadata": { |
| 213 | + "tags": [] |
| 214 | + }, |
| 215 | + "outputs": [], |
| 216 | + "source": [ |
| 217 | + "!make xclbin" |
| 218 | + ] |
| 219 | + }, |
| 220 | + { |
| 221 | + "cell_type": "code", |
| 222 | + "execution_count": null, |
| 223 | + "metadata": { |
| 224 | + "tags": [] |
| 225 | + }, |
| 226 | + "outputs": [], |
| 227 | + "source": [ |
| 228 | + "!make clean" |
| 229 | + ] |
| 230 | + } |
| 231 | + ], |
| 232 | + "metadata": { |
| 233 | + "kernelspec": { |
| 234 | + "display_name": "Python 3 (ipykernel)", |
| 235 | + "language": "python", |
| 236 | + "name": "python3" |
| 237 | + }, |
| 238 | + "language_info": { |
| 239 | + "codemirror_mode": { |
| 240 | + "name": "ipython", |
| 241 | + "version": 3 |
| 242 | + }, |
| 243 | + "file_extension": ".py", |
| 244 | + "mimetype": "text/x-python", |
| 245 | + "name": "python", |
| 246 | + "nbconvert_exporter": "python", |
| 247 | + "pygments_lexer": "ipython3", |
| 248 | + "version": "3.8.18" |
| 249 | + }, |
| 250 | + "vscode": { |
| 251 | + "interpreter": { |
| 252 | + "hash": "8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3" |
| 253 | + } |
| 254 | + } |
| 255 | + }, |
| 256 | + "nbformat": 4, |
| 257 | + "nbformat_minor": 4 |
| 258 | +} |
0 commit comments