|
1 |
| -EDA Container Wrapper |
2 |
| -===================== |
| 1 | +# EDA Container Wrapper |
| 2 | + |
| 3 | +EDA container wrapper is a work-in-progress generic wrapper tool around open |
| 4 | +source EDA tools. The tools are executed in Docker containers and this tool |
| 5 | +wraps this execution and keeps an inventory of tools. |
| 6 | + |
| 7 | +It supports three use cases: |
| 8 | + |
| 9 | +1. Run `eda-container-wrapper` to execute the wrapper with given parameters |
| 10 | +2. Let `eda-container-wrapper` create a wrapper script (in an executable path for example) with pre-defined settings |
| 11 | +3. Run tools from python using the `edacontainerwrapper` module |
| 12 | + |
| 13 | +The settings can be set in the following way in precedence order: |
| 14 | + |
| 15 | +1. As parameters to the `eda-container-wrapper` tool or to the respective functions of `edacontainerwrapper` |
| 16 | +2. As environment variables |
| 17 | +3. As default settings in the wrapper scripts |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +```shell |
| 22 | +$ pip3 install eda-container-wrapper |
| 23 | +``` |
| 24 | + |
| 25 | +## Supported settings |
| 26 | + |
| 27 | +### Tool version (`--tool-version` or `ECW_TOOL_VERSION`, default: depends on tool) |
| 28 | + |
| 29 | +Sets the version of the tool to use. |
| 30 | + |
| 31 | +### Interactive (`--non-interactive` or `ÈCW_INTERACTIVE`, default: interactive) |
| 32 | + |
| 33 | +Runs the Docker container in interactive mode (allowing to terminate it easily |
| 34 | +for example) with the Docker `-ti` flags. Some non-interactive environments such |
| 35 | +as CI don't support that (missing tty). Note the difference in logic, the |
| 36 | +default is interactive mode which is disabled with the `--non-interactive` |
| 37 | +switch. `ECW_INTERACTIVE` keeps it interactive when set to `true` or `1` and it |
| 38 | +will be non-interactive otherwise. |
| 39 | + |
| 40 | +### Current work directory base (`--cwd-base` or `ECW_CWD_BASE`, default: not set) |
| 41 | + |
| 42 | +If not empty this is a colon-separated pair of a leading path of the cwd where |
| 43 | +the tool was called from and a replacement for this path. This is in particular |
| 44 | +useful when called from inside a Docker container, such as in CI. The syntax is: |
| 45 | +`<actual path>:<cwd path>`. |
| 46 | + |
| 47 | +### Split the current working directory (`--split-cwd-tail` or `ECW_SPLIT_CWD_TAIL`, default: `0`) |
| 48 | + |
| 49 | +When mapping the current working directory, this setting actually maps the path |
| 50 | +up the hierarchy by the given value. This is in particular useful when you need |
| 51 | +to access data relative to the current working directory that is in upper and |
| 52 | +sibbling folders. |
| 53 | + |
| 54 | +For example, when started from the following folder: |
| 55 | + |
| 56 | +``` |
| 57 | +CWD=/path/to/my/project/build |
| 58 | +``` |
| 59 | + |
| 60 | +Setting `--split-cwd-tail=1` the split is into `/path/to/my/project` and |
| 61 | +`build`. Each tool has a "project path" that is the volume where the tool is |
| 62 | +executed in then by setting the working directory. For a tool with the project |
| 63 | +path `/project` it will then mount `/path/to/my/project` to `/project` and the |
| 64 | +workdir will be `/project/build`. |
| 65 | + |
| 66 | +This split is executed after processing the `cwd base`. |
| 67 | + |
| 68 | +## Running a Tool |
| 69 | + |
| 70 | +As described above there are different ways to run a tool, that are described in |
| 71 | +the following. |
| 72 | + |
| 73 | +### Run `eda-container-wrapper` |
| 74 | + |
| 75 | +The program is called with the parameters as described and the toolname. |
| 76 | +Following a `--` parameters to the tool can be supplied. |
| 77 | + |
| 78 | +Example: |
| 79 | + |
| 80 | +```shell |
| 81 | +$ eda-container-wrapper verilator -- --version |
| 82 | +``` |
| 83 | + |
| 84 | +### Create wrapper |
| 85 | + |
| 86 | +To create a `verilator` script that by default executes version 4.100: |
| 87 | + |
| 88 | +```shell |
| 89 | +$ eda-container-wrapper --write-script=/usr/local/bin/verilator --tool-version 4.100 verilator |
| 90 | +``` |
| 91 | + |
| 92 | +and then execute it: |
| 93 | + |
| 94 | +```shell |
| 95 | +$ verilator --version |
| 96 | +Verilator 4.100 2020-09-07 rev v4.100 |
| 97 | +``` |
| 98 | + |
| 99 | +Setting the environment setting `ECW_TOOL_VERSION` changes the defualt behavior: |
| 100 | + |
| 101 | +```shell |
| 102 | +$ ECW_TOOL_VERSION=4.102 verilator --version |
| 103 | +Verilator 4.102 2020-10-15 rev v4.102 |
| 104 | +``` |
| 105 | + |
| 106 | +It can be useful to create the script in your virtual environment: |
| 107 | + |
| 108 | +```shell |
| 109 | +$ eda-container-wrapper --write-script=$VIRTUAL_ENV/verilator --tool-version 4.100 verilator |
| 110 | +``` |
0 commit comments