Next: Hilfsprogramme
Up: VHDL-Quellen
Previous: Scheduler
  Inhalt
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity Fetcher is
generic (
ld_totalStackNumber : integer range 1 to 7 := 2; - Logarithmus Dualis
totalStackNumber : integer range 1 to 127 := 4); - Anzahl der Threads
port (
clk : in std_logic; - Clock
reset : in std_logic; - Reset (Aktiv High)
fill : in std_logic_vector((4*totalStackNumber)-1 downto 0);
- Fuellstand der Windows
ifThreadTag : out std_logic_vector(ld_totalStackNumber-1 downto 0);
- Als naechstes zu fetchen
ifInvalid : out std_logic - Keiner kann gefetcht werden
);
end Fetcher;
architecture Fetcher_arch of Fetcher is
subtype fi_int is std_logic_vector(0 to 3);
type fi_int_arr is array(0 to totalStackNumber-1) of fi_int;
signal fi : fi_int_arr;
begin
g: for i in 0 to totalStackNumber-1 generate
fi(i) <= fill((4*(i+1))-1 downto 4*i);
end generate g;
p: process(clk, reset)
variable k : integer;
begin
if reset = '1' then - asynchronous reset (active high)
k := 0;
ifThreadTag <= ``00``;
ifInvalid <= '0';
elsif clk'event and clk = '1' then - rising clock edge
k:=0;
for i in 0 to totalStackNumber-1 loop
if fi(i)<fi(k) then
k := i;
end if;
end loop;
ifThreadTag <= conv_std_logic_vector(k,ld_totalStackNumber);
if unsigned(fi(k))>4 then
ifInvalid <= '1';
else
ifInvalid <= '0';
end if;
end if;
end process p;
end Fetcher_arch;
Alexander Schulz
2000-06-18