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

📄 tg32pci.vhd

📁 vhdl 写的 PCI IP核程序
💻 VHD
📖 第 1 页 / 共 5 页
字号:
                       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;               when "10"   =>  -- cacheline wrap 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 "11"   =>  -- 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;                       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;               when others =>                    null;            end case;         elsif CfgRead = '1' then             -- Master reads from target configuration space            if cmd = "0000" then               AD_Bus <= Cfgmem(cfgaddr) after tdelay;            elsif cmd = "0001" then               AD_Bus(31 downto 8) <= Cfgmem(cfgaddr)(31 downto 8) after tdelay;               AD_Bus(7 downto 0) <= "11111111" after tdelay;            elsif cmd = "0010" then               AD_Bus(31 downto 16) <= Cfgmem(cfgaddr)(31 downto 16) after tdelay;               AD_Bus(15 downto 8) <= "11111111" after tdelay;               AD_Bus(7 downto 0) <= Cfgmem(cfgaddr)(7 downto 0) after tdelay;            elsif cmd = "0011" then               AD_Bus(31 downto 16) <= Cfgmem(cfgaddr)(31 downto 16) after tdelay;               AD_Bus(15 downto 0) <= "1111111111111111" after tdelay;            elsif cmd = "0100" then               AD_Bus(31 downto 24) <= Cfgmem(cfgaddr)(31 downto 24) after tdelay;               AD_Bus(15 downto 0) <= Cfgmem(cfgaddr)(15 downto 0) after tdelay;               AD_Bus(23 downto 16) <= "11111111" after tdelay;            elsif cmd = "0101" then               AD_Bus(31 downto 24) <= Cfgmem(cfgaddr)(31 downto 24) after tdelay;               AD_Bus(23 downto 16) <= "11111111" after tdelay;               AD_Bus(15 downto 8) <= Cfgmem(cfgaddr)(15 downto 8) after tdelay;               AD_Bus(7 downto 0) <= "11111111" after tdelay;            elsif cmd = "0110" then               AD_Bus(31 downto 24) <= Cfgmem(cfgaddr)(31 downto 24) after tdelay;               AD_Bus(23 downto 8) <= "1111111111111111" after tdelay;               AD_Bus(7 downto 0) <= Cfgmem(cfgaddr)(7 downto 0) after tdelay;            elsif cmd = "0111" then               AD_Bus(31 downto 24) <= Cfgmem(cfgaddr)(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) <= Cfgmem(cfgaddr)(23 downto 0) after tdelay;            elsif cmd = "1001" then               AD_Bus(31 downto 24) <= "11111111" after tdelay;               AD_Bus(23 downto 8) <= Cfgmem(cfgaddr)(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) <= Cfgmem(cfgaddr)(23 downto 16) after tdelay;               AD_Bus(15 downto 8) <= "11111111" after tdelay;               AD_Bus(7 downto 0) <= Cfgmem(cfgaddr)(7 downto 0) after tdelay;            elsif cmd = "1011" then               AD_Bus(31 downto 24) <= "11111111" after tdelay;               AD_Bus(23 downto 16) <= Cfgmem(cfgaddr)(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) <= Cfgmem(cfgaddr)(15 downto 0) after tdelay;            elsif cmd = "1101" then               AD_Bus(31 downto 16) <= "1111111111111111" after tdelay;               AD_Bus(15 downto 8) <= Cfgmem(cfgaddr)(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) <= Cfgmem(cfgaddr)(7 downto 0) after tdelay;            elsif cmd = "1111" then               report "Target device: Byte Enable word not valid !"               severity Error;            end if;            cfgaddr := cfgaddr + 1;         end if;     end if;  end process;  ---------------------------------------------------------------------  -- Implements the wait states process.  -- Target generates wait states accordingly to wait states parameters  -- received from master during Special Cycle.  -- Master reads the parameters from commands file.  ---------------------------------------------------------------------   WaitProc : process(CLK,FRAME_N,RST_N)     variable counter : Integer;     variable waitcnt : Integer;     variable start   : Boolean;  begin     if (Falling_Edge(RST_N) or RST_N = '0') then        TRDY_N <= 'Z';     elsif (FRAME_N'Event and FRAME_N = '0') then        counter := 0;        start := true;        TRDY_N <= '1';     elsif (CLK'Event and CLK = '0') then        if (Busy = '0' and DevAddr = '0') then  -- deselect device           TRDY_N <= 'H';        elsif (Busy = '0' and DevAddr = '1') then  -- deselect signal           TRDY_N <= '1';        end if;        if (DevAddr = '1' and TrnArnd = '0' and DEVSEL_N = '0') then           if (counter >= trdy_st and start = true and TRDY_N = '1') then              -- finish waitstates at start              TRDY_N <= '0';              start := false;           elsif (counter = trdy_loop and TRDY_N = '0') then              -- random waitstates               TRDY_N <= '1';              waits <= '1';              waitcnt := 1;           elsif (waitcnt = trdy_nr and waits = '1') then              -- finish random waitstates              waits <= '0';              TRDY_N <= '0';           elsif waits = '1' then -- count random waitstates              waitcnt := waitcnt + 1;           end if;        end if;     counter := counter + 1;     end if;  end process;  ---------------------------------------------------------------------  -- Implements the assertion process for IRDY_N, FRAME_N, and IDSEL   -- signals.  ---------------------------------------------------------------------   AsrtProc : process(CLK,FRAME_N,IRDY_N,IDSEL

⌨️ 快捷键说明

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