-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (24 loc) · 934 Bytes
/
Copy pathmain.py
File metadata and controls
33 lines (24 loc) · 934 Bytes
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
import tkinter as tk
from gui import MIPS_GUI # Buradaki sınıf adı, gui.py'ye uygun olarak MIPS_GUI olmalı
from instruction_memory import InstructionMemory
from data_memory import DataMemory
def main():
root = tk.Tk()
# Sample program (assembly instructions)
instructions = [
"addi $t0, $zero, 5", # $t0 = 5
"addi $t1, $zero, 5", # $t1 = 5
"add $t2, $t0, $t1" # $t2 = $t0 + $t1
]
# Load instructions into instruction memory
instruction_memory = InstructionMemory()
instruction_memory.load_instructions(instructions)
# Create the GUI and pass the instruction memory, data memory, and CPU simulator
simulator_gui = MIPS_GUI(root)
# Set instruction and data memories
simulator_gui.instruction_memory = instruction_memory
simulator_gui.data_memory = DataMemory()
# Start the main loop
root.mainloop()
if __name__ == "__main__":
main()