Skip to content

Commit 72f630f

Browse files
author
dwarning
committed
Update the Readme
1 parent c60382d commit 72f630f

File tree

1 file changed

+62
-51
lines changed

1 file changed

+62
-51
lines changed

README.md

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
<img alt="OpenVAF" src="logo_dark.svg">
55
</picture>
66

7-
<br>
87
<br>
98
<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)**.
1014

1115
OpenVAF is a Verilog-A compiler that can compile Verilog-A files for use in circuit simulator.
1216
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:
2024
* **fast simulations** surpassing existing solutions by 30%-60%, often matching handwritten models
2125
* IDE aware design
2226

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)**.
2528

2629
## Projects
2730

@@ -33,39 +36,19 @@ This repository currently contains the following useable projects:
3336
OpenVAF is the main project of the repository and all other tools use OpenVAF as a library in some form.
3437
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.
3538

36-
OpenVAF has been tested with a preliminary NGSPICE prototype and Melange.
39+
OpenVAF has been tested with a NGSPICE prototype.
3740
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.
3942
Furthermore, some Verilog-A language features are currently not supported.
4043

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-
6144
## Building OpenVAF with docker
6245

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:
6447

6548
``` shell
66-
git clone https://github.com/gjcoram/OpenVAF.git && cd OpenVAF
49+
git clone https://github.com/dwarning/OpenVAF.git && cd OpenVAF
6750
# On REHL distros and fedora replace docker with podman
68-
# on all commands below.
51+
# on all commands below.
6952
docker pull ghcr.io/pascalkuthe/ferris_ci_build_x86_64-unknown-linux-gnu:latest
7053
# On Linux distros that enable SELinux linux RHEL based distros and fedora use $(pwd):/io:Z
7154
docker run -ti -v $(pwd):/io ghcr.io/pascalkuthe/ferris_ci_build_x86_64-unknown-linux-gnu:latest
@@ -75,59 +58,78 @@ cd /io
7558
cargo build --release
7659
# OpenVAF will be build this can take a while
7760
# afterwards the binary is available in target/release/openvaf
78-
# inside the repository
61+
# inside the repository
7962
```
8063

81-
## Build Instructions
64+
## Building OpenVAF without docker
8265

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
8467

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.
8570

8671
On Debian and Ubuntu the [LLVM Project provided packages](https://apt.llvm.org/) can be used:
8772

8873
``` shell
89-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
74+
wget https://apt.llvm.org/llvm.sh
75+
chmod +x llvm.sh
76+
sudo ./llvm.sh <version number> all
9077
```
78+
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.
9179

9280
On fedora (37+) you can simply install LLVM from the default repositories:
9381

9482
``` shell
9583
sudo dnf install clang llvm-devel
9684
```
9785

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`
10188

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
10490

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".
10693

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.
11296

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)
11398

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.
115100

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.
118104
```
105+
cmake -S llvm-project-llvmorg-16.0.6\llvm -B build -DCMAKE_INSTALL_PREFIX=C:\LLVM -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" -DLLVM_ENABLE_PROJECTS="llvm;clang"
106+
```
107+
Build and install:
108+
```
109+
cd build
110+
nmake
111+
nmake install
112+
```
113+
The LLVM build needs some time!
119114

120-
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:
121121

122122
``` shell
123123
cargo build --release --bin openvaf
124124
```
125+
Place the binary from `openvaf/target/release` in one location of your PATH.
126+
125127

126128
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.
127129
An example build invocation using shared libraries on debian is shown below:
128130

129131
``` shell
130-
LLVM_LINK_SHARED=1 LLVM_CONFIG="llvm-config-15" cargo build --release
132+
LLVM_LINK_SHARED=1 LLVM_CONFIG="llvm-config-16" cargo build --release
131133
```
132134

133135
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
144146
These can be enabled by setting the `RUN_SLOW_TESTS` environment variable:
145147

146148
``` shell
147-
RUN_SLOW_TESTS=1 cargo nextest run
149+
RUN_SLOW_TESTS=1 cargo nextest run
148150
```
149151

150152
During development, you likely don't want to run full release builds as these
151153
can take a while to build. Debug builds are much faster:
152154
``` shell
153155
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
155157
cargo clippy # check the sourcecode for errors/warnings without building (even faster)
156158
```
157159

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+
158169
## Acknowledgement
159170

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.
161172

162173
## Copyright
163174

0 commit comments

Comments
 (0)