#!/bin/sh

if [ $# -eq 0 ]
then
	echo "Usage: runv module_name"
	exit 0
fi 
iverilog -o $1 ${1}.v

status=$?
if [ "$status" != "0" ]
then
	echo "Compilation failed!"
	exit 0
fi

./$1
status=$?
if [ "$status" != "0" ]
then
	echo "Simulation failed!"
	exit 0
fi

gtkwave -f ${1}.vcd &

exit 0