-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemory.py
More file actions
31 lines (26 loc) · 1 KB
/
Memory.py
File metadata and controls
31 lines (26 loc) · 1 KB
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
class Memory:
def __init__(self, capacity, wcet_scale, power_active, power_idle):
self.capacity = capacity
self.wcet_scale = wcet_scale
self.power_active = power_active
self.power_idle = power_idle
self.used_capacity = 0
class Memories:
def __init__(self):
self.list = []
self.n_mem_types = 0
self.total_capacity = 0
def insert_memory(self, capacity, wcet_scale, power_active, power_idle):
self.list.append(Memory(capacity, wcet_scale, power_active, power_idle))
self.n_mem_types += 1
self.total_capacity += capacity
def init_memories(self):
self.total_capacity = 0
for memory in self.list:
memory.used_capacity = memory.power_consumed_active = memory.power_consumed_idle = 0
self.total_capacity += memory.capacity
def check_memory(self):
for memory in self.list:
if memory.used_capacity > memory.capacity:
return False
return True