@@ -13,6 +13,7 @@ package pack_cru_core is
1313
1414-- type declaration
1515type Array2bit is array (natural range <> ) of std_logic_vector (1 downto 0 );
16+ type Array3bit is array (natural range <> ) of std_logic_vector (2 downto 0 );
1617type Array4bit is array (natural range <> ) of std_logic_vector (3 downto 0 );
1718type Array8bit is array (natural range <> ) of std_logic_vector (7 downto 0 );
1819type Array16bit is array (natural range <> ) of std_logic_vector (15 downto 0 );
@@ -74,22 +75,34 @@ type t_cru_gbt_array is array (natural range <>) of t_cru_gbt;
7475 constant c_GBT : std_logic_vector (11 downto 0 ) := x"B69" ; -- x"47_42_54"
7576 constant c_TRD : std_logic_vector (11 downto 0 ) := x"978" ; -- x"54_52_44"
7677
78+ --------------------------------------------------------------------------------
79+ -- CRU BASE ADD
80+ --------------------------------------------------------------------------------
81+ constant add_bsp : unsigned (31 downto 0 ):= X"0000_0000" ;
82+ constant add_ro_protocol_base : unsigned (31 downto 0 ):= X"0010_0000" ;
83+ constant add_ttc_pon : unsigned (31 downto 0 ):= X"0020_0000" ;
84+ constant add_gbt_wrapper0 : unsigned (31 downto 0 ):= X"0040_0000" ;
85+ constant add_gbt_wrapper1 : unsigned (31 downto 0 ):= X"0050_0000" ;
86+ constant add_base_datapathwrapper0 : unsigned (31 downto 0 ):= X"0060_0000" ;
87+ constant add_base_datapathwrapper1 : unsigned (31 downto 0 ):= X"0070_0000" ;
88+ constant add_serial_flash_csr : unsigned (31 downto 0 ):= X"00A0_0000" ;
89+ constant add_serial_flash_wr_rst : unsigned (31 downto 0 ):= X"00B0_0000" ;
90+ constant add_userlogic : unsigned (31 downto 0 ):= X"00C0_0000" ;
91+ constant add_ddg : unsigned (31 downto 0 ):= X"00D0_0000" ;
92+ constant add_gbt_sc : unsigned (31 downto 0 ):= X"00F0_0000" ;
7793-------------------------------------------------------------------------------
7894-- Redaout protocol address tables
7995-------------------------------------------------------------------------------
80- constant add_ro_protocol_base : unsigned (31 downto 0 ):= X"0010_0000" ;
81- constant add_ro_prot_conf_reg : unsigned (31 downto 0 ):= X"0000_0000" + add_ro_protocol_base;
96+ constant add_ro_prot_conf_reg : unsigned (31 downto 0 ):= X"0000_0000" + add_ro_protocol_base;
8297constant add_ro_prot_check_mask : unsigned (31 downto 0 ):= X"0000_0004" + add_ro_protocol_base;
8398constant add_ro_prot_alloc_fail : unsigned (31 downto 0 ):= X"0000_0008" + add_ro_protocol_base;
84- constant add_ro_prot_ttc_linkerr : unsigned (31 downto 0 ):= X"0000_000C" + add_ro_protocol_base;
99+ constant add_ro_prot_ttc_linkerr : unsigned (31 downto 0 ):= X"0000_000C" + add_ro_protocol_base;
100+ constant add_ro_prot_nack_dly_reg : unsigned (31 downto 0 ):= X"0000_0010" + add_ro_protocol_base;
85101
86102-------------------------------------------------------------------------------
87103-- GBT address tables
88104-------------------------------------------------------------------------------
89105-- GBT wrapper pages
90- constant add_gbt_wrapper0 : unsigned (31 downto 0 ):= X"0040_0000" ;
91- constant add_gbt_wrapper1 : unsigned (31 downto 0 ):= X"0050_0000" ;
92-
93106constant add_gbt_wrapper_gregs : unsigned (31 downto 0 ):= X"0000_0000" ;
94107constant add_gbt_wrapper_bank_offset: unsigned (31 downto 0 ):= X"0002_0000" ; -- multiply by 1 to 6 (for 6 banks)
95108constant add_gbt_wrapper_atx_pll : unsigned (31 downto 0 ):= X"000E_0000" ; -- alt_a10_gx_240mhz_atx_pll
@@ -132,7 +145,6 @@ constant add_gbt_link_rx_ctrl_offset : unsigned(31 downto 0) := x"0000_003C";
132145-- GBTSC address tables
133146-------------------------------------------------------------------------------
134147-- GBTSCA wrapper pages
135- constant add_gbt_sc : unsigned (31 downto 0 ):= X"00f0_0000" ;
136148-- SCA WR
137149constant add_gbt_sca_wr_data : unsigned (31 downto 0 ):= add_gbt_sc+ X"0000_0000" ;
138150constant add_gbt_sca_wr_cmd : unsigned (31 downto 0 ):= add_gbt_sc+ X"0000_0004" ;
@@ -165,8 +177,6 @@ constant add_gbt_sc_rst : unsigned(31 downto 0):=add_gbt
165177-------------------------------------------------------------------------------
166178-- TTC PON address tables
167179-------------------------------------------------------------------------------
168- constant add_ttc_pon : unsigned (31 downto 0 ):= X"0020_0000" ;
169-
170180constant add_ttc_regs : unsigned (31 downto 0 ):= add_ttc_pon+ X"0000_0000" ;
171181constant add_ttc_onu : unsigned (31 downto 0 ):= add_ttc_pon+ X"0002_0000" ;
172182constant add_ttc_clkgen : unsigned (31 downto 0 ):= add_ttc_pon+ X"0004_0000" ;
@@ -246,7 +256,6 @@ constant add_ctp_emu_fbct : unsigned(31 downto 0):=add_ctp_emu_core+
246256-------------------------------------------------------------------------------
247257-- DDG address tables
248258-------------------------------------------------------------------------------
249- constant add_ddg : unsigned (31 downto 0 ):= X"00D0_0000" ;
250259constant add_ddg_ctrl : unsigned (31 downto 0 ):= add_ddg+ X"0000_0000" ;
251260constant add_ddg_ctrl2 : unsigned (31 downto 0 ):= add_ddg+ X"0000_0004" ;
252261constant add_ddg_ctrl3 : unsigned (31 downto 0 ):= add_ddg+ X"0000_0008" ;
@@ -257,9 +266,6 @@ constant add_ddg_trgmiss_cnt : unsigned(31 downto 0):=add_ddg+X"0000_0014";
257266-------------------------------------------------------------------------------
258267-- datapath wrapper address tables
259268-------------------------------------------------------------------------------
260- constant add_base_datapathwrapper0 : unsigned (31 downto 0 ):= X"0060_0000" ;
261- constant add_base_datapathwrapper1 : unsigned (31 downto 0 ):= X"0070_0000" ;
262-
263269constant add_dwrapper_gregs : unsigned (31 downto 0 ):= X"0000_0000" ;
264270constant add_datapathlink_offset : unsigned (31 downto 0 ):= X"0004_0000" ; -- add link offset to access it
265271constant add_flowctrl_offset : unsigned (31 downto 0 ):= X"000C_0000" ;
@@ -286,7 +292,7 @@ constant add_dwrapper_trigsize : unsigned(31 downto 0):=X"0000_0034"; -- WO
286292
287293--datapath link registers
288294constant add_datalink_ctrl : unsigned (31 downto 0 ):= X"0000_0000" ;
289-
295+ constant add_datalink_feeid : unsigned ( 31 downto 0 ) := X"0000_0004" ;
290296constant add_datalink_rej_pkt : unsigned (31 downto 0 ):= X"0000_0008" ;
291297constant add_datalink_acc_pkt : unsigned (31 downto 0 ):= X"0000_000C" ;
292298constant add_datalink_forced_pkt : unsigned (31 downto 0 ):= X"0000_0010" ;
@@ -300,15 +306,13 @@ constant add_flowctrl_pkt_tot : unsigned(31 downto 0):=X"0000_0008";
300306-------------------------------------------------------------------------------
301307-- Serial Flash address tables
302308-------------------------------------------------------------------------------
303- constant add_serial_flash_csr : unsigned (31 downto 0 ):= X"00A0_0000" ;
304- constant add_serial_flash_wr_rst : unsigned (31 downto 0 ):= X"00B0_0000" ;
309+
305310constant add_serial_flash_wr_data : unsigned (31 downto 0 ):= X"00B0_0004" ;
306311
307312
308313-------------------------------------------------------------------------------
309314-- BSP address tables
310315-------------------------------------------------------------------------------
311- constant add_bsp : unsigned (31 downto 0 ):= X"0000_0000" ;
312316constant add_bsp_info : unsigned (31 downto 0 ):= add_bsp+ X"0000_0000" ;
313317constant add_bsp_hkeeping : unsigned (31 downto 0 ):= add_bsp+ X"0001_0000" ;
314318constant add_bsp_rsu : unsigned (31 downto 0 ):= add_bsp+ X"0002_0000" ;
@@ -364,9 +368,17 @@ constant add_bsp_i2c_eeprom : unsigned(31 downto 0):=add_bsp_i2c+X"0000_08
364368-------------------------------------------------------------------------------
365369-- User logic
366370-------------------------------------------------------------------------------
367- constant add_userlogic : unsigned (31 downto 0 ):= X"00C0_0000" ;
371+ constant add_userlogic_info : unsigned (31 downto 0 ):= add_userlogic+ X"0000_0000" ;
372+ constant add_userlogic_ctrl : unsigned (31 downto 0 ):= add_userlogic+ X"0008_0000" ;
368373
369- constant add_userlogic_ctrl : unsigned (31 downto 0 ):= add_userlogic+ X"0000_0000" ;
374+ constant add_user_logic_dirty_idcode : unsigned (31 downto 0 ) := add_userlogic_info+ X"0000_0000" ;
375+ constant add_user_logic_shorthash : unsigned (31 downto 0 ) := add_userlogic_info+ X"0000_0004" ;
376+ constant add_user_logic_builddate : unsigned (31 downto 0 ) := add_userlogic_info+ X"0000_0008" ;
377+ constant add_user_logic_buildtime : unsigned (31 downto 0 ) := add_userlogic_info+ X"0000_000C" ;
378+
379+ constant add_user_logic_reset : unsigned (31 downto 0 ) := add_userlogic_ctrl+ X"0000_0000" ;
380+ constant add_user_logic_eventsize : unsigned (31 downto 0 ) := add_userlogic_ctrl+ X"0000_0004" ;
381+ constant add_user_logic_rand_eventsize_toggle : unsigned (31 downto 0 ) := add_userlogic_ctrl+ X"0000_0008" ;
370382
371383--------------------------------------------------------------------------------
372384-- BAR 0 REGISTERs (DMA)
@@ -507,21 +519,7 @@ component ddg is
507519 -- GBT Downlink (CRU -> FE)
508520 --------------------------------------------------------------------------------
509521 gbt_tx_ready_i : in std_logic_vector (g_NUM_GBT_LINKS- 1 downto 0 );
510-
511- gbt_tx_bus_o : out t_cru_gbt;
512- --------------------------------------------------------------------------------
513- -- GBT Uplink (FE -> CRU)
514- --------------------------------------------------------------------------------
515- gbt_rx_ready_i : in std_logic_vector (g_NUM_GBT_LINKS- 1 downto 0 );
516- gbt_rx_bus_i : in t_cru_gbt_array (g_NUM_GBT_LINKS- 1 downto 0 );
517- --------------------------------------------------------------------------------
518- -- DMA interface
519- --------------------------------------------------------------------------------
520- FCLK0 : out std_logic ;
521- FVAL0 : out std_logic ;
522- FSOP0 : out std_logic ;
523- FEOP0 : out std_logic ;
524- FD0 : out std_logic_vector (255 downto 0 )
522+ gbt_tx_bus_o : out t_cru_gbt
525523 );
526524end component ddg;
527525
@@ -648,7 +646,7 @@ component datapath_wrapper is
648646 ---------------------------------------------------------------------------
649647 PCIe_CLK : in std_logic ; -- clock for this FIFO interface
650648 PCIe_RST : in std_logic ;
651- PCIe_AFULL : in std_logic ; -- almost full
649+ PCIe_RD : in std_logic ; -- PCIe RD
652650 PCIe_SOP : out std_logic ; -- start of packet
653651 PCIe_EOP : out std_logic ; -- end of packet
654652 PCIe_VAL : out std_logic ; -- data valid
0 commit comments