Internal memory module functions

prepared by P. Bakowski (designer K. Djigande)


LIBRARY IEEE;
use IEEE.std_logic_1164.all;
LIBRARY COMPASS_LIB;
use COMPASS_LIB.compass.all;
use work.tms8.all;
entity mem32 is
port(InstReg:in BIT32; AR0,AR1:in BIT32; reset,clk,DataP,ARP:in std_logic; addr_R,addr_W:out BIT8; InstReg0:out BIT32; Rd,lect:out std_logic; nDEN:out std_logic);
end mem32;
architecture beh_mem32 of mem32 is
signal interm:BIT8;
signal br,inDEN:std_logic;
begin
nDEN<=inDEN;
process(reset,clk)
variable mot:BIT8;
variable Ent_sort:std_logic;
begin
if reset='1' then
mot:="00000000";interm<="00000000"; addr_R<="00000000";addr_W<="00000000"; InstReg0<=extend("0111111110000000",32);br<='0'; Rd<='0';lect<='0';inDEN<='1';Ent_sort:='0';
elsif clk'event and clk='0' then
if br='1' then
InstReg0<=extend("0111111110000000",32);
else InstReg0<=InstReg;
end if; addr_W<=interm;
if InstReg(15 downto 12)="1111" and Ent_sort='0' and br='0' then
br<='1';
else br<='0';
end if;
if InstReg(15 downto 11)="01000" and Ent_sort='0' and inDEN='1' then
inDEN<='0';--IN
else inDEN<='1';
end if;
if Ent_sort='0' and br='0' then
if not((InstReg(15 downto 13)="100") or (InstReg(15 downto 12)="1111") or (InstReg(15 downto 12)="0111" and (InstReg(11 downto 9)="111" or InstReg(11)='0')) or (InstReg(15 downto 12)="0110" and (InstReg(11 downto 9)="111" or InstReg(11 downto 8)="1000"))) then
lect<='1';
if InstReg(7)='1' then
if ARP='1' then
mot:=AR1(7 downto 0);
else mot:=AR0(7 downto 0);
end if;
else mot(7):=DataP;mot(6 downto 0):=InstReg(6 downto 0);
end if;
addr_R<=mot;
if (InstReg(15 downto 12)="0101" or InstReg(15 downto 8)="01101000" or InstReg(15 downto 8)="01111100" or InstReg(15 downto 8)="01100111" or InstReg(15 downto 11)="01000") then
Rd<='0';
else Rd<='1';
end if;
--simple ecriture
if (InstReg(15 downto 8)="01101011" or InstReg(15 downto 8)="01101001") then
inc8(mot);
end if;
interm<=mot;
else
lect<='0';Rd<='0';
end if;
else
lect<='0';Rd<='0';
end if;
if (InstReg(15 downto 12)="0100" or InstReg(15 downto 8)="01100111") and Ent_sort='0' then
Ent_sort:='1';
else Ent_sort:='0';
end if;
end if;
end process;
end beh_mem32;


back to processor main module

back to synthesis lesson