1 -------------------------------------------------------------------------------     2 -- File       : RssiAxiLiteRegItf.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2016-01-15     5 -- Last update: 2016-01-19     6 -------------------------------------------------------------------------------     7 -- Description:  Register decoding for RSSI core     8 --               0x00 (RW)- Control register [4:0]:     9 --                   bit 0: Open connection request (Default '0')    10 --                   bit 1: Close connection request (Default '0')    11 --                   bit 2: Mode (Default '0'):    12 --                            - '0': Use internal parameters from generics      13 --                            - '1': Use parameters from Axil     14 --                   bit 3: Header checksum enable (Default '1')    15 --                   bit 4: Inject fault to the next packet header checksum (Default '0')    16 --                            Acts on rising edge - injects exactly one fault in next segment (ACK, NULL, or DATA)    17 --               0x01 (RW)- Initial sequence number [7:0] (Default x"80")    18 --               0x02 (RW)- Version register [3:0](Default x"1")    19 --               0x03 (RW)- Maximum out standing segments [7:0](Default "008"):    20 --                            Defines the max number of segments in the RSSI receiver buffer    21 --               0x04 (RW)- Maximum segment size [15:0](Default x"0400")    22 --                            Defines the size of segment buffer! Number of bytes!    23 --               0x05 (RW)- Retransmission timeout [15:0](Default 50)    24 --                            Unit depends on TIMEOUT_UNIT_G    25 --               0x06 (RW)- Cumulative acknowledgment timeout [15:0](Default 50)    26 --                            Unit depends on TIMEOUT_UNIT_G    27 --               0x07 (RW)- Null segment timeout [15:0](Default 50)    28 --                            Unit depends on TIMEOUT_UNIT_G    29 --                            Server: Close connection if Null segment missed!    30 --                            Client: Transmit Null segment when nullSegTout/2 reached!    31 --               0x08 (RW)- Maximum number of retransmissions [7:0](Default x"02")    32 --                            How many times segments are retransmitted before the connection gets broken.    33 --               0x09 (RW)- Maximum cumulative acknowledgments [7:0](Default x"03")    34 --                            When more than maxCumAck are received and not acknowledged the     35 --                            ACK packet will be sent to acknowledge the received packets. Even though the     36 --                            cumulative acknowledgment timeout has not been reached yet!    37 --               0x0A (RW)- Max out of sequence segments (EACK) [7:0](Default x"03")    38 --                            Currently not used TBD    39 --               0x0B (RW)- Connection ID [31:0](Default x"12345678")    40 --                            Every connection should have unique connection ID.    42 --               0x10 (R)- Status register [5:0]:    43 --                   bit(0) : Connection Active              44 --                   bit(1) : Maximum retransmissions exceeded retransMax    45 --                   bit(2) : Null timeout reached (server) r.nullTout    46 --                   bit(3) : Error in acknowledgment mechanism       47 --                   bit(4) : SSI Frame length too long    48 --                   bit(5) : Connection to peer timed out    49 --                   bit(6) : Parameters from peer rejected (Client) or new proposed(Server)     50 --                0x11 (R)- Number of valid segments [31:0]:    51 --                   The value rests to 0 when new connection open is requested.    52 --                0x12 (R)- Number of dropped segments [31:0]:    53 --                   The value rests to 0 when new connection open is requested.    54 --                0x13 (R)- Counts all retransmission requests within the active connection [31:0]:    55 --                   The value rests to 0 when new connection open is requested.    56 --                0x14 (R)- Counts all reconnections from reset [31:0]:    57 --                   The value rests to 0 when module is reset.    58 ------------------------------------------------------------------------------    59 -- This file is part of 'SLAC Firmware Standard Library'.    60 -- It is subject to the license terms in the LICENSE.txt file found in the     61 -- top-level directory of this distribution and at:     62 --    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.     63 -- No part of 'SLAC Firmware Standard Library', including this file,     64 -- may be copied, modified, propagated, or distributed except according to     65 -- the terms contained in the LICENSE.txt file.    66 -------------------------------------------------------------------------------    69 use ieee.std_logic_1164.
all;
    70 use ieee.std_logic_unsigned.
all;
    71 use ieee.std_logic_arith.
all;
    78  --! @ingroup protocols_rssi    81    -- General Configurations    85    -- Defaults form generics    94    ACK_TOUT_G            : positive := 25;
  -- unit depends on TIMEOUT_UNIT_G      95    NULL_TOUT_G           : positive := 200;
 -- unit depends on TIMEOUT_UNIT_G     105    -- Axi-Lite Register Interface (locClk domain)   134 end RssiAxiLiteRegItf;
   138   type RegType is record   140    control       : slv(4 downto 0);
   143    initSeqN      : slv(7 downto 0);
   161    constant REG_INIT_C : RegType := (   179    signal r   : RegType := REG_INIT_C;
   180    signal rin : RegType;
   183    signal s_RdAddr :  := 0;
   184    signal s_WrAddr :  := 0;
   186   -- Synced status signals   188    signal s_dropCnt  : slv(31 downto 0);
   189    signal s_validCnt : slv(31 downto 0);
   190    signal s_reconCnt : slv(31 downto 0);
   191    signal s_resendCnt: slv(31 downto 0);
   195   -- Convert address to integer (lower two bits of address are always '0')   200                    s_WrAddr, s_dropCnt, s_reconCnt, s_resendCnt, s_status, s_validCnt) 
is   201       variable v             : RegType;
   203       variable axilWriteResp : slv(1 downto 0);
   204       variable axilReadResp  : slv(1 downto 0);
   206     -- Latch the current value   209     ----------------------------------------------------------------------------------------------   210     -- Axi-Lite interface   211     ----------------------------------------------------------------------------------------------   217         when 16#00# =>                  -- ADDR (0)   219         when 16#01# =>                  -- ADDR (4)   221         when 16#02# =>                  -- ADDR (8)   223         when 16#03# =>                  -- ADDR (12)   225         when 16#04# =>                  -- ADDR (16)   251         when 16#00# =>                  -- ADDR (0)   253         when 16#01# =>                  -- ADDR (4)   255         when 16#02# =>                  -- ADDR (8)   257         when 16#03# =>                  -- ADDR (12)   259         when 16#04# =>                  -- ADDR (16)   261         when 16#05# =>                  -- ADDR (20)   263         when 16#06# =>                  -- ADDR (24)   265         when 16#07# =>                  -- ADDR (28)   267         when 16#08# =>                  -- ADDR (32)   269         when 16#09# =>                  -- ADDR (36)   271         when 16#0A# =>                  -- ADDR (40)   273         when 16#0B# =>                  -- ADDR (44)   275         when 16#10# =>                  -- ADDR (64)   277         when 16#11# =>                  -- ADDR (68)   279         when 16#12# =>                  -- ADDR (72)   281         when 16#13# =>                  -- ADDR (76)   283         when 16#14# =>                  -- ADDR (80)   308     -- Register the variable for next clock cycle   320       r <= rin after TPD_G;
   324    -- Input assignment and synchronization   385   -- Output assignment and synchronization   423       dataOut   => appRssiParam_o.chksumEn
(0)   457       dout   => appRssiParam_o.version
   469       dout   => appRssiParam_o.maxOutsSeg
   481       dout   => appRssiParam_o.maxSegSize
   491       din    => r.retransTout,
   493       dout   => appRssiParam_o.retransTout
   503       din    => r.cumulAckTout,
   505       dout   => appRssiParam_o.cumulAckTout
   515       din    => r.nullSegTout,
   517       dout   => appRssiParam_o.nullSegTout
   529       dout   => appRssiParam_o.maxRetrans
   541       dout   => appRssiParam_o.maxCumAck
   551       din    => r.maxOutofseq,
   553       dout   => appRssiParam_o.maxOutofseq
   563       din    => r.connectionId,
   565       dout   => appRssiParam_o.connectionId
   569 --------------------------------------------------------------------- 
array(natural range <> ) of slv( 31 downto  0)   Slv32Array
 
in dinslv(   DATA_WIDTH_G- 1 downto  0)  
 
array(natural range <> ) of slv( 63 downto  0)   Slv64Array
 
out doutslv(   DATA_WIDTH_G- 1 downto  0)  
 
slv( 1 downto  0)  :=   "10" AXI_RESP_SLVERR_C
 
AxiLiteReadSlaveType  :=(arready  => '0',rdata  =>( others => '0'),rresp  =>( others => '0'),rvalid  => '0') AXI_LITE_READ_SLAVE_INIT_C
 
AxiLiteReadMasterType  :=(araddr  =>( others => '0'),arprot  =>( others => '0'),arvalid  => '0',rready  => '1') AXI_LITE_READ_MASTER_INIT_C
 
AxiLiteWriteMasterType  :=(awaddr  =>( others => '0'),awprot  =>( others => '0'),awvalid  => '0',wdata  =>( others => '0'),wstrb  =>( others => '1'),wvalid  => '0',bready  => '1') AXI_LITE_WRITE_MASTER_INIT_C
 
slv( 1 downto  0)  :=   "00" AXI_RESP_OK_C
 
AxiLiteWriteSlaveType  :=(awready  => '0',wready  => '0',bresp  =>( others => '0'),bvalid  => '0') AXI_LITE_WRITE_SLAVE_INIT_C
 
DATA_WIDTH_Ginteger   range  1 to ( 2** 24):= 16