SURF  1.0
AxiLiteEmpty.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- Title : AXI Lite Empty End Point
3 -- File : AxiLiteEmpty.vhd
4 -- Author : Ryan Herbst, rherbst@slac.stanford.edu
5 -- Created : 03/10/2014
6 -------------------------------------------------------------------------------
7 -- Description:
8 -- Empty slave endpoint for AXI Lite bus.
9 -- Absorbs writes and returns zeros on reads.
10 -- Supports a configurable number of write and read vectors.
11 -------------------------------------------------------------------------------
12 -- This file is part of 'SLAC Firmware Standard Library'.
13 -- It is subject to the license terms in the LICENSE.txt file found in the
14 -- top-level directory of this distribution and at:
15 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
16 -- No part of 'SLAC Firmware Standard Library', including this file,
17 -- may be copied, modified, propagated, or distributed except according to
18 -- the terms contained in the LICENSE.txt file.
19 -------------------------------------------------------------------------------
20 -- Modification history:
21 -- 03/10/2014: created.
22 -------------------------------------------------------------------------------
23 
24 library ieee;
25 use ieee.std_logic_1164.all;
26 use ieee.std_logic_arith.all;
27 use ieee.std_logic_unsigned.all;
28 
29 use work.StdRtlPkg.all;
30 use work.AxiLitePkg.all;
31 
32 --! @see entity
33  --! @ingroup axi
34 entity AxiLiteEmpty is
35  generic (
36  TPD_G : time := 1 ns;
38  NUM_WRITE_REG_G : integer range 1 to 32 := 1;
39  NUM_READ_REG_G : integer range 1 to 32 := 1);
40  port (
41  -- AXI-Lite Bus
42  axiClk : in sl;
43  axiClkRst : in sl;
48  -- User Read/Write registers
50  readRegister : in Slv32Array(NUM_READ_REG_G-1 downto 0) := (others => (others => '0')));
51 end AxiLiteEmpty;
52 
53 architecture rtl of AxiLiteEmpty is
54 
55  type RegType is record
59  end record RegType;
60 
61  constant REG_INIT_C : RegType := (
62  writeRegister => (others => (others => '0')),
65 
66  signal r : RegType := REG_INIT_C;
67  signal rin : RegType;
68 
69 begin
70 
71  comb : process (axiClkRst, axiReadMaster, axiWriteMaster, r, readRegister) is
72  variable v : RegType;
73  variable regCon : AxiLiteEndPointType;
74  variable i : natural;
75  begin
76  -- Latch the current value
77  v := r;
78 
79  -- Determine the transaction type
80  axiSlaveWaitTxn(regCon, axiWriteMaster, axiReadMaster, v.axiWriteSlave, v.axiReadSlave);
81 
82  -- Map the read registers = [0x000:0x0FF]
83  for i in NUM_READ_REG_G-1 downto 0 loop
84  axiSlaveRegisterR(regCon, toSlv((i*4)+0, 9), 0, readRegister(i));
85  end loop;
86 
87  -- Map the write registers = [0x100:0x1FF]
88  for i in NUM_WRITE_REG_G-1 downto 0 loop
89  axiSlaveRegister(regCon, toSlv((i*4)+256, 9), 0, v.writeRegister(i));
90  end loop;
91 
92  -- Closeout the transaction
93  axiSlaveDefault(regCon, v.axiWriteSlave, v.axiReadSlave, AXI_ERROR_RESP_G);
94 
95  -- Synchronous Reset
96  if (axiClkRst = '1') then
97  v := REG_INIT_C;
98  end if;
99 
100  -- Register the variable for next clock cycle
101  rin <= v;
102 
103  -- Outputs
107 
108  end process comb;
109 
110  seq : process (axiClk) is
111  begin
112  if (rising_edge(axiClk)) then
113  r <= rin after TPD_G;
114  end if;
115  end process seq;
116 
117 end architecture rtl;
array(natural range <> ) of slv( 31 downto 0) Slv32Array
Definition: StdRtlPkg.vhd:379
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
out axiWriteSlaveAxiLiteWriteSlaveType
NUM_READ_REG_Ginteger range 1 to 32:= 1
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_OK_C
in readRegisterSlv32Array( NUM_READ_REG_G- 1 downto 0) :=( others =>( others => '0'))
out writeRegisterSlv32Array( NUM_WRITE_REG_G- 1 downto 0)
TPD_Gtime := 1 ns
_library_ ieeeieee
out axiReadSlaveAxiLiteReadSlaveType
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
in axiReadMasterAxiLiteReadMasterType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
Definition: AxiLitePkg.vhd:95
NUM_WRITE_REG_Ginteger range 1 to 32:= 1
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
in axiWriteMasterAxiLiteWriteMasterType
slv( 1 downto 0) := "00" AXI_RESP_OK_C
Definition: AxiLitePkg.vhd:31
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
Definition: AxiLitePkg.vhd:156
std_logic_vector slv
Definition: StdRtlPkg.vhd:29