#!/bin/csh -fx

set SIM_TOOL=iverilog
set SIM_EXE=test

set N = 22
set SEED = `cat /dev/urandom | head -10 | md5sum -b | cut -b1-8`
set SEED_VLOG = "32'h${SEED}"

set SIM_TOOL=iverilog
set SIM_EXE=./sim_${N}_$SEED.exe
set SIM_LOG=./sim_${N}_$SEED.log


$SIM_TOOL -D POW2_SIM_END=$N -D SEED="$SEED_VLOG" -g2005-sv -o$SIM_EXE test_must.v test_ppa.v tb.v  &&  $SIM_EXE

### Commands for other simulators. When using other simulators please consider using switch sv_seed, which would require also
### a modification in the testbench tb.v. The handling of seeds is working for all simulators, it would be just better coding
### style and maybe better randomization

### Xcelium
# 
# xrun -define POW2_SIM_END=$N -define SEED="$SEED_VLOG" -sv test_must.v test_ppa.v tb.v

### Modelsim / Questa
# 
# qvlib work
# qvmap work work
# qvlog -define POW2_SIM_END=$N -define SEED="$SEED_VLOG" -sv test_must.v test_ppa.v tb.v
# qvopt -work work -o testcase tb
# qvsim -batch -do "run -a" testcase

