Line 43... |
Line 43... |
signal request: std_logic:='0';
|
signal request: std_logic:='0';
|
signal request_addr: std_logic_vector(29 downto 0);
|
signal request_addr: std_logic_vector(29 downto 0);
|
|
|
signal finish: std_logic:='0';
|
signal finish: std_logic:='0';
|
|
|
shared variable current_latency: integer:=1;
|
signal current_latency: integer:=1;
|
shared variable max_latency: integer:=-1;
|
signal max_latency: integer:=-1;
|
shared variable total_latency: integer:=0;
|
signal total_latency: integer:=0;
|
shared variable total_requests: integer:=0;
|
signal spurious_misses: integer:=0;
|
shared variable spurious_misses: integer:=0;
|
|
|
|
begin
|
begin
|
|
|
process is
|
process is
|
variable b: integer:=1;
|
variable b: integer:=1;
|
variable start: integer;
|
variable start: integer;
|
variable size: integer;
|
variable size: integer;
|
variable addr: integer:=0;
|
variable addr: integer:=0;
|
variable delay: integer;
|
variable delay: integer;
|
|
variable rng_state: rng_state_type;
|
|
variable r: integer;
|
|
variable total_requests: integer:=0;
|
begin
|
begin
|
while b<=BLOCKS loop
|
while b<=BLOCKS loop
|
if rand(1,10)=1 then -- insert large block occasionally
|
rand(rng_state,1,10,r);
|
size:=rand(1,400);
|
if r=1 then -- insert large block occasionally
|
|
rand(rng_state,1,400,size);
|
else -- small block
|
else -- small block
|
size:=rand(1,32);
|
rand(rng_state,1,32,size);
|
end if;
|
end if;
|
|
|
if rand(0,1)=0 then -- long jump
|
rand(rng_state,0,1,r);
|
start:=rand(0,1024);
|
if r=0 then -- long jump
|
|
rand(rng_state,0,1024,start);
|
addr:=start;
|
addr:=start;
|
if VERBOSE then
|
if VERBOSE then
|
report "Fetching block #"&integer'image(b)&" at address "&integer'image(addr)&
|
report "Fetching block #"&integer'image(b)&" at address "&integer'image(addr)&
|
" of size "&integer'image(size);
|
" of size "&integer'image(size);
|
end if;
|
end if;
|
else -- short jump
|
else -- short jump
|
start:=addr+rand(0,20)-10;
|
rand(rng_state,-10,10,r);
|
|
start:=addr+r;
|
if start<0 then
|
if start<0 then
|
start:=0;
|
start:=0;
|
end if;
|
end if;
|
addr:=start;
|
addr:=start;
|
if VERBOSE then
|
if VERBOSE then
|
Line 91... |
Line 96... |
total_requests:=total_requests+1;
|
total_requests:=total_requests+1;
|
lli_adr<=std_logic_vector(to_unsigned(addr,30));
|
lli_adr<=std_logic_vector(to_unsigned(addr,30));
|
wait until rising_edge(clk_i) and lli_busy_i='0';
|
wait until rising_edge(clk_i) and lli_busy_i='0';
|
re<='0';
|
re<='0';
|
addr:=addr+1;
|
addr:=addr+1;
|
delay:=rand(0,4);
|
rand(rng_state,0,4,delay);
|
if delay>0 then
|
if delay>0 then
|
for i in 1 to delay loop
|
for i in 1 to delay loop
|
wait until rising_edge(clk_i);
|
wait until rising_edge(clk_i);
|
end loop;
|
end loop;
|
end if;
|
end if;
|
Line 145... |
Line 150... |
process (clk_i) is
|
process (clk_i) is
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if rising_edge(clk_i) then
|
if lli_busy_i='0' then
|
if lli_busy_i='0' then
|
if request='1' then
|
if request='1' then
|
total_latency:=total_latency+current_latency;
|
total_latency<=total_latency+current_latency;
|
if current_latency>max_latency then
|
if current_latency>max_latency then
|
max_latency:=current_latency;
|
max_latency<=current_latency;
|
end if;
|
end if;
|
end if;
|
end if;
|
current_latency:=1;
|
current_latency<=1;
|
else
|
else
|
if lli_dat_i=(("00"&request_addr) xor xor_constant) and current_latency=1 then
|
if lli_dat_i=(("00"&request_addr) xor xor_constant) and current_latency=1 then
|
spurious_misses:=spurious_misses+1;
|
spurious_misses<=spurious_misses+1;
|
end if;
|
end if;
|
current_latency:=current_latency+1;
|
current_latency<=current_latency+1;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
assert not rising_edge(clk_i) or lli_busy_i='0' or request='1'
|
process (clk_i) is
|
|
begin
|
|
if rising_edge(clk_i) then
|
|
assert lli_busy_i='0' or request='1'
|
report "LLI busy signal asserted without a request"
|
report "LLI busy signal asserted without a request"
|
severity failure;
|
severity failure;
|
|
end if;
|
|
end process;
|
|
|
end architecture;
|
end architecture;
|
|
|
No newline at end of file
|
No newline at end of file
|