Line 1... |
Line 1... |
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
-- Company:
|
-- Company:
|
-- Engineer: Istvan Nagy, buenos@freemail.hu
|
-- Engineer: Istvan Nagy, buenos@freemail.hu
|
--
|
--
|
-- Create Date: 05/30/2010
|
-- Create Date: 05/30/2010
|
-- Modify date: 04/26/2011
|
-- Modify date: 08/10/2012
|
-- Design Name: pcie_mini
|
-- Design Name: pcie_mini
|
-- Module Name: xilinx_pcie2wb - Behavioral
|
-- Module Name: xilinx_pcie2wb - Behavioral
|
-- Version: 1.1
|
-- Version: 1.2
|
-- Project Name:
|
-- Project Name:
|
-- Target Devices: Xilinx Series-5/6/7 FPGAs
|
-- Target Devices: Xilinx Series-5/6/7 FPGAs
|
-- Tool versions: ISE-DS 12.1
|
-- Tool versions: ISE-DS 12.1
|
-- Description:
|
-- Description:
|
-- PCI-express endpoint block, transaction layer logic and back-end logic. The main
|
-- PCI-express endpoint block, transaction layer logic and back-end logic. The main
|
Line 41... |
Line 41... |
-- directory into the project's directory, and copy the generic section of the "pcie"
|
-- directory into the project's directory, and copy the generic section of the "pcie"
|
-- from the file: xilinx_pcie_1_1_ep_s6.vhd, into this file.
|
-- from the file: xilinx_pcie_1_1_ep_s6.vhd, into this file.
|
-- Synthesis: Set the "FSM Encoding Algorithm" to "user".
|
-- Synthesis: Set the "FSM Encoding Algorithm" to "user".
|
--
|
--
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- Revision 1.0 - File Created by Istvan Nagy
|
|
-- Revision 1.1 - some fixes by Istvan Nagy
|
|
-- Revision 1.2 - interrupt fix by Stephen Battazzo
|
--
|
--
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|
|
Line 206... |
Line 208... |
SIGNAL txtlp_data_5 : std_logic_vector(31 downto 0);
|
SIGNAL txtlp_data_5 : std_logic_vector(31 downto 0);
|
SIGNAL txtlp_data_6 : std_logic_vector(31 downto 0);
|
SIGNAL txtlp_data_6 : std_logic_vector(31 downto 0);
|
SIGNAL txtlp_data_7 : std_logic_vector(31 downto 0);
|
SIGNAL txtlp_data_7 : std_logic_vector(31 downto 0);
|
SIGNAL pcie_tlp_tx_complete : std_logic;
|
SIGNAL pcie_tlp_tx_complete : std_logic;
|
|
|
|
--this signal added by StBa, AAC Microtec
|
|
SIGNAL irq_prohibit : std_logic;
|
|
|
SIGNAL pcieirq_state : std_logic_vector(7 downto 0);
|
SIGNAL pcieirq_state : std_logic_vector(7 downto 0);
|
SIGNAL txtrn_counter : std_logic_vector(7 downto 0);
|
SIGNAL txtrn_counter : std_logic_vector(7 downto 0);
|
SIGNAL trn_rx_counter : std_logic_vector(7 downto 0);
|
SIGNAL trn_rx_counter : std_logic_vector(7 downto 0);
|
SIGNAL cfg_completer_id : std_logic_vector(15 downto 0);
|
SIGNAL cfg_completer_id : std_logic_vector(15 downto 0);
|
SIGNAL wb0_state : std_logic_vector(7 downto 0);
|
SIGNAL wb0_state : std_logic_vector(7 downto 0);
|
Line 298... |
Line 303... |
SLOT_CAP_ATT_BUTTON_PRESENT : boolean := FALSE;
|
SLOT_CAP_ATT_BUTTON_PRESENT : boolean := FALSE;
|
SLOT_CAP_ATT_INDICATOR_PRESENT : boolean := FALSE;
|
SLOT_CAP_ATT_INDICATOR_PRESENT : boolean := FALSE;
|
SLOT_CAP_POWER_INDICATOR_PRESENT : boolean := FALSE;
|
SLOT_CAP_POWER_INDICATOR_PRESENT : boolean := FALSE;
|
DEV_CAP_ROLE_BASED_ERROR : boolean := TRUE;
|
DEV_CAP_ROLE_BASED_ERROR : boolean := TRUE;
|
LINK_CAP_ASPM_SUPPORT : integer := 1;
|
LINK_CAP_ASPM_SUPPORT : integer := 1;
|
LINK_CAP_L0S_EXIT_LATENCY : integer := 7;
|
--LINK_CAP_L0S_EXIT_LATENCY : integer := 7;
|
LINK_CAP_L1_EXIT_LATENCY : integer := 7;
|
--LINK_CAP_L1_EXIT_LATENCY : integer := 7;
|
LL_ACK_TIMEOUT : bit_vector := x"0204";
|
LL_ACK_TIMEOUT : bit_vector := x"0000";
|
LL_ACK_TIMEOUT_EN : boolean := FALSE;
|
LL_ACK_TIMEOUT_EN : boolean := FALSE;
|
LL_REPLAY_TIMEOUT : bit_vector := x"0204";
|
--LL_REPLAY_TIMEOUT : bit_vector := x"0204";
|
|
LL_REPLAY_TIMEOUT : bit_vector := x"0000";
|
LL_REPLAY_TIMEOUT_EN : boolean := FALSE;
|
LL_REPLAY_TIMEOUT_EN : boolean := FALSE;
|
MSI_CAP_MULTIMSGCAP : integer := 0;
|
MSI_CAP_MULTIMSGCAP : integer := 0;
|
MSI_CAP_MULTIMSG_EXTENSION : integer := 0;
|
MSI_CAP_MULTIMSG_EXTENSION : integer := 0;
|
LINK_STATUS_SLOT_CLOCK_CONFIG : boolean := FALSE;
|
LINK_STATUS_SLOT_CLOCK_CONFIG : boolean := FALSE;
|
PLM_AUTO_CONFIG : boolean := FALSE;
|
PLM_AUTO_CONFIG : boolean := FALSE;
|
Line 337... |
Line 343... |
PM_DATA7 : bit_vector := x"00";
|
PM_DATA7 : bit_vector := x"00";
|
PM_DATA_SCALE7 : bit_vector := x"0";
|
PM_DATA_SCALE7 : bit_vector := x"0";
|
PCIE_GENERIC : bit_vector := "000011101111";
|
PCIE_GENERIC : bit_vector := "000011101111";
|
GTP_SEL : integer := 0;
|
GTP_SEL : integer := 0;
|
CFG_VEN_ID : std_logic_vector(15 downto 0) := x"10EE";
|
CFG_VEN_ID : std_logic_vector(15 downto 0) := x"10EE";
|
CFG_DEV_ID : std_logic_vector(15 downto 0) := x"ABCD";
|
CFG_DEV_ID : std_logic_vector(15 downto 0) := x"BADD";
|
CFG_REV_ID : std_logic_vector(7 downto 0) := x"00";
|
CFG_REV_ID : std_logic_vector(7 downto 0) := x"00";
|
CFG_SUBSYS_VEN_ID : std_logic_vector(15 downto 0) := x"10EE";
|
CFG_SUBSYS_VEN_ID : std_logic_vector(15 downto 0) := x"10EE";
|
CFG_SUBSYS_ID : std_logic_vector(15 downto 0) := x"1234";
|
CFG_SUBSYS_ID : std_logic_vector(15 downto 0) := x"1234";
|
REF_CLK_FREQ : integer := 0
|
REF_CLK_FREQ : integer := 0
|
);
|
);
|
Line 448... |
Line 454... |
|
|
|
|
---- ------- SYNTHESIS ATTRIBUTES: --------------------------------------------------
|
---- ------- SYNTHESIS ATTRIBUTES: --------------------------------------------------
|
--attribute keep_hierarchy : string;
|
--attribute keep_hierarchy : string;
|
--attribute keep_hierarchy of xilinx_pcie2wb: entity is "yes";
|
--attribute keep_hierarchy of xilinx_pcie2wb: entity is "yes";
|
|
attribute keep : string;
|
|
attribute keep of cfg_dstatus : signal is "true";
|
|
attribute keep of tlp_state : signal is "true";
|
|
|
|
|
-- --------ARCHITECTURE BODY BEGINS -----------------------------------------------
|
-- --------ARCHITECTURE BODY BEGINS -----------------------------------------------
|
begin
|
begin
|
|
|
Line 1365... |
Line 1373... |
--02h INTC
|
--02h INTC
|
--03h INTD
|
--03h INTD
|
|
|
cfg_interrupt_di <= "00000000"; --intA used
|
cfg_interrupt_di <= "00000000"; --intA used
|
|
|
|
--prohibit IRQ assert when TLP state machine not idle.
|
|
-- if an IRQ is asserted between a read request and completion, it causes an error in the endpoint block.
|
|
-- added by StBa, AAC Microtec, 2012
|
|
irq_prohibit <= not tlpstm_isin_idle;
|
|
|
process (pciewb_localreset_n, trn_clk, pcie_irq, pcieirq_state,
|
process (pciewb_localreset_n, trn_clk, pcie_irq, pcieirq_state,
|
cfg_interrupt_rdy_n)
|
cfg_interrupt_rdy_n)
|
begin
|
begin
|
if (pciewb_localreset_n='0') then
|
if (pciewb_localreset_n='0') then
|
pcieirq_state <= "00000000";
|
pcieirq_state <= "00000000";
|
Line 1378... |
Line 1391... |
if (trn_clk'event and trn_clk = '1') then
|
if (trn_clk'event and trn_clk = '1') then
|
case ( pcieirq_state ) is
|
case ( pcieirq_state ) is
|
|
|
--********** idle STATE **********
|
--********** idle STATE **********
|
when "00000000" => --state 0
|
when "00000000" => --state 0
|
if (pcie_irq = '1') then
|
if (pcie_irq = '1' and irq_prohibit = '0') then
|
pcieirq_state <= "00000001";
|
pcieirq_state <= "00000001";
|
cfg_interrupt_n <= '0'; --active
|
cfg_interrupt_n <= '0'; --active
|
else
|
else
|
cfg_interrupt_n <= '1'; --inactive
|
cfg_interrupt_n <= '1'; --inactive
|
end if;
|
end if;
|
Line 1397... |
Line 1410... |
cfg_interrupt_n <= '0'; --request INTA assertion
|
cfg_interrupt_n <= '0'; --request INTA assertion
|
end if;
|
end if;
|
|
|
--********** pcie_irq kept asserted STATE **********
|
--********** pcie_irq kept asserted STATE **********
|
when "00000010" => --state 2
|
when "00000010" => --state 2
|
if (pcie_irq = '0') then --pcie_irq gets deasserted
|
if (pcie_irq = '0' and irq_prohibit='0') then --pcie_irq gets deasserted
|
pcieirq_state <= "00000011";
|
pcieirq_state <= "00000011";
|
end if;
|
end if;
|
cfg_interrupt_n <= '1'; --inactive
|
cfg_interrupt_n <= '1'; --inactive
|
cfg_interrupt_assert_n_1 <= '1'; --0=assert, 1=deassert
|
cfg_interrupt_assert_n_1 <= '1'; --0=assert, 1=deassert
|
|
|