# OVPSim Environment Setup
contributed by < `hanqun0723` >
Email : hanqun0723@gmail.com
---
Installation Guide : http://www.ovpworld.org/documents/Imperas_Installation_and_Getting_Started.pdf
1. Register : http://www.ovpworld.org/forumspage

2. Download :
* OVPsim Fast Simulator: “OVPsim (RISCV bare metal platforms and examples)”
* RISC-V Models: “andes_riscv.model”
* RISC-V Toolchains: “riscv.toolchain”
```c
$ chmod +x chmod +X OVPsim.20191106.0.Linux32.exe
$ chmod +X andes_riscv.model.20191106.0.Linux32.exe
$ riscv.toolchain.20191106.0.Linux32.exe
$ ./OVPsim.20191106.0.Linux32.exe
$ ./andes_riscv.model.20191106.0.Linux32.exe
$ ./riscv.toolchain.20191106.0.Linux32.exe
// always select yes
```
3. Install package :
```c
sudo apt-get install g++-multilib lsb lib32z1
```
4. Download the ovp.rc file given by the teacher then edit
```c
export IMPERAS_HOME=/home/hanqun/homework/systemc-2/project1/Imperas.20191106
export IMPERAS_RUNTIME=OVPsim
export IMPERAS_PERSONALITY=CPUMAN_STANDARD
export IMPERAS_SHRSUF=so
export IMPERAS_ISS=iss.exe
source $IMPERAS_HOME/bin/setup.sh
source $IMPERAS_HOME/bin/switchRuntime.sh
#source $IMPERAS_HOME/bin/selectPersonality.sh
setupImperas $IMPERAS_HOME -m32
export PATH=$PATH:$IMPERAS_HOME/bin/$IMPERAS_ARCH:/.
if [ -n "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH=$IMPERAS_HOME/bin/$IMPERAS_ARCH:$IMPERAS_HOME/lib/$IMPERAS_ARCH/External/lib
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IMPERAS_HOME/bin/$IMPERAS_ARCH:$IMPERAS_HOME/lib/$IMPERAS_ARCH/External/lib
fi
```
5. edit bashrc
```
sudo vim ~/.bashrc
source /home/hanqun/homework/systemc-2/project1/ovp.rc //add this line to the bottom
```
then you can type this command line to see the environment variable
```
env | grep IMP
```

The success message will look like this

:::info
If you have error like this

Comment out these lines
setup.sh

switchRuntime.sh

:::
6. Register Lincense : http://www.ovpworld.org/likey/?action=accept#sectionForm

You will receive an email after completing the registration, copy the content to the OVPsim.lic under ==IMPERAS.20191106== folder.
7. Then you can run the example file
```
cd ~/Imperas.20191106/Examples/HelloWorld/usingCPP
./example.sh
```
Result :

:::warning
If you encounter the problem that the hostid is different from the license, follow the step in Imperas_Installation_and_Getting_Started F.5.1


:::
---
Reference :
1. getting-started-with-ovp-and-imperas :
http://www.ovpworld.org/getting-started-with-ovp-and-imperas
2. riscv-ovpsim :
https://github.com/riscv/riscv-ovpsim