// -- (c) Copyright 2009 - 2011 Xilinx, Inc. All rights reserved. // -- // -- This file contains confidential and proprietary information // -- of Xilinx, Inc. and is protected under U.S. and // -- international copyright and other intellectual property // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a license and does not grant any // -- rights to the materials distributed herewith. Except as // -- otherwise provided in a valid license issued to you by // -- Xilinx, and to the maximum extent permitted by applicable // -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // -- (2) Xilinx shall not be liable (whether in contract or tort, // -- including negligence, or under any other theory of // -- liability) for any loss or damage of any kind or nature // -- related to, arising under or in connection with these // -- materials, including for any direct, or any indirect, // -- special, incidental, or consequential loss or damage // -- (including loss of data, profits, goodwill, or any type of // -- loss or damage suffered as a result of any action brought // -- by a third party) even if such damage or loss was // -- reasonably foreseeable or Xilinx had been advised of the // -- possibility of the same. // -- // -- CRITICAL APPLICATIONS // -- Xilinx products are not designed or intended to be fail- // -- safe, or for use in any application requiring fail-safe // -- performance, such as life-support or safety devices or // -- systems, Class III medical devices, nuclear facilities, // -- applications related to the deployment of airbags, or any // -- other applications that could lead to death, personal // -- injury, or severe property or environmental damage // -- (individually and collectively, "Critical // -- Applications"). Customer assumes the sole risk and // -- liability of any use of Xilinx products in Critical // -- Applications, subject only to applicable laws and // -- regulations governing limitations on product liability. // -- // -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // -- PART OF THIS FILE AT ALL TIMES. //----------------------------------------------------------------------------- // // File name: si_transactor.v // // Description: // This module manages multi-threaded transactions for one SI-slot. // The module interface consists of a 1-slave to 1-master address channel, plus a // (M+1)-master (from M MI-slots plus error handler) to 1-slave response channel. // The module maintains transaction thread control registers that count the // number of outstanding transations for each thread and the target MI-slot. // On the address channel, the module decodes addresses to select among MI-slots // accessible to the SI-slot where it is instantiated. // It then qualifies whether each received transaction // should be propagated as a request to the address channel arbiter. // Transactions are blocked while there is any outstanding transaction to a // different slave (MI-slot) for the requested ID thread (for deadlock avoidance). // On the response channel, the module mulitplexes transfers from each of the // MI-slots whenever a transfer targets the ID of an active thread, // arbitrating between MI-slots if multiple threads respond concurrently. // //-------------------------------------------------------------------------- // // Structure: // si_transactor // addr_decoder // comparator_static // mux_enc // axic_srl_fifo // arbiter_resp // //----------------------------------------------------------------------------- `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module axi_crossbar_v2_1_si_transactor # ( parameter C_FAMILY = "none", parameter integer C_SI = 0, // SI-slot number of current instance. parameter integer C_DIR = 0, // Direction: 0 = Write; 1 = Read. parameter integer C_NUM_ADDR_RANGES = 1, parameter integer C_NUM_M = 2, parameter integer C_NUM_M_LOG = 1, parameter integer C_ACCEPTANCE = 1, // Acceptance limit of this SI-slot. parameter integer C_ACCEPTANCE_LOG = 0, // Width of acceptance counter for this SI-slot. parameter integer C_ID_WIDTH = 1, parameter integer C_THREAD_ID_WIDTH = 0, parameter integer C_ADDR_WIDTH = 32, parameter integer C_AMESG_WIDTH = 1, // Used for AW or AR channel payload, depending on instantiation. parameter integer C_RMESG_WIDTH = 1, // Used for B or R channel payload, depending on instantiation. parameter [C_ID_WIDTH-1:0] C_BASE_ID = {C_ID_WIDTH{1'b0}}, parameter [C_ID_WIDTH-1:0] C_HIGH_ID = {C_ID_WIDTH{1'b0}}, parameter [C_NUM_M*C_NUM_ADDR_RANGES*64-1:0] C_BASE_ADDR = {C_NUM_M*C_NUM_ADDR_RANGES*64{1'b1}}, parameter [C_NUM_M*C_NUM_ADDR_RANGES*64-1:0] C_HIGH_ADDR = {C_NUM_M*C_NUM_ADDR_RANGES*64{1'b0}}, parameter integer C_SINGLE_THREAD = 0, parameter [C_NUM_M-1:0] C_TARGET_QUAL = {C_NUM_M{1'b1}}, parameter [C_NUM_M*32-1:0] C_M_AXI_SECURE = {C_NUM_M{32'h00000000}}, parameter integer C_RANGE_CHECK = 0, parameter integer C_ADDR_DECODE =0, parameter [C_NUM_M*32-1:0] C_ERR_MODE = {C_NUM_M{32'h00000000}}, parameter integer C_DEBUG = 1 ) ( // Global Signals input wire ACLK, input wire ARESET, // Slave Address Channel Interface Ports input wire [C_ID_WIDTH-1:0] S_AID, input wire [C_ADDR_WIDTH-1:0] S_AADDR, input wire [8-1:0] S_ALEN, input wire [3-1:0] S_ASIZE, input wire [2-1:0] S_ABURST, input wire [2-1:0] S_ALOCK, input wire [3-1:0] S_APROT, // input wire [4-1:0] S_AREGION, input wire [C_AMESG_WIDTH-1:0] S_AMESG, input wire S_AVALID, output wire S_AREADY, // Master Address Channel Interface Ports output wire [C_ID_WIDTH-1:0] M_AID, output wire [C_ADDR_WIDTH-1:0] M_AADDR, output wire [8-1:0] M_ALEN, output wire [3-1:0] M_ASIZE, output wire [2-1:0] M_ALOCK, output wire [3-1:0] M_APROT, output wire [4-1:0] M_AREGION, output wire [C_AMESG_WIDTH-1:0] M_AMESG, output wire [(C_NUM_M+1)-1:0] M_ATARGET_HOT, output wire [(C_NUM_M_LOG+1)-1:0] M_ATARGET_ENC, output wire [7:0] M_AERROR, output wire M_AVALID_QUAL, output wire M_AVALID, input wire M_AREADY, // Slave Response Channel Interface Ports output wire [C_ID_WIDTH-1:0] S_RID, output wire [C_RMESG_WIDTH-1:0] S_RMESG, output wire S_RLAST, output wire S_RVALID, input wire S_RREADY, // Master Response Channel Interface Ports input wire [(C_NUM_M+1)*C_ID_WIDTH-1:0] M_RID, input wire [(C_NUM_M+1)*C_RMESG_WIDTH-1:0] M_RMESG, input wire [(C_NUM_M+1)-1:0] M_RLAST, input wire [(C_NUM_M+1)-1:0] M_RVALID, output wire [(C_NUM_M+1)-1:0] M_RREADY, input wire [(C_NUM_M+1)-1:0] M_RTARGET, // Does response ID from each MI-slot target this SI slot? input wire [8-1:0] DEBUG_A_TRANS_SEQ ); localparam integer P_WRITE = 0; localparam integer P_READ = 1; localparam integer P_RMUX_MESG_WIDTH = C_ID_WIDTH + C_RMESG_WIDTH + 1; localparam [31:0] P_AXILITE_ERRMODE = 32'h00000001; localparam integer P_NONSECURE_BIT = 1; localparam integer P_NUM_M_LOG_M1 = C_NUM_M_LOG ? C_NUM_M_LOG : 1; localparam [C_NUM_M-1:0] P_M_AXILITE = f_m_axilite(0); // Mask of AxiLite MI-slots localparam [1:0] P_FIXED = 2'b00; localparam integer P_NUM_M_DE_LOG = f_ceil_log2(C_NUM_M+1); localparam integer P_THREAD_ID_WIDTH_M1 = (C_THREAD_ID_WIDTH > 0) ? C_THREAD_ID_WIDTH : 1; localparam integer P_NUM_ID_VAL = 2**C_THREAD_ID_WIDTH; localparam integer P_NUM_THREADS = (P_NUM_ID_VAL < C_ACCEPTANCE) ? P_NUM_ID_VAL : C_ACCEPTANCE; localparam [C_NUM_M-1:0] P_M_SECURE_MASK = f_bit32to1_mi(C_M_AXI_SECURE); // Mask of secure MI-slots // Ceiling of log2(x) function integer f_ceil_log2 ( input integer x ); integer acc; begin acc=0; while ((2**acc) < x) acc = acc + 1; f_ceil_log2 = acc; end endfunction // AxiLite protocol flag vector function [C_NUM_M-1:0] f_m_axilite ( input integer null_arg ); integer mi; begin for (mi=0; mi