#!/bin/bash


SHOME="."
CFG=$2
DIR=$1
SIM="${SHOME}/bin/sim-outorder"

CONFIG=" -config ${SHOME}/configs/${DIR}/${CFG}.txt "
chmod +x bin/*

########
# Default
echo "DEFAULT"
${SIM} ${CONFIG} -redir:prog /dev/null -redir:sim ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ${SHOME}/apps/stringsearch/search_small  
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt

# Vary SIM path
echo "SIM path"
../simhome/../simhome/../simhome/../simhome/${SIM} ${CONFIG} -redir:prog /dev/null -redir:sim ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ${SHOME}/apps/stringsearch/search_small  
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt

# Vary APP path
echo "APP path"
${SIM} ${CONFIG} -redir:prog /dev/null -redir:sim ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ../simhome/../simhome/../simhome/../simhome/${SHOME}/apps/stringsearch/search_small  
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt

# Vary APP path EXTENDED
echo "APP path EXTENDED"
${SIM} ${CONFIG} -redir:prog /dev/null -redir:sim ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ../simhome/../simhome/../simhome/../simhome/../simhome/../simhome/../simhome/../simhome/${SHOME}/apps/stringsearch/search_small
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt

# Vary OUTPUT path
echo "OUTPUT path"
${SIM} ${CONFIG} -redir:prog /dev/null -redir:sim ../simhome/../simhome/../simhome/../simhome/${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ${SHOME}/apps/stringsearch/search_small  
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt

# Vary config path
echo "CONFIG path"
${SIM} -config ../simhome/../simhome/../simhome/../simhome/${SHOME}/configs/${DIR}/${CFG}.txt -redir:prog /dev/null -redir:sim ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt ${SHOME}/apps/stringsearch/search_small  
grep -E "CPI|sim_cycle|sim_num_insn" ${SHOME}/configs/${DIR}/Stats_${CFG}_stringsearch-cabce.txt