ajout fonctionnalité affichage stack
This commit is contained in:
parent
422289ee55
commit
5359c5178d
@ -33,8 +33,6 @@ scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
|||||||
|
|
||||||
mylist = tk.Listbox(stack_frame, yscrollcommand=scrollbar.set, width=50)
|
mylist = tk.Listbox(stack_frame, yscrollcommand=scrollbar.set, width=50)
|
||||||
|
|
||||||
for line in range(30):
|
|
||||||
mylist.insert(tk.END, "This is line number " + str(line))
|
|
||||||
|
|
||||||
mylist.pack(side=tk.LEFT, fill=tk.BOTH)
|
mylist.pack(side=tk.LEFT, fill=tk.BOTH)
|
||||||
scrollbar.config(command=mylist.yview)
|
scrollbar.config(command=mylist.yview)
|
||||||
@ -151,15 +149,16 @@ label_sp.pack(pady=5)
|
|||||||
#val = subprocess.run(["/usr/bin/python3", "/home/aurelien/Documents/24hducode2026/24H_du_code_2026/Epreuve3.py", "test_bin_epreuve3/call_label.bin"] # transforme bytes en str)
|
#val = subprocess.run(["/usr/bin/python3", "/home/aurelien/Documents/24hducode2026/24H_du_code_2026/Epreuve3.py", "test_bin_epreuve3/call_label.bin"] # transforme bytes en str)
|
||||||
|
|
||||||
|
|
||||||
with open("test_bin_epreuve3/sub_val.bin", "rb") as f:
|
with open("test_bin_epreuve3/cmp_reg.bin", "rb") as f:
|
||||||
program = f.read()
|
program = f.read()
|
||||||
|
|
||||||
sim = e3.Simulator(program)
|
sim = e3.Simulator(program)
|
||||||
sim_iter = sim.run()
|
sim_iter = sim.run()
|
||||||
|
|
||||||
|
previous_sp = None # Initialisation avant la première itération
|
||||||
|
|
||||||
def update_gui():
|
def update_gui():
|
||||||
|
global previous_sp # Accéder à la variable globale previous_sp
|
||||||
try:
|
try:
|
||||||
state = next(sim_iter)
|
state = next(sim_iter)
|
||||||
|
|
||||||
@ -178,9 +177,19 @@ def update_gui():
|
|||||||
label_sp.config(text=f"{state['sp']:02X}")
|
label_sp.config(text=f"{state['sp']:02X}")
|
||||||
|
|
||||||
|
|
||||||
# 👉 exemple registres
|
# Vérification du changement de valeur de SP
|
||||||
# registre_1_label.config(text=state["regs"][0])
|
if previous_sp is not None:
|
||||||
# registre_2_label.config(text=state["regs"][1])
|
print(f"SP actuel : {state['sp']}")
|
||||||
|
# Si SP se décrémente
|
||||||
|
if state['sp'] < previous_sp:
|
||||||
|
mylist.insert(tk.END, state['sp'])
|
||||||
|
# Si SP se réincrémente
|
||||||
|
elif state['sp'] > previous_sp:
|
||||||
|
if mylist.size() > 0:
|
||||||
|
mylist.delete(tk.END) # On enlève la dernière ligne
|
||||||
|
|
||||||
|
# Mettre à jour la valeur précédente de SP pour la prochaine itération
|
||||||
|
previous_sp = state['sp']
|
||||||
|
|
||||||
# relance automatique
|
# relance automatique
|
||||||
root.after(200, update_gui)
|
root.after(200, update_gui)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user