text stringlengths 0 234 |
|---|
result : Cache_Pointer := new Cache_Type; |
begin |
-- Start with everything set to the minimum. |
Set_Memory(result.all, next); |
result.line_size := Get_Word_Size(next.all); |
result.line_count := MIN_LINE_COUNT; |
result.associativity := 1; |
result.policy := LRU; |
result.write_back := True; |
-- If even the minimum cache is too costly, return null. |
if Get_Cost(result.all) > max_cost then |
Set_Memory(result.all, null); |
Destroy(Memory_Pointer(result)); |
return Memory_Pointer(next); |
end if; |
-- Randomly increase parameters, reverting them if we exceed the cost. |
loop |
-- Line size. |
declare |
line_size : constant Positive := result.line_size; |
begin |
if Random_Boolean(Random(generator)) then |
result.line_size := line_size * 2; |
if Get_Cost(result.all) > max_cost then |
result.line_size := line_size; |
exit; |
end if; |
end if; |
Function Definition: function Insert_Register(mem : Memory_Pointer) return Boolean is |
Function Body: max_path : constant Natural := Device.Get_Max_Path; |
begin |
if Get_Path_Length(mem.all) <= max_path then |
return False; |
end if; |
if mem.all in Split_Type'Class then |
declare |
sp : constant Split_Pointer := Split_Pointer(mem); |
np : constant Memory_Pointer := Get_Memory(sp.all); |
b0 : constant Memory_Pointer := Get_Bank(sp.all, 0); |
b1 : constant Memory_Pointer := Get_Bank(sp.all, 1); |
begin |
if Insert_Register(np) then |
return True; |
end if; |
if Insert_Register(b0) then |
return True; |
end if; |
if Insert_Register(b1) then |
return True; |
end if; |
-- Insert two registers: one for each bank. |
Set_Bank(sp.all, 0, Create_Register(b0)); |
Set_Bank(sp.all, 1, Create_Register(b1)); |
return True; |
Function Definition: procedure Insert_Registers(mem : access Memory_Type'Class) is |
Function Body: begin |
-- Continue inserting registers until we either no longer exceed |
-- the max path length or we are unable to reduce the path length. |
loop |
exit when not Insert_Register(Memory_Pointer(mem)); |
end loop; |
end Insert_Registers; |
function Remove_Registers(mem : Memory_Pointer) return Memory_Pointer is |
begin |
if mem = null then |
return null; |
elsif mem.all in Register_Type'Class then |
declare |
rp : Register_Pointer := Register_Pointer(mem); |
np : constant Memory_Pointer := Get_Memory(rp.all); |
begin |
Set_Memory(rp.all, null); |
Destroy(Memory_Pointer(rp)); |
return Remove_Registers(np); |
Function Definition: procedure Parse_Register(parser : in out Parser_Type; |
Function Body: result : out Memory_Pointer) is separate; |
procedure Parse_Shift(parser : in out Parser_Type; |
result : out Memory_Pointer) is separate; |
procedure Parse_Split(parser : in out Parser_Type; |
result : out Memory_Pointer) is separate; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.