execute_test.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # arg handling
  3. for arg in "$@"; do
  4. # check args
  5. case ${arg} in
  6. -n|--no-gui)
  7. headless=true
  8. continue
  9. ;;
  10. -a|--asm)
  11. asm=true
  12. continue
  13. ;;
  14. -h|--help)
  15. help=true
  16. continue
  17. ;;
  18. -c|--compile)
  19. recompile=true
  20. continue
  21. esac
  22. done
  23. [ ! -z $help ] && echo "usage: execute_test.sh [-h|--help] [-n|--no-gui] [-a|--asm]
  24. -h|--help: show this message
  25. -n|--no-gui: don't open modelsim gui
  26. -a|--asm: use asm (.S) files instead of c (.c)" && exit 0
  27. target=sim_gui
  28. language=c
  29. language_file_ending=c
  30. [ ! -z $headless ] && target=sim
  31. [ ! -z $asm ] && language=asm && language_file_ending=S
  32. [ ! -z $recompile ] && (pwd=$(pwd); cd ../software/$language/; make clean; make; cd $pwd)
  33. # make
  34. make compile
  35. # search and select
  36. select program in $(ls ../software/$language/ | grep -e "\.$language_file_ending" | sed -e "s/\.$language_file_ending$//g") exit; do
  37. case $program in
  38. exit) echo "exiting"
  39. break ;;
  40. *) echo "running $program.$language_file_ending"; make $target IMEM=../software/$language/$program.imem.mif DMEM=../software/$language/$program.dmem.mif TIME=1ms;
  41. esac
  42. done