Fixed support for subfetch units with maximum address ranges

Signed-off-by: Eric Matthews <ematthew@sfu.ca>
This commit is contained in:
Eric Matthews 2022-05-11 13:12:19 -04:00
parent 8c1059f395
commit 0855bb623a

View file

@ -242,34 +242,6 @@ interface writeback_store_interface;
);
endinterface
interface ls_sub_unit_interface #(parameter bit [31:0] BASE_ADDR = 32'h00000000, parameter bit [31:0] UPPER_BOUND = 32'hFFFFFFFF);
logic data_valid;
logic ready;
logic new_request;
//Based on the lower and upper address ranges,
//find the number of bits needed to uniquely identify this memory range.
//Assumption: address range is aligned to its size
function automatic int unsigned bit_range ();
int unsigned i;
for(i=0; i < 32; i++) begin
if (BASE_ADDR[i] == UPPER_BOUND[i])
break;
end
return (32 - i);
endfunction
localparam int unsigned BIT_RANGE = bit_range();
function address_range_check (input logic[31:0] addr);
return (addr[31:32-BIT_RANGE] == BASE_ADDR[31:32-BIT_RANGE]);
endfunction
modport sub_unit (input new_request, output data_valid, ready);
modport ls (output new_request, input data_valid, ready);
endinterface
interface addr_utils_interface #(parameter bit [31:0] BASE_ADDR = 32'h00000000, parameter bit [31:0] UPPER_BOUND = 32'hFFFFFFFF);
//Based on the lower and upper address ranges,
//find the number of bits needed to uniquely identify this memory range.
@ -286,7 +258,7 @@ interface addr_utils_interface #(parameter bit [31:0] BASE_ADDR = 32'h00000000,
localparam int unsigned BIT_RANGE = bit_range();
function address_range_check (input logic[31:0] addr);
return (addr[31:32-BIT_RANGE] == BASE_ADDR[31:32-BIT_RANGE]);
return (BIT_RANGE == 0) ? 1 : (addr[31:32-BIT_RANGE] == BASE_ADDR[31:32-BIT_RANGE]);
endfunction
endinterface