⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tg32pci.vhd

📁 vhdl 写的 PCI IP核程序
💻 VHD
📖 第 1 页 / 共 5 页
字号:
           elsif C_BE_Bus = "1010" then              Cfgmem(cfgaddr)(23 downto 16) := AD_Bus(23 downto 16);              Cfgmem(cfgaddr)(7 downto 0) := AD_Bus(7 downto 0);           elsif C_BE_Bus = "1011" then              Cfgmem(cfgaddr)(23 downto 16) := AD_Bus(23 downto 16);           elsif C_BE_Bus = "1100" then              Cfgmem(cfgaddr)(15 downto 0) := AD_Bus(15 downto 0);           elsif C_BE_Bus = "1101" then              Cfgmem(cfgaddr)(15 downto 8) := AD_Bus(15 downto 8);           elsif C_BE_Bus = "1110" then              Cfgmem(cfgaddr)(7 downto 0) := AD_Bus(7 downto 0);           elsif C_BE_Bus = "1111" then              report "Target device: Byte Enable word not valid !"              severity Error;           end if;           cfgaddr := cfgaddr + 1;        end if;    end if;  end process;  ---------------------------------------------------------------------  -- Implementation of Read command.   -- Master read from Target device.  ---------------------------------------------------------------------   ReadProc : process(RST_N,CLK,cmdBusReady,IORead,IOWrite,MemRead,MemWrite,CfgRead,CfgWrite)      variable first : Boolean := true;  begin     if (Falling_Edge(RST_N) or RST_N = '0') then        AD_Bus <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";             elsif (CLK'Event and CLK = '0') then        cmdBusReady <= '0';        if (first = true or TrnArnd ='1') then     -- Initialize the AD_Bus to avoid bus conflict           AD_Bus <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";           first := false;        elsif Init = '1' then           Init <= '0';           AD_Bus <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" after tdelay;        end if;     elsif IORead'Event and IORead = '0' then           Init <= '1';     elsif MemRead'Event and MemRead = '0' then           Init <= '1';     elsif CfgRead'Event and CfgRead = '0' then           Init <= '1';     elsif (CLK'Event and CLK = '1' and IRDY_N = '0') then        if (IORead = '1' or MemRead = '1' or CfgRead = '1') then           cmd <= C_BE_Bus; -- read the byte enable command           cmdBusReady <= '1';        end if;     elsif (cmdBusReady'Event and cmdBusReady = '0' and TRDY_N = '0') then         if IORead = '1' then     -- Master reads from target I/O space            case addr(1 downto 0) is               when "00"   =>                  if cmd = "0000" then                       AD_Bus <= IOmem(ioaddr) after tdelay;                  elsif cmd = "1000" then                      AD_Bus(31 downto 24) <= "11111111" after tdelay;                      AD_Bus(23 downto 0)  <= IOmem(ioaddr)(23 downto 0) after tdelay;                  elsif cmd = "0100" then                      AD_Bus(31 downto 24) <= IOmem(ioaddr)(31 downto 24) after tdelay;                      AD_Bus(23 downto 16) <= "11111111" after tdelay;                      AD_Bus(15 downto 0)  <= IOmem(ioaddr)(15 downto 0) after tdelay;                  elsif cmd = "1100" then                       AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;                      AD_Bus(15 downto 0)  <= IOmem(ioaddr)(15 downto 0) after tdelay;                  elsif cmd = "0010" then                      AD_Bus(31 downto 16) <= IOmem(ioaddr)(31 downto 16) after tdelay;                      AD_Bus(15 downto 8)  <= "11111111" after tdelay;                      AD_Bus(7 downto 0)   <= IOmem(ioaddr)(7 downto 0) after tdelay;                  elsif cmd = "1010" then                      AD_Bus(31 downto 24) <= "11111111" after tdelay;                      AD_Bus(23 downto 16) <= IOmem(ioaddr)(23 downto 16) after tdelay;                      AD_Bus(15 downto 8)  <= "11111111" after tdelay;                      AD_Bus(7 downto 0)   <= IOmem(ioaddr)(7 downto 0) after tdelay;                  elsif cmd = "0110" then                      AD_Bus(31 downto 24) <= IOmem(ioaddr)(31 downto 24) after tdelay;                      AD_Bus(23 downto 8)  <= "1111111111111111" after tdelay;                      AD_Bus(7 downto 0)   <= IOmem(ioaddr)(7 downto 0) after tdelay;                  elsif cmd = "1110" then                      AD_Bus(31 downto 8) <= "111111111111111111111111" after tdelay;                      AD_Bus(7 downto 0)  <= IOmem(ioaddr)(7 downto 0) after tdelay;                  elsif cmd(0) = '1' then                      report "Target device: Byte Enable word not valid !"                      severity Error;                  end if;               when "01"   =>                  if cmd = "0001" then                       AD_Bus(31 downto 8) <= IOmem(ioaddr)(31 downto 8) after tdelay;                      AD_Bus(7 downto 0)  <= "11111111" after tdelay;                  elsif cmd = "1001" then                      AD_Bus(31 downto 24) <= "11111111" after tdelay;                      AD_Bus(23 downto 8)  <= IOmem(ioaddr)(23 downto 8) after tdelay;                      AD_Bus(7 downto 0)   <= "11111111" after tdelay;                  elsif cmd = "0101" then                      AD_Bus(31 downto 24) <= IOmem(ioaddr)(31 downto 24) after tdelay;                      AD_Bus(23 downto 16) <= "11111111" after tdelay;                      AD_Bus(15 downto 8)  <= IOmem(ioaddr)(15 downto 8) after tdelay;                      AD_Bus(7 downto 0)   <= "11111111" after tdelay;                  elsif cmd = "1101" then                      AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;                      AD_Bus(15 downto 8)  <= IOmem(ioaddr)(15 downto 8) after tdelay;                      AD_Bus(7 downto 0)   <= "11111111" after tdelay;                  elsif cmd(1) = '1' then                      report "Target device: Byte Enable word not valid !"                      severity Error;                  end if;               when "10"   =>                  if cmd = "0011" then                      AD_Bus(31 downto 16) <= IOmem(ioaddr)(31 downto 16) after tdelay;                      AD_Bus(15 downto 0)  <= "1111111111111111" after tdelay;                  elsif cmd = "1011" then                      AD_Bus(31 downto 24) <= "11111111" after tdelay;                      AD_Bus(23 downto 16) <= IOmem(ioaddr)(23 downto 16) after tdelay;                      AD_Bus(15 downto 0)  <= "1111111111111111" after tdelay;                  elsif cmd(2) = '1' then                      report "Target device: Byte Enable word not valid !"                      severity Error;                  end if;               when "11"   =>                  if cmd = "0111" then                      AD_Bus(31 downto 24) <= IOmem(ioaddr)(31 downto 24) after tdelay;                      AD_Bus(23 downto 0)  <= "111111111111111111111111" after tdelay;                  elsif cmd(3) = '1' then                      report "Target device: Byte Enable word not valid !"                      severity Error;                  end if;               when others =>                  null;            end case;            ioaddr := ioaddr + 1;         elsif MemRead = '1' then     -- Master reads from target memory space            case addr(1 downto 0) is               when "00"   =>  -- linear incrementing mode                    if cmd = "0000" then                       AD_Bus <= Mem(memaddr) after tdelay;                    elsif cmd = "0001" then                       AD_Bus(31 downto 8) <= Mem(memaddr)(31 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "0010" then                       AD_Bus(31 downto 16) <= Mem(memaddr)(31 downto 16) after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                       AD_Bus(15 downto 8) <= "11111111" after tdelay;                    elsif cmd = "0011" then                       AD_Bus(31 downto 16) <= Mem(memaddr)(31 downto 16) after tdelay;                       AD_Bus(15 downto 0) <= "1111111111111111" after tdelay;                    elsif cmd = "0100" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(15 downto 0) <= Mem(memaddr)(15 downto 0) after tdelay;                       AD_Bus(23 downto 16) <= "11111111" after tdelay;                    elsif cmd = "0101" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 16) <= "11111111" after tdelay;                       AD_Bus(15 downto 8) <= Mem(memaddr)(15 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "0110" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 8) <= "1111111111111111" after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                    elsif cmd = "0111" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 0) <= "111111111111111111111111" after tdelay;                    elsif cmd = "1000" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 0) <= Mem(memaddr)(23 downto 0) after tdelay;                    elsif cmd = "1001" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 8) <= Mem(memaddr)(23 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "1010" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 16) <= Mem(memaddr)(23 downto 16) after tdelay;                       AD_Bus(15 downto 8) <= "11111111" after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                    elsif cmd = "1011" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 16) <= Mem(memaddr)(23 downto 16) after tdelay;                       AD_Bus(15 downto 0) <= "1111111111111111" after tdelay;                    elsif cmd = "1100" then                       AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;                       AD_Bus(15 downto 0) <= Mem(memaddr)(15 downto 0) after tdelay;                    elsif cmd = "1101" then                       AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;                       AD_Bus(15 downto 8) <= Mem(memaddr)(15 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "1110" then                       AD_Bus(31 downto 8) <= "111111111111111111111111" after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                    elsif cmd = "1111" then                       report "Target device: Byte Enable word not valid !"                       severity Error;                    end if;                    memaddr := memaddr + 1;               when "01"   =>  -- reserved mode (disconnect after first data phase)                    if cmd = "0000" then                       AD_Bus <= Mem(memaddr) after tdelay;                    elsif cmd = "0001" then                       AD_Bus(31 downto 8) <= Mem(memaddr)(31 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "0010" then                       AD_Bus(31 downto 16) <= Mem(memaddr)(31 downto 16) after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                       AD_Bus(15 downto 8) <= "11111111" after tdelay;                    elsif cmd = "0011" then                       AD_Bus(31 downto 16) <= Mem(memaddr)(31 downto 16) after tdelay;                       AD_Bus(15 downto 0) <= "1111111111111111" after tdelay;                    elsif cmd = "0100" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(15 downto 0) <= Mem(memaddr)(15 downto 0) after tdelay;                       AD_Bus(23 downto 16) <= "11111111" after tdelay;                    elsif cmd = "0101" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 16) <= "11111111" after tdelay;                       AD_Bus(15 downto 8) <= Mem(memaddr)(15 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "0110" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 8) <= "1111111111111111" after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                    elsif cmd = "0111" then                       AD_Bus(31 downto 24) <= Mem(memaddr)(31 downto 24) after tdelay;                       AD_Bus(23 downto 0) <= "111111111111111111111111" after tdelay;                    elsif cmd = "1000" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 0) <= Mem(memaddr)(23 downto 0) after tdelay;                    elsif cmd = "1001" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 8) <= Mem(memaddr)(23 downto 8) after tdelay;                       AD_Bus(7 downto 0) <= "11111111" after tdelay;                    elsif cmd = "1010" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 16) <= Mem(memaddr)(23 downto 16) after tdelay;                       AD_Bus(15 downto 8) <= "11111111" after tdelay;                       AD_Bus(7 downto 0) <= Mem(memaddr)(7 downto 0) after tdelay;                    elsif cmd = "1011" then                       AD_Bus(31 downto 24) <= "11111111" after tdelay;                       AD_Bus(23 downto 16) <= Mem(memaddr)(23 downto 16) after tdelay;                       AD_Bus(15 downto 0) <= "1111111111111111" after tdelay;                    elsif cmd = "1100" then                       AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;                       AD_Bus(15 downto 0) <= Mem(memaddr)(15 downto 0) after tdelay;                    elsif cmd = "1101" then                       AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -