コード例 #1
0
 def test_page_index(self):
     r = MemoryAccess('00001000', 'R', 0)
     w = MemoryAccess('00002000', 'W', 0)
     p = MemoryAccess('00001001', 'R', 0)
     assert r.page_index == 1
     assert w.page_index == 2
     assert r.page_index == p.page_index
コード例 #2
0
 def skip_test_handling_page_table_full(self):
     Simulation._load_memory_accesses_from_file = stub_empty_method
     Simulation._load_replacement_algorithm = stub_empty_method
     s = Simulation('dummy path', 'dummy alg', 4)
     a = MemoryAccess('00000000', 'R', 0)
     e = PageTableFullException()
     s._handle_page_fault(e, a)
     assert s.page_fault_counter == 1
コード例 #3
0
def read_memory_access_factory(address='00000000'):
    return MemoryAccess(address, 'R', 0)
コード例 #4
0
def write_memory_access_factory(address='00000000'):
    return MemoryAccess(address, 'W', 0)
コード例 #5
0
 def _parse_memory_access(self, line, index):
     [address, access_type] = line.split(' ', 1)
     access = MemoryAccess(address, access_type, index)
     access = self.alg.preprocess_memory_access(access)
     self.accesses.put(access)
コード例 #6
0
 def test_write_property(self):
     w = MemoryAccess('00000000', 'W', 0)
     assert not w.read
     assert w.write
コード例 #7
0
 def test_read_property(self):
     r = MemoryAccess('00000000', 'R', 0)
     assert r.read
     assert not r.write
コード例 #8
0
 def test_save_access_index(self):
     r = MemoryAccess('00000000', 'R', 1)
     assert r.index == 1