Added a GUI

This commit is contained in:
2023-03-13 22:44:24 +02:00
parent 448186c0b0
commit 4381c5f76a
13 changed files with 32912 additions and 32768 deletions
+1
View File
@@ -13,6 +13,7 @@ class ROM32K:
for i in range(16):
self.out[i].out=instuction[i]
def loadROM(self,file_path):
self.memory.clear()
f=open(file_path,"r")
for _ in range(32768):
line=f.readline()
Binary file not shown.
+1 -1
View File
@@ -14,7 +14,7 @@
0000000000000000 0
0000000000000000 0
0000000000000000 0
0000000000000000 0
0000000000000001 1
0000000000000000 0
0000000000000000 0
0000000000000000 0
+32767 -32767
View File
File diff suppressed because it is too large Load Diff
-31
View File
@@ -1,31 +0,0 @@
from Source.Computer import Computer
from Source.Pre_Built_Gates.Power import Power
def bool_to_int(a):
x=0
for i in range(15,0,-1):
x+=int(a[i])*(2**(15-i))
if a[0]=="1":
x=x-32768
return x
def main():
reset=Power(True)
computer=Computer(reset,"Source/ROM_Data.txt")
reset.out=False
computer.Memory.log_memory()
while(True):
computer()
computer.Memory.log_memory()
a_reg=[str(int(computer.CPU.A_register.out[i].out)) for i in range(16)]
d_reg=[str(int(computer.CPU.D_register.out[i].out)) for i in range(16)]
clock=[str(int(computer.CPU.PC.out[i].out)) for i in range(16)]
command=[str(int(computer.CPU.instruction.out[i].out)) for i in range(16)]
print("A Register: "+ "".join(a_reg) + " " + str(bool_to_int(a_reg)))
print("D Register: "+ "".join(d_reg) + " " + str(bool_to_int(d_reg)))
print("Clock cycle: "+ "".join(clock) + " " + str(bool_to_int(clock)))
print("Command: "+ "".join(command))
print()
if __name__ == "__main__":
main()