SURF  1.0
AxiToAxiLite.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : AxiToAxiLite.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2014-03-06
5 -- Last update: 2016-09-28
6 -------------------------------------------------------------------------------
7 -- Description: AXI4-to-AXI-Lite bridge
8 --
9 -- Note: This module only supports 32-bit aligned addresses and 32-bit transactions.
10 -------------------------------------------------------------------------------
11 -- This file is part of 'SLAC Firmware Standard Library'.
12 -- It is subject to the license terms in the LICENSE.txt file found in the
13 -- top-level directory of this distribution and at:
14 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
15 -- No part of 'SLAC Firmware Standard Library', including this file,
16 -- may be copied, modified, propagated, or distributed except according to
17 -- the terms contained in the LICENSE.txt file.
18 -------------------------------------------------------------------------------
19 
20 library ieee;
21 use ieee.std_logic_1164.all;
22 use ieee.std_logic_unsigned.all;
23 use ieee.std_logic_arith.all;
24 
25 use work.StdRtlPkg.all;
26 use work.AxiLitePkg.all;
27 use work.AxiPkg.all;
28 
29 --! @see entity
30  --! @ingroup axi
31 entity AxiToAxiLite is
32  generic (
33  TPD_G : time := 1 ns);
34  port (
35  -- Clocks & Reset
36  axiClk : in sl;
37  axiClkRst : in sl;
38  -- AXI Slave
43  -- AXI Lite
48 end AxiToAxiLite;
49 
50 architecture mapping of AxiToAxiLite is
51 
52 begin
53 
57 -- axilWriteMaster.wdata <= axiWriteMaster.wdata(31 downto 0);
58 -- axilWriteMaster.wstrb <= axiWriteMaster.wstrb(3 downto 0);
61 
66 
67  axilReadMaster.araddr <= axiReadMaster.araddr(31 downto 0);
71 
74  axiReadSlave.rlast <= '1';
76 
77  --
78  -- Collapse Axi wdata onto 32-bit AxiLite wdata
79  -- Assumes only active 32 bits are asserted,
80  -- otherwise could use wstrb to pick correct 32 bits
81  --
82  process(axiWriteMaster)
83  variable i : integer;
84  variable wdata : slv(31 downto 0);
85  begin
86  wdata := (others=>'0');
87  for i in 0 to 31 loop
88  wdata := wdata or axiWriteMaster.wdata(32*i+31 downto 32*i);
89  end loop;
91  axilWriteMaster.wstrb <= x"F";
92  end process;
93 
94  process(axilReadSlave)
95  variable i : integer;
96  variable rdata : slv(1023 downto 0);
97  begin
98  -- Copy the responds read bus bus to all word boundaries
99  for i in 0 to 31 loop
100  rdata((32*i)+31 downto (32*i)) := axilReadSlave.rdata;
101  end loop;
102  -- Return the value to the output
104  end process;
105 
106  -- ID Tracking
107  process (axiClk)
108  begin
109  if rising_edge(axiClk) then
110  if axiClkRst = '1' then
111  axiReadSlave.rid <= (others => '0') after TPD_G;
112  axiWriteSlave.bid <= (others => '0') after TPD_G;
113  else
114  if axiReadMaster.arvalid = '1' and axilReadSlave.arready = '1' then
116  end if;
117  if axiWriteMaster.awvalid = '1' and axilWriteSlave.awready = '1' then
119  end if;
120  end if;
121  end if;
122  end process;
123 
124 end architecture mapping;
slv( 2 downto 0) arprot
Definition: AxiLitePkg.vhd:62
in axilWriteSlaveAxiLiteWriteSlaveType
slv( 31 downto 0) rid
Definition: AxiPkg.vhd:86
slv( 1 downto 0) rresp
Definition: AxiLitePkg.vhd:90
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
slv( 31 downto 0) rdata
Definition: AxiLitePkg.vhd:89
in axiWriteMasterAxiWriteMasterType
in axilReadSlaveAxiLiteReadSlaveType
slv( 31 downto 0) bid
Definition: AxiPkg.vhd:179
slv( 31 downto 0) wdata
Definition: AxiLitePkg.vhd:117
out axilWriteMasterAxiLiteWriteMasterType
AxiReadSlaveType
Definition: AxiPkg.vhd:79
TPD_Gtime := 1 ns
AxiWriteMasterType
Definition: AxiPkg.vhd:108
slv( 31 downto 0) arid
Definition: AxiPkg.vhd:36
slv( 2 downto 0) awprot
Definition: AxiLitePkg.vhd:114
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
slv( 31 downto 0) awaddr
Definition: AxiLitePkg.vhd:113
in axiReadMasterAxiReadMasterType
out axilReadMasterAxiLiteReadMasterType
slv( 1 downto 0) bresp
Definition: AxiLitePkg.vhd:150
AxiWriteSlaveType
Definition: AxiPkg.vhd:171
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
out axiWriteSlaveAxiWriteSlaveType
out axiReadSlaveAxiReadSlaveType
slv( 31 downto 0) araddr
Definition: AxiLitePkg.vhd:61
sl rlast
Definition: AxiPkg.vhd:84
slv( 3 downto 0) wstrb
Definition: AxiLitePkg.vhd:118
slv( 31 downto 0) awid
Definition: AxiPkg.vhd:112
AxiReadMasterType
Definition: AxiPkg.vhd:32
std_logic_vector slv
Definition: StdRtlPkg.vhd:29