blob: f005b27bbf8ca9599e82f4beb0aced96d5fbf847 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/python
class Caretaker:
def __init__(self):
self.objects=dict() # Create empty objects pool
# Add registers to pool
for reg in ["MAR","MDR", "PC", "MBR", "SP","LV","CPP","TOS","OPC","H"]:
self.objects[reg]=0
self.objects["RAM"]=None
def __getitem__(self,key): # TODO: Allow MBRU key and adapt its return value
return(self.objects[key])
def __setitem__(self,key,value):# TODO: Do special treatment for MBR (allow only 2^8 value)
# TODO: Force data to be at most 32 bits longs (Mic-1 architecture constraint)
self.objects[key]=value
def items(self):
return(self.objects.items())
|