Line 61... |
Line 61... |
constant ldram: integer := blocksizeld + ldways - 1;
|
constant ldram: integer := blocksizeld + ldways - 1;
|
constant ldqueuelength: integer := ldram;
|
constant ldqueuelength: integer := ldram;
|
|
|
type IOType is ( Start, busy);
|
type IOType is ( Start, busy);
|
type tType is ( inittag, startt, startt1, tagtest, tagwait, stateget, stateget1, finish, finished);
|
type tType is ( inittag, startt, startt1, tagtest, tagwait, stateget, stateget1, finish, finished);
|
type rType is ( raminit, ramstart, ramstart1, ramcheck, ramcheck1, ramcheck2, ramread, ramread1, ramupdate,
|
type rType is ( raminit, ramstart, ramstart1, ramread, ramread1, ramupdate,
|
ramupdate1, ramupdate2, ramupdate3, ramflush, ramflush1, ramwait, ramwait1, ramclean, ramclean1);
|
ramupdate1, ramupdate2, ramupdate3, ramflush, ramflush1, ramwait, ramwait1, ramclean, ramclean1);
|
type fType is ( queuestart, queuewait, queuewaitAm1, queuewaitAm2, queuewaitA11, queuewaitA12, queueelim);
|
type fType is ( queuestart, queuewait, queuewaitAm1, queuewaitAm2, queuewaitA11, queuewaitA12, queueelim);
|
subtype myint is natural range 15 downto 0;
|
subtype myint is natural range 15 downto 0;
|
type TagRAMType is record
|
type TagRAMType is record
|
cacheAddr: std_ulogic_vector( ldram - 1 downto 0);
|
cacheAddr: std_ulogic_vector( ldram - 1 downto 0);
|
Line 137... |
Line 137... |
signal statetag: tType;
|
signal statetag: tType;
|
signal stateram: rType;
|
signal stateram: rType;
|
signal statequeue: fType;
|
signal statequeue: fType;
|
signal enableram, enablequeue, queuedone, readsh, writesh, doneh, preempted,
|
signal enableram, enablequeue, queuedone, readsh, writesh, doneh, preempted,
|
interrupt, readb, writeb, writec, writet, accdone, accqueue, accinterrupt, serviced, oldint: std_ulogic;
|
interrupt, readb, writeb, writec, writet, accdone, accqueue, accinterrupt, serviced, oldint: std_ulogic;
|
|
signal gal: std_ulogic_vector( 7 downto 0);
|
|
|
begin
|
begin
|
|
|
|
|
|
|
Line 210... |
Line 211... |
done <= '0'; -- NEW
|
done <= '0'; -- NEW
|
initcount <= ( others => '0');
|
initcount <= ( others => '0');
|
AddressInt <= ( others => '0');
|
AddressInt <= ( others => '0');
|
IOCodeh <= ( others => '0');
|
IOCodeh <= ( others => '0');
|
AddressInh <= ( others => '0');
|
AddressInh <= ( others => '0');
|
|
gal <= ( others => '1');
|
else
|
else
|
|
gal <= gal( 6 downto 4) & ( gal( 3) xor gal( 7)) & ( gal( 2) xor gal( 7)) & ( gal( 1) xor gal( 7)) & gal( 0) & gal( 7);
|
oldint <= interrupt;
|
oldint <= interrupt;
|
case statetag is
|
case statetag is
|
when inittag =>
|
when inittag =>
|
for i in tagRAMIn'range loop
|
for i in tagRAMIn'range loop
|
tagRAMIn(i).tagValid <= '0';
|
tagRAMIn(i).tagValid <= '0';
|
Line 257... |
Line 259... |
end loop;
|
end loop;
|
|
|
found <= a;
|
found <= a;
|
free <= b;
|
free <= b;
|
|
|
|
if ways = 1 then
|
|
elim <= 0;
|
|
else
|
|
elim <= to_integer( gal( ways - 1 downto 0));
|
|
end if;
|
|
|
if stateram = ramstart then
|
if stateram = ramstart then
|
enableram <= '1';
|
enableram <= '1';
|
statetag <= tagwait;
|
statetag <= tagwait;
|
end if;
|
end if;
|
when tagwait =>
|
when tagwait =>
|
Line 344... |
Line 352... |
writeb <= '0';
|
writeb <= '0';
|
readb <= '0';
|
readb <= '0';
|
getf <= '0';
|
getf <= '0';
|
putf <= '0'; -- NEW inserted
|
putf <= '0'; -- NEW inserted
|
doneh <= '0';
|
doneh <= '0';
|
elim <= 15;
|
|
accinterrupt <= '0';
|
accinterrupt <= '0';
|
accqueue <= '0';
|
accqueue <= '0';
|
initcount1 <= ( others => '0');
|
initcount1 <= ( others => '0');
|
FreeIn <= ( others => '0');
|
FreeIn <= ( others => '0');
|
firstf <= ( others => '0');
|
firstf <= ( others => '0');
|
Line 389... |
Line 396... |
stateram <= ramupdate;
|
stateram <= ramupdate;
|
elsif free /= 15 then
|
elsif free /= 15 then
|
en := '1';
|
en := '1';
|
stateram <= ramwait;
|
stateram <= ramwait;
|
else
|
else
|
elim <= 0;
|
|
stateram <= ramcheck;
|
|
end if;
|
|
end if;
|
|
when ramcheck =>
|
|
cindex <= tagBuff( elim).cacheAddr;
|
cindex <= tagBuff( elim).cacheAddr;
|
stateram <= ramcheck1;
|
stateram <= ramupdate;
|
when ramcheck1 =>
|
end if;
|
stateram <= ramcheck2;
|
|
when ramcheck2 =>
|
|
if cacheOut.Am = '0' or elim = ways - 1 then
|
|
RecBuff <= cacheOut;
|
|
en := '1';
|
|
stateram <= ramwait;
|
|
else
|
|
elim <= elim + 1;
|
|
stateram <= ramcheck;
|
|
end if;
|
end if;
|
when ramupdate =>
|
when ramupdate =>
|
stateram <= ramupdate1;
|
stateram <= ramupdate1;
|
when ramupdate1 =>
|
when ramupdate1 =>
|
cacheIn <= cacheOut;
|
cacheIn <= cacheOut;
|