radix: reading first page table entry
[soc.git] / src / soc / memory_pipe_experiment / config.py
1 class MemoryPipeConfig:
2 def __init__(self, *,
3 bytes_per_cache_line=32,
4 l1_way_count=8,
5 l1_set_count=64,
6 fu_op_id_shape=range(32),
7 fu_op_id_nop_value=0,
8 physical_address_bits=48,
9 memory_queue_chunk_size=4,
10 memory_queue_entry_count=8):
11 self.bytes_per_cache_line = bytes_per_cache_line
12 self.l1_way_count = l1_way_count
13 self.l1_set_count = l1_set_count
14 self.fu_op_id_shape = fu_op_id_shape
15 self.fu_op_id_nop_value = fu_op_id_nop_value
16 self.physical_address_bits = physical_address_bits
17 self.memory_queue_chunk_size = memory_queue_chunk_size
18 self.memory_queue_entry_count = memory_queue_entry_count
19
20 def memory_queue_chunk_entries_start_index(self, chunk_index):
21 """ entry index of the first memory queue entry in the chunk `chunk_index`. """
22 return self.memory_queue_chunk_size * chunk_index
23
24 def memory_queue_entry_index(self, chunk_index, index_in_chunk):
25 return self.memory_queue_chunk_size * chunk_index + index_in_chunk
26
27 def memory_queue_chunk_entries_end_index(self, chunk_index):
28 """ one past the end entry index for in the chunk `chunk_index`. """
29 v = self.memory_queue_chunk_size * (chunk_index + 1)
30 return min(v, self.memory_queue_entry_count)
31
32 @property
33 def l1_line_count(self):
34 return self.l1_way_count * self.l1_set_count
35
36 @property
37 def l1_byte_count(self):
38 return self.l1_line_count * self.bytes_per_cache_line
39
40 @property
41 def bits_per_cache_line(self):
42 return 8 * self.bytes_per_cache_line
43
44 @property
45 def memory_queue_chunk_count(self):
46 return self.memory_queue_entry_count // self.memory_queue_chunk_size