-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (25 loc) · 1.08 KB
/
main.py
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
27
28
29
30
31
32
from MemoryControllerInterfaces import MemoryController
from ClockInterfaces import Clock
from DirectoryControllerInterfaces import DirectoryController
from CacheControllerInterfaces import CacheController
from InterconnectInterfaces import Interconnect
if __name__ == "__main__":
clock = Clock()
memoryController = MemoryController(clock)
directoryController = DirectoryController(clock, memoryController)
cacheController1 = CacheController("Core1", clock)
cacheController2 = CacheController("Core2", clock)
cacheController3 = CacheController("Core3", clock)
interconnect = Interconnect(directoryController, [cacheController1, cacheController2], clock)
while True:
if clock.counter == 0:
cacheController2.storeData(10, 500)
elif clock.counter == 5:
cacheController1.loadData(10)
elif clock.counter == 10:
cacheController3.storeData(10, 200)
interconnect.nextCycle()
choice = input("Continue?(Y)es/(N)o")
if choice == 'N':
exit(0)
clock.tick()