-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_simulation.sh
More file actions
executable file
·105 lines (92 loc) · 2.84 KB
/
run_simulation.sh
File metadata and controls
executable file
·105 lines (92 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Enhanced NeoRAM Simulation Script
# Colors for better readability
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Help function
show_help() {
echo -e "${BLUE}NeoRAM Simulation Script${NC}"
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " -t, --test TEST_MODULE Specify test module to run (default: basic)"
echo " -c, --clean Clean before running"
echo " -w, --waves Generate and view waveforms"
echo " -h, --help Show this help message"
echo ""
echo "Available test modules:"
echo " bypass - Run tests in bypass mode (direct SRAM access)"
echo " ecc - Run tests in ECC mode (with error correction)"
echo " full - Run both bypass and ECC modes"
echo " basic - Legacy basic functionality tests"
echo ""
echo "Examples:"
echo " $0 -t ecc -w # Run ECC mode tests with waveform viewing"
echo " $0 -c -t full # Clean and run both bypass and ECC modes"
echo " $0 -t bypass # Run bypass mode tests only"
}
# Find script directory and project root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
# Default options
TEST_MODULE="basic"
CLEAN=0
WAVES=0
# Parse command line arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
-t|--test) TEST_MODULE="$2"; shift ;;
-c|--clean) CLEAN=1 ;;
-w|--waves) WAVES=1 ;;
-h|--help) show_help; exit 0 ;;
*) echo -e "${RED}Unknown parameter: $1${NC}"; show_help; exit 1 ;;
esac
shift
done
# Map test module to actual make targets
case $TEST_MODULE in
bypass) MODE="bypass" ;;
ecc) MODE="ecc" ;;
full) MODE="test-all" ;;
basic) MODE="bypass" ;; # Legacy support
*) MODE="$TEST_MODULE" ;; # Allow custom mode specification
esac
# Check if we're in the right directory
if [ ! -d "$PROJECT_ROOT/sim" ]; then
echo -e "${RED}Error: sim directory not found at $PROJECT_ROOT/sim${NC}"
echo "Please run this script from the project root or scripts directory."
exit 1
fi
# Navigate to sim directory
cd "$PROJECT_ROOT/sim"
# Clean if requested
if [ $CLEAN -eq 1 ]; then
echo -e "${BLUE}Cleaning simulation artifacts...${NC}"
make clean-all
fi
# Run the simulation
echo -e "${BLUE}Running simulation in mode: $MODE${NC}"
if [ $WAVES -eq 1 ]; then
if [ "$MODE" = "test-all" ]; then
make $MODE && make view
else
make run MODE=$MODE && make view
fi
else
if [ "$MODE" = "test-all" ]; then
make $MODE
else
make run MODE=$MODE
fi
fi
# Check if simulation succeeded
if [ $? -ne 0 ]; then
echo -e "${RED}Simulation failed.${NC}"
exit 1
fi
echo -e "${GREEN}Simulation completed successfully!${NC}"
# Return to original directory
cd - > /dev/null