Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pre-release' into pgp-fc-rec
Browse files Browse the repository at this point in the history
  • Loading branch information
bengineerd committed Sep 25, 2023
2 parents b9c4698 + ec5cb1b commit 78b55eb
Show file tree
Hide file tree
Showing 42 changed files with 1,878 additions and 701 deletions.
4 changes: 2 additions & 2 deletions axi/axi-lite/rtl/AxiDualPortRam.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ begin
if (AXI_WR_EN_G) then
v.axiAddr := axiWriteMaster.awaddr(AXI_RAM_ADDR_HIGH_C downto AXI_RAM_ADDR_LOW_C);
if (DATA_WIDTH_G <= 32) then
decAddrInt := conv_integer(axiWriteMaster.awaddr(AXI_RAM_ADDR_LOW_C-1 downto 0));
v.axiWrStrobe := axiWriteMaster.wstrb;
else
decAddrInt := conv_integer(axiWriteMaster.awaddr(AXI_DEC_ADDR_RANGE_C));
v.axiWrStrobe((decAddrInt+1)*4-1 downto decAddrInt*4) := axiWriteMaster.wstrb;
end if;
v.axiWrStrobe((decAddrInt+1)*4-1 downto decAddrInt*4) := axiWriteMaster.wstrb;
end if;
axiSlaveWriteResponse(v.axiWriteSlave, ite(AXI_WR_EN_G, AXI_RESP_OK_C, AXI_RESP_SLVERR_C));
-- Check for read transaction
Expand Down
189 changes: 189 additions & 0 deletions axi/axi-lite/tb/AxiLiteCrossbarTb.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
-------------------------------------------------------------------------------
-- Company : SLAC National Accelerator Laboratory
-------------------------------------------------------------------------------
-- Description: surf.AxiLiteCrossbar cocoTB testbed
-------------------------------------------------------------------------------
-- This file is part of 'SLAC Firmware Standard Library'.
-- It is subject to the license terms in the LICENSE.txt file found in the
-- top-level directory of this distribution and at:
-- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
-- No part of 'SLAC Firmware Standard Library', including this file,
-- may be copied, modified, propagated, or distributed except according to
-- the terms contained in the LICENSE.txt file.
-------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

library surf;
use surf.StdRtlPkg.all;
use surf.AxiLitePkg.all;

entity AxiLiteCrossbarTb is
port (
-- AXI-Lite Interface
S_AXI_ACLK : in std_logic;
S_AXI_ARESETN : in std_logic;
S_AXI_AWADDR : in std_logic_vector(31 downto 0);
S_AXI_AWPROT : in std_logic_vector(2 downto 0);
S_AXI_AWVALID : in std_logic;
S_AXI_AWREADY : out std_logic;
S_AXI_WDATA : in std_logic_vector(31 downto 0);
S_AXI_WSTRB : in std_logic_vector(3 downto 0);
S_AXI_WVALID : in std_logic;
S_AXI_WREADY : out std_logic;
S_AXI_BRESP : out std_logic_vector(1 downto 0);
S_AXI_BVALID : out std_logic;
S_AXI_BREADY : in std_logic;
S_AXI_ARADDR : in std_logic_vector(31 downto 0);
S_AXI_ARPROT : in std_logic_vector(2 downto 0);
S_AXI_ARVALID : in std_logic;
S_AXI_ARREADY : out std_logic;
S_AXI_RDATA : out std_logic_vector(31 downto 0);
S_AXI_RRESP : out std_logic_vector(1 downto 0);
S_AXI_RVALID : out std_logic;
S_AXI_RREADY : in std_logic);
end AxiLiteCrossbarTb;

architecture mapping of AxiLiteCrossbarTb is

constant NUM_AXIL_MASTERS_C : positive := 2;

constant AXIL_XBAR_CONFIG_C : AxiLiteCrossbarMasterConfigArray(NUM_AXIL_MASTERS_C-1 downto 0) := genAxiLiteConfig(NUM_AXIL_MASTERS_C, x"0000_0000", 22, 20);

constant NUM_CASCADE_MASTERS_C : positive := 2;

constant CASCADE_XBAR_CONFIG_C : AxiLiteCrossbarMasterConfigArray(NUM_CASCADE_MASTERS_C-1 downto 0) := (
0 => (
baseAddr => x"0010_2000",
addrBits => 12,
connectivity => X"0001"),
1 => (
baseAddr => x"0016_0000",
addrBits => 17,
connectivity => X"0001"));

signal axilClk : sl;
signal axilRst : sl;

signal axilReadMaster : AxiLiteReadMasterType;
signal axilReadSlave : AxiLiteReadSlaveType;
signal axilWriteMaster : AxiLiteWriteMasterType;
signal axilWriteSlave : AxiLiteWriteSlaveType;

signal axilReadMasters : AxiLiteReadMasterArray(NUM_AXIL_MASTERS_C-1 downto 0);
signal axilReadSlaves : AxiLiteReadSlaveArray(NUM_AXIL_MASTERS_C-1 downto 0) := (others => AXI_LITE_READ_SLAVE_EMPTY_DECERR_C);
signal axilWriteMasters : AxiLiteWriteMasterArray(NUM_AXIL_MASTERS_C-1 downto 0);
signal axilWriteSlaves : AxiLiteWriteSlaveArray(NUM_AXIL_MASTERS_C-1 downto 0) := (others => AXI_LITE_WRITE_SLAVE_EMPTY_DECERR_C);

signal cascadeReadMasters : AxiLiteReadMasterArray(NUM_CASCADE_MASTERS_C-1 downto 0);
signal cascadeReadSlaves : AxiLiteReadSlaveArray(NUM_CASCADE_MASTERS_C-1 downto 0) := (others => AXI_LITE_READ_SLAVE_EMPTY_DECERR_C);
signal cascadeWriteMasters : AxiLiteWriteMasterArray(NUM_CASCADE_MASTERS_C-1 downto 0);
signal cascadeWriteSlaves : AxiLiteWriteSlaveArray(NUM_CASCADE_MASTERS_C-1 downto 0) := (others => AXI_LITE_WRITE_SLAVE_EMPTY_DECERR_C);

begin

U_ShimLayer : entity surf.SlaveAxiLiteIpIntegrator
generic map (
EN_ERROR_RESP => true,
FREQ_HZ => 125000000,
ADDR_WIDTH => 32)
port map (
-- IP Integrator AXI-Lite Interface
S_AXI_ACLK => S_AXI_ACLK,
S_AXI_ARESETN => S_AXI_ARESETN,
S_AXI_AWADDR => S_AXI_AWADDR,
S_AXI_AWPROT => S_AXI_AWPROT,
S_AXI_AWVALID => S_AXI_AWVALID,
S_AXI_AWREADY => S_AXI_AWREADY,
S_AXI_WDATA => S_AXI_WDATA,
S_AXI_WSTRB => S_AXI_WSTRB,
S_AXI_WVALID => S_AXI_WVALID,
S_AXI_WREADY => S_AXI_WREADY,
S_AXI_BRESP => S_AXI_BRESP,
S_AXI_BVALID => S_AXI_BVALID,
S_AXI_BREADY => S_AXI_BREADY,
S_AXI_ARADDR => S_AXI_ARADDR,
S_AXI_ARPROT => S_AXI_ARPROT,
S_AXI_ARVALID => S_AXI_ARVALID,
S_AXI_ARREADY => S_AXI_ARREADY,
S_AXI_RDATA => S_AXI_RDATA,
S_AXI_RRESP => S_AXI_RRESP,
S_AXI_RVALID => S_AXI_RVALID,
S_AXI_RREADY => S_AXI_RREADY,
-- SURF AXI-Lite Interface
axilClk => axilClk,
axilRst => axilRst,
axilReadMaster => axilReadMaster,
axilReadSlave => axilReadSlave,
axilWriteMaster => axilWriteMaster,
axilWriteSlave => axilWriteSlave);

U_AXIL_XBAR : entity surf.AxiLiteCrossbar
generic map (
NUM_SLAVE_SLOTS_G => 1,
NUM_MASTER_SLOTS_G => NUM_AXIL_MASTERS_C,
MASTERS_CONFIG_G => AXIL_XBAR_CONFIG_C)
port map (
axiClk => axilClk,
axiClkRst => axilRst,
sAxiWriteMasters(0) => axilWriteMaster,
sAxiWriteSlaves(0) => axilWriteSlave,
sAxiReadMasters(0) => axilReadMaster,
sAxiReadSlaves(0) => axilReadSlave,
mAxiWriteMasters => axilWriteMasters,
mAxiWriteSlaves => axilWriteSlaves,
mAxiReadMasters => axilReadMasters,
mAxiReadSlaves => axilReadSlaves);

U_MEM : entity surf.AxiDualPortRam
generic map (
ADDR_WIDTH_G => 10,
DATA_WIDTH_G => 32)
port map (
-- Axi Port
axiClk => axilClk,
axiRst => axilRst,
axiReadMaster => axilReadMasters(0),
axiReadSlave => axilReadSlaves(0),
axiWriteMaster => axilWriteMasters(0),
axiWriteSlave => axilWriteSlaves(0));

U_CASCADE_XBAR : entity surf.AxiLiteCrossbar
generic map (
NUM_SLAVE_SLOTS_G => 1,
NUM_MASTER_SLOTS_G => NUM_CASCADE_MASTERS_C,
MASTERS_CONFIG_G => CASCADE_XBAR_CONFIG_C)
port map (
axiClk => axilClk,
axiClkRst => axilRst,
sAxiWriteMasters(0) => axilWriteMasters(1),
sAxiWriteSlaves(0) => axilWriteSlaves(1),
sAxiReadMasters(0) => axilReadMasters(1),
sAxiReadSlaves(0) => axilReadSlaves(1),
mAxiWriteMasters => cascadeWriteMasters,
mAxiWriteSlaves => cascadeWriteSlaves,
mAxiReadMasters => cascadeReadMasters,
mAxiReadSlaves => cascadeReadSlaves);

GEN_VEC :
for i in NUM_CASCADE_MASTERS_C-1 downto 0 generate

U_MEM : entity surf.AxiDualPortRam
generic map (
ADDR_WIDTH_G => 10,
DATA_WIDTH_G => 32)
port map (
-- Axi Port
axiClk => axilClk,
axiRst => axilRst,
axiReadMaster => cascadeReadMasters(i),
axiReadSlave => cascadeReadSlaves(i),
axiWriteMaster => cascadeWriteMasters(i),
axiWriteSlave => cascadeWriteSlaves(i));

end generate GEN_VEC;

end mapping;
Loading

0 comments on commit 78b55eb

Please sign in to comment.