-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulate_opensource.sh
More file actions
executable file
·62 lines (52 loc) · 2.01 KB
/
simulate_opensource.sh
File metadata and controls
executable file
·62 lines (52 loc) · 2.01 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
#!/bin/bash
echo "=========================================="
echo "MIPS Processor Simulation (Dec 2021)"
echo "=========================================="
echo "Simulating with Icarus Verilog..."
if ! command -v iverilog &> /dev/null
then
echo "Icarus Verilog not found. Installing..."
sudo apt-get update
sudo apt-get install -y iverilog gtkwave
fi
cd "$(dirname "$0")"
echo "Compiling Verilog files..."
iverilog -o mips_sim.vvp \
MIPS_Processor.srcs/sources_1/new/mux_2to1_32bit.v \
MIPS_Processor.srcs/sources_1/new/mux_2to1_5bit.v \
MIPS_Processor.srcs/sources_1/new/Sign_Extend.v \
MIPS_Processor.srcs/sources_1/new/ALU.v \
MIPS_Processor.srcs/sources_1/new/ALU_Control.v \
MIPS_Processor.srcs/sources_1/new/Data_Memory.v \
MIPS_Processor.srcs/sources_1/new/Register_File.v \
MIPS_Processor.srcs/sources_1/new/Control_Unit.v \
MIPS_Processor.srcs/sources_1/new/Instruction_Memory.v \
MIPS_Processor.srcs/sources_1/new/PC.v \
MIPS_Processor.srcs/sources_1/new/MIPS.v \
MIPS_Processor.srcs/sim_1/new/MIPS_tb.v
if [ $? -eq 0 ]; then
echo "Running simulation..."
mkdir -p simulation_results
vvp mips_sim.vvp | tee simulation_results/simulation_log.txt
if [ -f mips_waveform.vcd ]; then
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
cp mips_waveform.vcd simulation_results/mips_waveform_${TIMESTAMP}.vcd
echo ""
echo "=========================================="
echo "Simulation complete!"
echo "=========================================="
echo "Results saved:"
echo " - Waveform: simulation_results/mips_waveform_${TIMESTAMP}.vcd"
echo " - Log: simulation_results/simulation_log.txt"
echo ""
echo "To view waveforms:"
echo " gtkwave simulation_results/mips_waveform_${TIMESTAMP}.vcd"
echo ""
ls -lh simulation_results/
else
echo "Warning: Waveform file not generated"
fi
else
echo "Compilation failed!"
exit 1
fi