parent
dacfad9585
commit
8fab49b213
@ -0,0 +1,463 @@
|
||||
from UI import *
|
||||
# import tkinter as tk
|
||||
|
||||
|
||||
class Print_line:
|
||||
def show(self):
|
||||
lines = ['PC_MAD', 'SIG_MEM', 'SIG_IR', 'IR_SIG', 'IR_MCO', 'MCO_IR', 'MCO_MEM', 'MEM_MCO', 'MAD_MEM',
|
||||
'PC_SIG', 'SIG_PC', 'MCO_PC', 'IR_MAD', 'SIG_R1', 'SIG_R2', 'SIG_R3', 'SIG_R4', 'MCO_R1',
|
||||
'MCO_R2', 'MCO_R3', 'MCO_R4', 'R1_MCO', 'R2_MCO', 'R3_MCO', 'R4_MCO', 'SIG_ALU']
|
||||
for l in lines:
|
||||
if cpu.SigObj[l][1] == False:
|
||||
eval('self.' + l + '(cv, -1)')
|
||||
for l in lines:
|
||||
if cpu.SigObj[l][1] == True:
|
||||
eval('self.' + l + '(cv, 1)')
|
||||
|
||||
# print(cpu.SigObj[l][1])
|
||||
|
||||
def all(self):
|
||||
lines = ['PC_MAD', 'SIG_MEM', 'SIG_IR', 'IR_SIG', 'IR_MCO', 'MCO_IR', 'MCO_MEM', 'MEM_MCO', 'MAD_MEM',
|
||||
'PC_SIG', 'SIG_PC', 'MCO_PC', 'IR_MAD', 'SIG_R1', 'SIG_R2', 'SIG_R3', 'SIG_R4', 'MCO_R1',
|
||||
'MCO_R2', 'MCO_R3', 'MCO_R4', 'R1_MCO', 'R2_MCO', 'R3_MCO', 'R4_MCO', 'SIG_ALU']
|
||||
for l in lines:
|
||||
eval('self.' + l + '(cv, 1)')
|
||||
|
||||
def init(self):
|
||||
lines = ['PC_MAD', 'SIG_MEM', 'SIG_IR', 'IR_SIG', 'IR_MCO', 'MCO_IR', 'MCO_MEM', 'MEM_MCO', 'MAD_MEM',
|
||||
'PC_SIG', 'SIG_PC', 'MCO_PC', 'IR_MAD', 'SIG_R1', 'SIG_R2', 'SIG_R3', 'SIG_R4', 'MCO_R1',
|
||||
'MCO_R2', 'MCO_R3', 'MCO_R4', 'R1_MCO', 'R2_MCO', 'R3_MCO', 'R4_MCO', 'SIG_ALU']
|
||||
# for l in lines:
|
||||
# eval('self.' + l + '(cv, 0)')
|
||||
for l in lines:
|
||||
eval('self.' + l + '(cv, -1)')
|
||||
|
||||
|
||||
def mark(self, lines):
|
||||
for i in range(5):
|
||||
if i:
|
||||
time.sleep(cpu.time)
|
||||
if i % 2:
|
||||
for l in lines:
|
||||
# print('self.' + l + '(cv, 1)')
|
||||
# self.init()
|
||||
eval('self.' + l + '(cv, 1)')
|
||||
else:
|
||||
for l in lines:
|
||||
# print('self.' + l + '(cv, 0)')
|
||||
# self.init()
|
||||
eval('self.' + l + '(cv, -1)')
|
||||
cv.update()
|
||||
|
||||
|
||||
def PC_MAD(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(500, 469 + 4.5, 480 + 120 + 12, 469 + 4.5, width=9, arrow=LAST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(500, 469 + 4.5, 480 + 120 + 12, 469 + 4.5, width=9, arrow=LAST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
def SIG_MEM(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(185 + 4.5, 635, 185 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(185 + 4.5, 660, 635, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(635, 550 - 5, 635, 660, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(185 + 4.5, 635, 185 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(185 + 4.5, 660, 635, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(635, 550 - 5, 635, 660, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_IR(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(281 + 10, 575 + 4.5, 334, 575 + 4.5, width=9, arrow=LAST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(281 + 10, 575 + 4.5, 334, 575 + 4.5, width=9, arrow=LAST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def IR_SIG(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(281, 575 + 4.5, 334 - 10, 575 + 4.5, width=9, arrow=FIRST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(281, 575 + 4.5, 334 - 10, 575 + 4.5, width=9, arrow=FIRST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def IR_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(500, 580, 580, 580, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 580, 580, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(500, 580, 580, 580, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 580, 580, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_IR(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(490, 580, 580, 580, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 580, 580, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(490, 580, 580, 580, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 580, 580, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_MEM(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(780, 245, 780, 273, width=9, capstyle=ROUND, arrow=LAST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(780, 245, 780, 273, width=9, capstyle=ROUND, arrow=LAST, fill=NOMARK)
|
||||
|
||||
cv.update()
|
||||
|
||||
def MEM_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(820, 245, 820, 273, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(820, 245, 820, 273, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
|
||||
cv.update()
|
||||
|
||||
def PC_SIG(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(230 + 5, 510, 230 + 5, 525, width=10, arrow=LAST, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(230 + 5, 505 + 5, 230 + 180, 505 + 5, width=10, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(405 + 5, 497, 405 + 5, 510, width=10, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(230 + 5, 510, 230 + 5, 525, width=10, arrow=LAST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(230 + 5, 505 + 5, 230 + 180, 505 + 5, width=10, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(405 + 5, 497, 405 + 5, 510, width=10, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_PC(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(230 + 5, 510, 230 + 5, 518, width=10, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(230 + 5, 505 + 5, 230 + 180, 505 + 5, width=10, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(405 + 5, 490, 405 + 5, 490 + 20, width=10, arrow=FIRST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(230 + 5, 510, 230 + 5, 518, width=10, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(230 + 5, 505 + 5, 230 + 180, 505 + 5, width=10, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(405 + 5, 490, 405 + 5, 490 + 20, width=10, arrow=FIRST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def IR_MAD(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(500, 580, 580, 580, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 510, 580, 580, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 510, 610, 510, width=9, capstyle=ROUND, fill=color1, arrow=LAST)
|
||||
|
||||
else:
|
||||
cv.create_line(500, 580, 580, 580, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 510, 580, 580, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 510, 610, 510, width=9, capstyle=ROUND, fill=NOMARK, arrow=LAST)
|
||||
cv.update()
|
||||
|
||||
def SIG_R1(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 30, 620, 103, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 103, 620, 103, width=10, arrow=FIRST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 30, 620, 103, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 103, 620, 103, width=10, arrow=FIRST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_R2(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 30, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 190, 515, 190, width=9, capstyle=ROUND, arrow=LAST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 30, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 190, 515, 190, width=9, capstyle=ROUND, arrow=LAST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_R3(self, cv: tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 30, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 280, 550, 280, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 30, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 280, 550, 280, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_R4(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 30, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(120 + 4.5, 635, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 660, 120 + 4.5, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 40, 660, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(40, 30, 620, 30, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 30, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_R1(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 103, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 103, 620, 103, width=10, arrow=FIRST, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 103, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 103, 620, 103, width=10, arrow=FIRST, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def R1_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=color1, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 103, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515 + 10, 103, 620, 103, width=10, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=NOMARK, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 103, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515 + 10, 103, 620, 103, width=10, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_R2(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 190, 515, 190, width=9, capstyle=ROUND, arrow=LAST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 190, 515, 190, width=9, capstyle=ROUND, arrow=LAST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def R2_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=color1, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(538, 190, 525, 190, width=9, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=NOMARK, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 620, 120, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 120, 538, 190, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(538, 190, 525, 190, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_R3(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 280, 550, 280, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 280, 550, 280, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def R3_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=color1, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(525, 280, 550, 280, width=9, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=NOMARK, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 620, 140, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(550, 140, 550, 280, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(525, 280, 550, 280, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def MCO_R4(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(515, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 10, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(515, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def R4_MCO(self,cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=color1, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(525, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 215, 770, 145, width=9, capstyle=ROUND, fill=NOMARK, arrow=FIRST)
|
||||
cv.create_line(620, 145, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 620, 160, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(565, 160, 565, 370, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(525, 370, 565, 370, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
def SIG_ALU(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(85, 578, 55, 578, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(55, 232, 55, 578, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(55, 232, 90, 232, width=9, capstyle=ROUND, fill=color1, arrow=LAST)
|
||||
|
||||
else:
|
||||
cv.create_line(85, 578, 55, 578, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(55, 232, 55, 578, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(55, 232, 90, 232, width=9, capstyle=ROUND, fill=NOMARK, arrow=LAST)
|
||||
cv.update()
|
||||
|
||||
def MAD_MEM(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(635, 353, 635, 320, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(670, 320, 635, 320, width=9, capstyle=ROUND, fill=color1, arrow=FIRST)
|
||||
|
||||
else:
|
||||
cv.create_line(635, 353, 635, 320, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(670, 320, 635, 320, width=9, capstyle=ROUND, fill=NOMARK, arrow=FIRST)
|
||||
cv.update()
|
||||
|
||||
def MCO_PC(self, cv:tk.Canvas, flag):
|
||||
if flag == 1:
|
||||
cv.create_line(490, 469 + 4.5, 580, 469 + 4.5, width=9, capstyle=ROUND, arrow=FIRST, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 580, 469 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
cv.create_line(770, 220 - 15, 770, 145, width=9, capstyle=ROUND, fill=color1)
|
||||
|
||||
else:
|
||||
cv.create_line(490, 469 + 4.5, 580, 469 + 4.5, width=9, capstyle=ROUND, arrow=FIRST, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 580, 469 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(580, 180 + 4.5, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(620, 145, 620, 180 + 4.5, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 145, 620, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.create_line(770, 220 - 15, 770, 145, width=9, capstyle=ROUND, fill=NOMARK)
|
||||
cv.update()
|
||||
|
||||
if __name__ == '__main__':
|
||||
from ALU import *
|
||||
# al = ALU()
|
||||
# al.init(cv, root)
|
||||
|
||||
co = Print_line()
|
||||
# co.all()
|
||||
# co.init()
|
||||
# co.MCO_IR(cv, 1)
|
||||
cpu.SigObj['MCO_PC'][1] = True
|
||||
cpu.SigObj['MCO_IR'][1] = True
|
||||
# co.mark(['PC_SIG'])
|
||||
co.show()
|
||||
# co.mark(['SIG_PC'])
|
||||
# co.init()
|
||||
|
||||
|
||||
|
||||
def left1(event):
|
||||
print(event.x,event.y)
|
||||
cv.bind('<Button-1>', left1)
|
||||
root.mainloop()
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,72 @@
|
||||
# from program import *
|
||||
from ExecInstructWithAnim import *
|
||||
from ExecInstructWithText import *
|
||||
|
||||
r = RightPanel()
|
||||
run_ani = ExecInstructWithAnim()
|
||||
run_text = ExecInstructWithText()
|
||||
|
||||
bw, bh = 150, 45
|
||||
# 按钮1
|
||||
bx1, by1 = 750, 30
|
||||
Button1 = tk.Button(root, text='自动执行指令(仅寄存器)', background=GOLD, command=lambda: Program1(), state=NORMAL)
|
||||
Button1.place(x=bx1, y=by1, width=bw, height=bh)
|
||||
|
||||
|
||||
def Program1():
|
||||
if run_text.play == 1 or run_ani.play == 1:
|
||||
messagebox.showwarning('警告', '程序正在运行')
|
||||
return
|
||||
run_text.auto_display()
|
||||
|
||||
|
||||
# 按钮2
|
||||
bx2, by2 = 750, 90
|
||||
Button2 = tk.Button(root, text='自动执行指令(带UI)', background=GOLD, command=lambda: Program2(), state=NORMAL)
|
||||
Button2.place(x=bx2, y=by2, width=bw, height=bh)
|
||||
|
||||
|
||||
def Program2():
|
||||
if run_text.play == 1 or run_ani.play == 1:
|
||||
messagebox.showwarning('警告', '程序正在运行')
|
||||
return
|
||||
run_ani.auto_display()
|
||||
|
||||
|
||||
# 按钮3
|
||||
bx2, by2 = 820, 150
|
||||
WR = tk.Button(root, text='装载程序', background=RED, command=lambda: r.write_memory(), state=NORMAL)
|
||||
WR.place(x=bx2, y=by2, width=80, height=bh)
|
||||
|
||||
|
||||
def main():
|
||||
# 右键菜单
|
||||
def onRightButtonUp(event):
|
||||
menu.post(event.x_root, event.y_root)
|
||||
|
||||
menu = tk.Menu(root, tearoff=0)
|
||||
menu.add_command(label='运算器', command=lambda: r.CAL_display())
|
||||
menu.add_command(label='控制器', command=lambda: r.SIG_display())
|
||||
menu.add_command(label='存储器', command=lambda: r.MEM_display())
|
||||
|
||||
cv.bind('<ButtonRelease-3>', onRightButtonUp)
|
||||
root.mainloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from pycallgraph2 import PyCallGraph
|
||||
from pycallgraph2.output import GraphvizOutput
|
||||
from pycallgraph2 import Config
|
||||
from pycallgraph2 import GlobbingFilter
|
||||
|
||||
output = GraphvizOutput(font_size=30)
|
||||
output.output_file = "basic.png"
|
||||
output.group_font_size = 40
|
||||
config = Config()
|
||||
config.trace_filter = GlobbingFilter(include=[
|
||||
'RightPanel.*',
|
||||
'ExecInstructWithAnim.*',
|
||||
'ExecInstructWithText.*',
|
||||
])
|
||||
with PyCallGraph(output=output, config=config):
|
||||
main()
|
Binary file not shown.
Loading…
Reference in new issue