SURF  1.0
SsiDbgTap.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : SsiDbgTap.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2017-06-18
5 -- Last update: 2017-06-18
6 -------------------------------------------------------------------------------
7 -- Description: SSI debug tap, intended to be connect to chipscope for debugging
8 -------------------------------------------------------------------------------
9 -- This file is part of 'SLAC Firmware Standard Library'.
10 -- It is subject to the license terms in the LICENSE.txt file found in the
11 -- top-level directory of this distribution and at:
12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13 -- No part of 'SLAC Firmware Standard Library', including this file,
14 -- may be copied, modified, propagated, or distributed except according to
15 -- the terms contained in the LICENSE.txt file.
16 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.std_logic_unsigned.all;
21 use ieee.std_logic_arith.all;
22 
23 use work.StdRtlPkg.all;
24 use work.AxiStreamPkg.all;
25 use work.SsiPkg.all;
26 
27 --! @see entity
28  --! @ingroup protocols_ssi
29 entity SsiDbgTap is
30  generic (
31  TPD_G : time := 1 ns;
32  CNT_WIDTH_G : positive := 16;
34  port (
35  -- Slave Port
36  axisClk : in sl;
37  axisRst : in sl;
40 end SsiDbgTap;
41 
42 architecture rtl of SsiDbgTap is
43 
44  type StateType is (
45  IDLE_S,
46  MOVE_S);
47 
48  type RegType is record
49  cnt : slv(CNT_WIDTH_G-1 downto 0);
50  copy : AxiStreamMasterType;
51  state : StateType;
52  end record RegType;
53  constant REG_INIT_C : RegType := (
54  cnt => (others => '0'),
56  state => IDLE_S);
57 
58  signal r : RegType := REG_INIT_C;
59  signal rin : RegType;
60 
61  attribute dont_touch : string;
62  attribute dont_touch of r : signal is "TRUE";
63 
64 begin
65 
66  comb : process (axisMaster, axisRst, axisSlave, r) is
67  variable v : RegType;
68  variable i : natural;
69  begin
70  -- Latch the current value
71  v := r;
72 
73  -- Check if ready to move data
74  if (axisMaster.tValid = '1') and (axisSlave.tReady = '1') then
75  -- State Machine
76  case r.state is
77  ----------------------------------------------------------------------
78  when IDLE_S =>
79  -- Check for SOF
80  if ssiGetUserSof(AXI_CONFIG_G, axisMaster) = '1' then
81  -- Move the data
82  v.copy := axisMaster;
83  -- Reset the counter
84  v.cnt := (others => '0');
85  -- Check for non-EOF
86  if axisMaster.tLast = '0' then
87  -- Next state
88  v.state := MOVE_S;
89  end if;
90  end if;
91  ----------------------------------------------------------------------
92  when MOVE_S =>
93  -- Move the data
94  v.copy := axisMaster;
95  -- Increment the counter
96  v.cnt := r.cnt + 1;
97  if axisMaster.tLast = '1' then
98  -- Next state
99  v.state := IDLE_S;
100  end if;
101  ----------------------------------------------------------------------
102  end case;
103  end if;
104 
105  -- Reset
106  if (axisRst = '1') then
107  v := REG_INIT_C;
108  end if;
109 
110  -- Register the variable for next clock cycle
111  rin <= v;
112 
113  end process comb;
114 
115  seq : process (axisClk) is
116  begin
117  if rising_edge(axisClk) then
118  r <= rin after TPD_G;
119  end if;
120  end process seq;
121 
122 end rtl;
in axisMasterAxiStreamMasterType
Definition: SsiDbgTap.vhd:38
in axisSlaveAxiStreamSlaveType
Definition: SsiDbgTap.vhd:39
std_logic sl
Definition: StdRtlPkg.vhd:28
CNT_WIDTH_Gpositive := 16
Definition: SsiDbgTap.vhd:32
AxiStreamMasterType :=(tValid => '0',tData =>( others => '0'),tStrb =>( others => '1'),tKeep =>( others => '1'),tLast => '0',tDest =>( others => '0'),tId =>( others => '0'),tUser =>( others => '0')) AXI_STREAM_MASTER_INIT_C
in axisClksl
Definition: SsiDbgTap.vhd:36
TPD_Gtime := 1 ns
Definition: SsiDbgTap.vhd:31
AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
Definition: SsiDbgTap.vhd:33
in axisRstsl
Definition: SsiDbgTap.vhd:37
AxiStreamConfigType :=(TSTRB_EN_C => false,TDATA_BYTES_C => 16,TDEST_BITS_C => 4,TID_BITS_C => 0,TKEEP_MODE_C => TKEEP_NORMAL_C,TUSER_BITS_C => 4,TUSER_MODE_C => TUSER_NORMAL_C) AXI_STREAM_CONFIG_INIT_C
std_logic_vector slv
Definition: StdRtlPkg.vhd:29