You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-51Lines changed: 62 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,13 @@
4
4
<imgalt="OpenVAF"src="logo_dark.svg">
5
5
</picture>
6
6
7
-
<br>
8
7
<br>
9
8
<br>
9
+
<br>
10
+
11
+
## About this repository
12
+
13
+
This project is a fork of the ingenious work of **Pascal Kuthe [website](https://github.com/pascalkuthe/OpenVAF)**.
10
14
11
15
OpenVAF is a Verilog-A compiler that can compile Verilog-A files for use in circuit simulator.
12
16
The major aim of this Project is to provide a high-quality standard compliant compiler for Verilog-A.
@@ -20,8 +24,7 @@ Some highlights of OpenVAF include:
20
24
***fast simulations** surpassing existing solutions by 30%-60%, often matching handwritten models
21
25
* IDE aware design
22
26
23
-
Detailed documentation, examples and precompiled binaries of all release are **available on our [website](https://openvaf.semimod.de)**. To test the latest development version you can download nightly version of OpenVAF for [linux](https://openva.fra1.digitaloceanspaces.com/openvaf_devel-x86_64-unknown-linux-gnu.tar.gz) or [windows](https://openva.fra1.digitaloceanspaces.com/openvaf_devel-x86_64-pc-windows-msvc.tar.gz).
24
-
27
+
Detailed documentation, examples and precompiled binaries of all release are **available on our [website](https://openvaf.semimod.de)**.
25
28
26
29
## Projects
27
30
@@ -33,39 +36,19 @@ This repository currently contains the following useable projects:
33
36
OpenVAF is the main project of the repository and all other tools use OpenVAF as a library in some form.
34
37
OpenVAF can be build as a standalone CLI program that can compile Verilog-A files to shared objects that comply with the simulator independent OSDI interface.
35
38
36
-
OpenVAF has been tested with a preliminary NGSPICE prototype and Melange.
39
+
OpenVAF has been tested with a NGSPICE prototype.
37
40
It can already support a large array of compact models.
38
-
However, due to the larger feature set (compared to VerilogAE) additional testing and verification is still required.
41
+
However, due to the larger feature set additional testing and verification is still required.
39
42
Furthermore, some Verilog-A language features are currently not supported.
40
43
41
-
### VerilogAE
42
-
43
-
Allows obtaining model equations (calculates the value of a single Variable) from Verilog-A files.
44
-
VerilogAE is primarily useable from python (available on pypi) but can also be compiled as a static/shared library and called by any programming language (that supports the C ABI).
45
-
46
-
VerilogAE is used in production at SemiMod and various partners.
47
-
Its stable and ready for general use.
48
-
49
-
### Melange
50
-
51
-
Melange is an experimental circuit simulator that leverage OpenVAF to gain access to compact models.
52
-
This allows it to easily support a large array of models without the huge effort associated with traditional simulators.
53
-
The focus of Melange is primarily on automation.
54
-
That means Melange focuses on providing an ergonomic and extensible API in mainstream programming languages (python and rust currently) instead of a special purpose netlist format.
55
-
However, to remain compatible with existing PDKs a subset of the spectre netlist format can be parsed.
56
-
57
-
Melange is currently in early development and most features are not complete.
58
-
Some mockups of planned usage can be found in `melange/examples`.
59
-
Some working minimal examples (in rust) can be found in `melange/core/test.rs`.
60
-
61
44
## Building OpenVAF with docker
62
45
63
-
The official docker image contains everything required for compiling OpenVAF. To build OpenVAF using the official docker containers, simply run the following commands:
46
+
The official docker image contains everything required for compiling OpenVAF. To build OpenVAF using the docker containers, simply run the following commands:
# On Linux distros that enable SELinux linux RHEL based distros and fedora use $(pwd):/io:Z
71
54
docker run -ti -v $(pwd):/io ghcr.io/pascalkuthe/ferris_ci_build_x86_64-unknown-linux-gnu:latest
@@ -75,59 +58,78 @@ cd /io
75
58
cargo build --release
76
59
# OpenVAF will be build this can take a while
77
60
# afterwards the binary is available in target/release/openvaf
78
-
# inside the repository
61
+
# inside the repository
79
62
```
80
63
81
-
## Build Instructions
64
+
## Building OpenVAF without docker
82
65
83
-
OpenVAF **requires rust/cargo 1.64 or newer** (best installed with [rustup](https://rustup.rs/)). Furthermore, the **LLVM-15** development libraries and **clang-15** are required. Newer version also work but older versions of LLVM/clang are not supported. Note that its imperative that **you clang version matches your LLVM version**. If you want to compile VerilogAE python 3.8+ is also required.
66
+
### Prerequisite under linux
84
67
68
+
OpenVAF **requires rust/cargo 1.64 or newer** (best installed with [rustup](https://rustup.rs/)). Furthermore, the **LLVM-15** development libraries and **clang-15** are required. Newer version also work but older versions of LLVM/clang are not supported. Note that its imperative that **you clang version matches your LLVM version**.
69
+
Cargo (rustc is included) should installed by the normal apt command.
85
70
86
71
On Debian and Ubuntu the [LLVM Project provided packages](https://apt.llvm.org/) can be used:
Please use version number <17, e.g. 15.0.7 or 16.0.6. Higher gives trouble with some libs used in openVAF. Pascals docker image uses 16.
91
79
92
80
On fedora (37+) you can simply install LLVM from the default repositories:
93
81
94
82
```shell
95
83
sudo dnf install clang llvm-devel
96
84
```
97
85
98
-
On Linux distributions where packages for LLVM-15 are not available (like centos-7) and windows you can download the prebuild LLVM packages that are also used
99
-
in our docker images. These binaries are build on centos-7 and will therefore
100
-
work on any linux distribution (that is supported by rustc):
86
+
Environment variable (in case there are different LLVM versions installed): `LLVM_CONFIG=/usr/lib/llvm-16/bin/llvm-config`
87
+
PATH should include: `usr/lib/llvm-16/bin`
101
88
102
-
*[clang and LLVM for windows](https://openva.fra1.cdn.digitaloceanspaces.com/llvm-15.0.7-x86_64-pc-windows-msvc-FULL.tar.zst)
103
-
*[clang and LLVM for linux](https://openva.fra1.cdn.digitaloceanspaces.com/llvm-15.0.7-x86_64-unknown-linux-gnu-FULL.tar.zst)
89
+
### Prerequisite under Windows
104
90
105
-
Simply download and extract these tar archives and set the `LLLVM_CONFIG` (see below) environment variable to point at the downloaded files: `LLVM_CONFIG=<extracted directory>/bin/llvm-config`.
91
+
Download [rustup-init](https://win.rustup.rs), run it to install Cargo/Rust.
92
+
During installation select "Customize installation" and set profile to "complete".
106
93
107
-
> Note: To decompress this archive you need to use the following command:
108
-
> ```shell
109
-
> zstd -d -c --long=31 <path/to/archive.tar.zst>| tar -xf -
110
-
>```
111
-
> afterwards the decompressed files can be found in`./LLVM`
94
+
Install Visual Studio Community Edition (tested with version 2019 and 2022). There are alternative ways only to install MSVC compiler, linker & other tools, also headers/libraries from Windows SDK by using this [download and install tool](https://github.com/Data-Oriented-House/PortableBuildTools).
95
+
Make sure you install CMake Tools that come with Visual Studio or by alternative windows installation.
112
96
97
+
Build LLVM and Clang, download [LLVM 16.0.6](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6) sources (get the .zip file)
113
98
114
-
Once all dependencies have been installed you can build the entire project by running:
99
+
Unpack the sources. This creates directory `llvm-project-llvmorg-16.0.6`. Create a directory named `build` in parallel.
115
100
116
-
``` shell
117
-
cargo build --release
101
+
Start Visual Studio x64 native command prompt.
102
+
Run CMake, using nmake as build system (default). Alternativ Ninja build system is possible by given switch `-G ninja'.
103
+
Replace `c:\llvm` with the path where you want your LLVM and Clang binaries and libraries to be installed.
To only build OpenVAF (and ignore melange/VerilogAE) you can run:
115
+
Environment variable (in case there are different LLVM versions installed): `LLVM_CONFIG=C:\LLVM\bin\llvm-config.exe`
116
+
PATH should include: `C:\LLVM\bin`
117
+
118
+
### Build OpenVAF
119
+
120
+
To build OpenVAF you can run:
121
121
122
122
```shell
123
123
cargo build --release --bin openvaf
124
124
```
125
+
Place the binary from `openvaf/target/release` in one location of your PATH.
126
+
125
127
126
128
By default, OpenVAF will link against the static LLVM libraries, to avoid runtime dependencies. This is great for creating portable binaries but sometimes building with shared libraries is preferable. Simply set the `LLVM_LINK_SHARED` environment variable during linking to use the shared system libraries. If multiple LLVM versions are installed (often the case on debian) the `LLVM_CONFIG` environment variable can be used to specify the path of the correct `llvm-config` binary.
127
129
An example build invocation using shared libraries on debian is shown below:
OpenVAF includes many integration and unit tests inside its source code.
@@ -144,20 +146,29 @@ By default, the test suite will skip slow integration tests that compile entire
144
146
These can be enabled by setting the `RUN_SLOW_TESTS` environment variable:
145
147
146
148
```shell
147
-
RUN_SLOW_TESTS=1 cargo nextest run
149
+
RUN_SLOW_TESTS=1 cargo nextest run
148
150
```
149
151
150
152
During development, you likely don't want to run full release builds as these
151
153
can take a while to build. Debug builds are much faster:
152
154
```shell
153
155
cargo build # debug build
154
-
cargo run --bin opnevaf test.va # create a debug build and run it
156
+
cargo run --bin openvaf test.va # create a debug build and run it
155
157
cargo clippy # check the sourcecode for errors/warnings without building (even faster)
156
158
```
157
159
160
+
## Download binaries and usage OpenVAF
161
+
162
+
You can download binaries for Linux and Windows [here](https://github.com/dwarning/OpenVAF/releases/tag/v1.0).
163
+
OpenVAF needs a linker. On Linux at most linke is part of the operating system - on windows you need the MS linker `link.exe`.
164
+
165
+
```shell
166
+
openvaf your_verilog-a-model.va
167
+
```
168
+
158
169
## Acknowledgement
159
170
160
-
The architectures of the [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) and [rustc](https://github.com/rust-lang/rust/) have heavily inspired the design of this compiler.
171
+
Geoffrey Coram and Arpad Buermen are authors of several bugfixes included in this fork.
0 commit comments