diff options
| author | Loic GUEGAN <loic.guegan@yahoo.fr> | 2018-09-03 13:10:39 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic.guegan@yahoo.fr> | 2018-09-03 13:10:39 +0200 |
| commit | 170d8906b9880f94bb3d6def66a5fe4040b3576e (patch) | |
| tree | 5cfe0d48888f9747b017c8d60d040c214d7568c8 | |
| parent | ce32e5889f9645e1fb2fd99bc6e9ce4b5528141d (diff) | |
Pretty print
| -rwxr-xr-x | MicSim/micsim.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/MicSim/micsim.py b/MicSim/micsim.py index c4cb6c3..23a91fe 100755 --- a/MicSim/micsim.py +++ b/MicSim/micsim.py @@ -4,8 +4,23 @@ from components.microprogram import Microprogram from components.ram import Ram from components.caretaker import Caretaker -c=Caretaker(5000) # Init components (stackLocation) -c["RAM"].loadRamFile("./ram.txt") # Load Ram from file +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 micro program +dump(c["RAM"], "Ram Before Execution") # Dump ram before execution +mic.run(800, 1024) # Run the micro program with run(constantPoolLocation,stackLocation) +dump(c["RAM"],"Ram After Execution") # Dump ram after execution + + + + -mic=Microprogram(c) # Create micro program -mic.run(800, 1024) # Run the micro program with run(constantPoolLocation,stackLocation) |
