Line 1... |
Line 1... |
//Author : Alex Zhang (cgzhangwei@gmail.com)
|
//Author : Alex Zhang (cgzhangwei@gmail.com)
|
//Date : 03-11-2015
|
//Date : 03-11-2015
|
//Basic : How to storage the AXI info and data into sram or fifo.
|
//Basic : How to storage the AXI info and data into sram or fifo.
|
`include "wb2axi_parameters.vh"
|
`include "wb2axi_parameters.vh"
|
|
|
module axi_ingress (
|
module axi_ingress (
|
axi_clk,
|
axi_clk,
|
reset_n,
|
reset_n,
|
AXI_IF,
|
AXI_IF,
|
fifo_full,
|
fifo_full,
|
fifo_addr_info,
|
fifo_addr_info,
|
fifo_data_info,
|
fifo_data_info,
|
fifo_addr_wr,
|
fifo_addr_wr,
|
fifo_data_wr
|
fifo_data_wr
|
);
|
);
|
parameter AXI_WID_W = 5;
|
parameter AXI_ID_W = `WB2AXI_AXI_ID_W ;
|
|
parameter AXI_ADDR_W = `WB2AXI_AXI_ADDR_W ;
|
|
parameter AXI_DATA_W = `WB2AXI_AXI_DATA_W ;
|
|
parameter AXI_PROT_W = `WB2AXI_AXI_PROT_W ;
|
|
parameter AXI_STB_W = `WB2AXI_AXI_STB_W ;
|
|
parameter AXI_LEN_W = `WB2AXI_AXI_LEN_W ;
|
|
parameter AXI_SIZE_W = `WB2AXI_AXI_SIZE_W ;
|
|
parameter AXI_BURST_W = `WB2AXI_AXI_BURST_W;
|
|
parameter AXI_LOCK_W = `WB2AXI_AXI_LOCK_W ;
|
|
parameter AXI_CACHE_W = `WB2AXI_AXI_CACHE_W;
|
|
parameter AXI_RESP_W = `WB2AXI_AXI_RESP_W ;
|
parameter AXI_MAX_RESP_W = 3;
|
parameter AXI_MAX_RESP_W = 3;
|
|
parameter FIFO_ADR_W = 10;
|
|
parameter FIFO_DAT_W = 10;
|
|
|
input axi_clk;
|
input axi_clk;
|
input reset_n;
|
input reset_n;
|
axi_if.target AXI_IF;
|
axi_if.target AXI_IF;
|
output fifo_full;
|
output fifo_full;
|
output [FIFO_AW-1:0] fifo_addr_info;
|
output [FIFO_ADR_W-1:0] fifo_addr_info;
|
output [FIFO_DW-1:0] fifo_data_info;
|
output [FIFO_DAT_W-1:0] fifo_data_info;
|
output reg fifo_addr_wr;
|
output reg fifo_addr_wr;
|
output reg fifo_data_wr;
|
output reg fifo_data_wr;
|
localparam ST_W = 2;
|
localparam ST_W = 2;
|
localparam ST_IDLE = 2'b00;
|
localparam ST_IDLE = 2'b00;
|
localparam ST_WDATA = 2'b01;
|
localparam ST_WDATA = 2'b01;
|
Line 36... |
Line 50... |
|
|
|
|
reg [ST_W-1:0] state;
|
reg [ST_W-1:0] state;
|
reg [ST_W-1:0] next_state;
|
reg [ST_W-1:0] next_state;
|
reg [AXI_MAX_RESP_W-1:0] bresp_pending_cnt; //responses pending to generate
|
reg [AXI_MAX_RESP_W-1:0] bresp_pending_cnt; //responses pending to generate
|
reg [AXI_WID_W-1:0] last_wid;
|
reg [AXI_ID_W-1:0] last_wid;
|
reg [FIFO_AW-1:0] fifo_addr_in;
|
reg [FIFO_ADR_W-1:0] fifo_addr_in;
|
reg [FIFO_DW-1:0] fifo_data_in;
|
reg [FIFO_DAT_W-1:0] fifo_data_in;
|
|
|
assign input_addr_event = AXI_IF.AWVALID & AXI_IF.AWREADY;
|
assign input_addr_event = AXI_IF.AWVALID & AXI_IF.AWREADY;
|
assign input_data_event = AXI_FI.WVALID & AXI_IF.WREADY;
|
assign input_data_event = AXI_IF.WVALID & AXI_IF.WREADY;
|
assign inc_bresp = AXI_IF.WLAST & input_data_event;
|
assign inc_bresp = AXI_IF.WLAST & input_data_event;
|
assign dec_bresp = AXI_IF.BREADY & AXI_IF.BVALID;
|
assign dec_bresp = AXI_IF.BREADY & AXI_IF.BVALID;
|
assign bresp_cnt_max = (bresp_pending_cnt == AXI_MAX_RESP_VAL);
|
assign bresp_cnt_max = (bresp_pending_cnt == AXI_MAX_RESP_VAL);
|
|
|
always_comb begin
|
always_comb begin
|
Line 101... |
Line 115... |
assign AXI_IF.ARREADY = 0;
|
assign AXI_IF.ARREADY = 0;
|
assign AXI_IF.RDATA = 0;
|
assign AXI_IF.RDATA = 0;
|
assign AXI_IF.RRESP = 0;
|
assign AXI_IF.RRESP = 0;
|
assign AXI_IF.RLAST = 0;
|
assign AXI_IF.RLAST = 0;
|
assign AXI_IF.RVALID = 0;
|
assign AXI_IF.RVALID = 0;
|
assign AIX_IF.AWREADY = (state ==ST_IDLE || state==ST_WDATA) & ~fifo_full & ~bresp_cnt_max;
|
assign AXI_IF.AWREADY = (state ==ST_IDLE || state==ST_WDATA) & ~fifo_full & ~bresp_cnt_max;
|
assign AXI_IF.WREADY = ~fifo_full & ~bresp_cnt_max;
|
assign AXI_IF.WREADY = ~fifo_full & ~bresp_cnt_max;
|
|
|
assign fifo_addr_info = fifo_addr_in;
|
assign fifo_addr_info = fifo_addr_in;
|
assign fifo_data_info = fifo_data_in;
|
assign fifo_data_info = fifo_data_in;
|
|
|