blob: 5ffa4318182f5d431113aa0cc175de38b626f413 (
plain)
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
|
#!/usr/bin/python
from components.microprogram import Microprogram
from components.ram import Ram
from components.caretaker import Caretaker
def dump(ram,title): # Simple Helper function
data=ram.getData()
print("---------- "+title+" ----------")
for addr,value in data.items():
print("%-5s: 0x%-3x (%s)"%(addr,value,value))
print("-"*(22+len(title)))
c=Caretaker(5000) # Init components ram size in byte
c["RAM"].loadRamFile("./ram.txt") # Load Ram from file
mic=Microprogram(c) # Create microprogram
dump(c["RAM"], "Ram Before Execution") # Dump ram before execution
mic.run(800, 1024) # Run the microprogram with run(constantPoolLocation,stackLocation)
dump(c["RAM"],"Ram After Execution") # Dump ram after execution
|