Skip to content
Snippets Groups Projects
Commit f7173c99 authored by Thomas B. Preußer's avatar Thomas B. Preußer
Browse files

Packaged IP infrastructure for axi_info.

parent 92c0171a
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -45,7 +45,7 @@ module axi_info #(
// Writing
input logic s_axi_AWVALID,
output logic s_axi_AWREADY,
input logic [$clog2(N)-1:0] s_axi_AWADDR,
input logic [$clog2(N)+1:0] s_axi_AWADDR,
input logic s_axi_WVALID,
output logic s_axi_WREADY,
......@@ -59,7 +59,7 @@ module axi_info #(
// Reading
input logic s_axi_ARVALID,
output logic s_axi_ARREADY,
input logic [$clog2(N)-1:0] s_axi_ARADDR,
input logic [$clog2(N)+1:0] s_axi_ARADDR,
output logic s_axi_RVALID,
input logic s_axi_RREADY,
......@@ -108,7 +108,7 @@ module axi_info #(
else if(s_axi_ARREADY) begin
RValid <= s_axi_ARVALID;
if(s_axi_ARADDR < N) begin
RData <= DATA[s_axi_ARADDR];
RData <= DATA[s_axi_ARADDR[$left(s_axi_ARADDR):2]];
RResp <= '0; // OKAY
end
else begin
......
......@@ -28,105 +28,68 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @brief Read-only exposure of compiled-in info data on AXI-lite.
* @author Thomas B. Preußer <tpreusse@amd.com>
*
*******************************************************************************/
module axi_info_tb #(
int unsigned N = 9,
int unsigned S_AXI_DATA_WIDTH = 32,
bit [S_AXI_DATA_WIDTH-1:0] DATA[N] = '{
32'h2437_9827,
32'ha639_bf83,
32'haec2_3ab1,
32'h5ab3_2b97,
32'hff1c_4e78,
32'h10c2_4968,
32'h4537_a1ec,
32'h694b_63d1,
32'h7f77_9af9
}
)();
module axi_info_top #(
bit [31:0] SIG_CUSTOMER,
bit [31:0] SIG_APPLICATION,
bit [31:0] VERSION,
bit [31:0] CHECKSUM_COUNT
)(
//- Global Control ------------------
logic ap_clk = 0;
always #5ns ap_clk = !ap_clk;
logic ap_rst_n = 1;
input logic ap_clk,
input logic ap_rst_n,
//- AXI Lite ------------------------
// Writing
uwire s_axi_AWVALID = 0;
uwire s_axi_AWREADY;
uwire [$clog2(N)-1:0] s_axi_AWADDR = 'x;
input logic s_axi_AWVALID,
output logic s_axi_AWREADY,
input logic [4:0] s_axi_AWADDR,
uwire s_axi_WVALID = 0;
uwire s_axi_WREADY;
uwire [S_AXI_DATA_WIDTH -1:0] s_axi_WDATA = 'x;
uwire [S_AXI_DATA_WIDTH/8-1:0] s_axi_WSTRB = 'x;
input logic s_axi_WVALID,
output logic s_axi_WREADY,
input logic [31:0] s_axi_WDATA,
input logic [ 3:0] s_axi_WSTRB,
uwire s_axi_BVALID;
uwire s_axi_BREADY = 0;
uwire [1:0] s_axi_BRESP;
output logic s_axi_BVALID,
input logic s_axi_BREADY,
output logic [1:0] s_axi_BRESP,
// Reading
logic s_axi_ARVALID;
uwire s_axi_ARREADY;
logic [$clog2(N)-1:0] s_axi_ARADDR;
input logic s_axi_ARVALID,
output logic s_axi_ARREADY,
input logic [4:0] s_axi_ARADDR,
uwire s_axi_RVALID;
logic s_axi_RREADY = 0;
uwire [S_AXI_DATA_WIDTH-1:0] s_axi_RDATA;
uwire [ 1:0] s_axi_RRESP;
output logic s_axi_RVALID,
input logic s_axi_RREADY,
output logic [31:0] s_axi_RDATA,
output logic [ 1:0] s_axi_RRESP
);
axi_info #(.N(N), .S_AXI_DATA_WIDTH(S_AXI_DATA_WIDTH), .DATA(DATA)) dut (
axi_info #(
.N(6),
.S_AXI_DATA_WIDTH(32),
.DATA('{
32'h4649_4E4E,
SIG_CUSTOMER,
SIG_CUSTOMER,
VERSION,
32'h0,
CHECKSUM_COUNT
})
)(
//- Global Control ------------------
.ap_clk, .ap_rst_n,
.s_axi_AWVALID, .s_axi_AWREADY, .s_axi_AWADDR,
.s_axi_WVALID, .s_axi_WREADY, .s_axi_WDATA, .s_axi_WSTRB,
.s_axi_BVALID, .s_axi_BREADY, .s_axi_BRESP,
.s_axi_ARVALID, .s_axi_ARREADY, .s_axi_ARADDR,
.s_axi_RVALID, .s_axi_RREADY, .s_axi_RDATA, .s_axi_RRESP
//- AXI Lite ------------------------
// Writing
.s_axi_AWVALID, .s_axi_AWREADY, .s_axi_AWADDR,
.s_axi_WVALID, .s_axi_WREADY, .s_axi_WDATA, .s_axi_WSTRB,
.s_axi_BVALID, .s_axi_BREADY, .s_axi_BRESP,
// Reading
.s_axi_ARVALID, .s_axi_ARREADY, .s_axi_ARADDR,
.s_axi_RVALID, .s_axi_RREADY, .s_axi_RDATA, .s_axi_RRESP
);
//-----------------------------------------------------------------------
// Read address feed
initial begin
s_axi_ARVALID = 0;
s_axi_ARADDR = 'x;
@(posedge ap_clk iff ap_rst_n);
for(int unsigned i = 0; i < N; i++) begin
repeat($urandom()%3 > 0);
s_axi_ARVALID <= 1;
s_axi_ARADDR <= i;
@(posedge ap_clk iff s_axi_ARREADY);
s_axi_ARVALID <= 0;
s_axi_ARADDR <= 'x;
end
end
//-----------------------------------------------------------------------
// Read reply check
always_ff @(posedge ap_clk) begin
static int Cnt = 0;
if(!ap_rst_n) begin
s_axi_RREADY <= 0;
Cnt = 0;
end
else begin
if(s_axi_RVALID || !s_axi_RREADY) s_axi_RREADY <= $urandom()%7 > 2;
if(s_axi_RVALID && s_axi_RREADY) begin
assert(s_axi_RRESP === 2'b00) else begin
$error("AXI read error indicator: %0d", s_axi_RRESP);
$stop;
end
assert(s_axi_RDATA === DATA[Cnt]) else begin
$error("Unexpected read reply: 0x%08x instead of 0x%08x", s_axi_RDATA, DATA[Cnt]);
$stop;
end
if(++Cnt == N) $finish;
end
end
end
endmodule : axi_info_tb
endmodule : axi_info_top
# Definitional proc to organize widgets for parameters.
proc init_gui { IPINST } {
ipgui::add_param $IPINST -name "Component_Name"
#Adding Page
set Page_0 [ipgui::add_page $IPINST -name "Page 0"]
ipgui::add_param $IPINST -name "CHECKSUM_COUNT" -parent ${Page_0}
ipgui::add_param $IPINST -name "SIG_APPLICATION" -parent ${Page_0}
ipgui::add_param $IPINST -name "SIG_CUSTOMER" -parent ${Page_0}
ipgui::add_param $IPINST -name "VERSION" -parent ${Page_0}
}
proc update_PARAM_VALUE.CHECKSUM_COUNT { PARAM_VALUE.CHECKSUM_COUNT } {
# Procedure called to update CHECKSUM_COUNT when any of the dependent parameters in the arguments change
}
proc validate_PARAM_VALUE.CHECKSUM_COUNT { PARAM_VALUE.CHECKSUM_COUNT } {
# Procedure called to validate CHECKSUM_COUNT
return true
}
proc update_PARAM_VALUE.SIG_APPLICATION { PARAM_VALUE.SIG_APPLICATION } {
# Procedure called to update SIG_APPLICATION when any of the dependent parameters in the arguments change
}
proc validate_PARAM_VALUE.SIG_APPLICATION { PARAM_VALUE.SIG_APPLICATION } {
# Procedure called to validate SIG_APPLICATION
return true
}
proc update_PARAM_VALUE.SIG_CUSTOMER { PARAM_VALUE.SIG_CUSTOMER } {
# Procedure called to update SIG_CUSTOMER when any of the dependent parameters in the arguments change
}
proc validate_PARAM_VALUE.SIG_CUSTOMER { PARAM_VALUE.SIG_CUSTOMER } {
# Procedure called to validate SIG_CUSTOMER
return true
}
proc update_PARAM_VALUE.VERSION { PARAM_VALUE.VERSION } {
# Procedure called to update VERSION when any of the dependent parameters in the arguments change
}
proc validate_PARAM_VALUE.VERSION { PARAM_VALUE.VERSION } {
# Procedure called to validate VERSION
return true
}
proc update_MODELPARAM_VALUE.SIG_CUSTOMER { MODELPARAM_VALUE.SIG_CUSTOMER PARAM_VALUE.SIG_CUSTOMER } {
# Procedure called to set VHDL generic/Verilog parameter value(s) based on TCL parameter value
set_property value [get_property value ${PARAM_VALUE.SIG_CUSTOMER}] ${MODELPARAM_VALUE.SIG_CUSTOMER}
}
proc update_MODELPARAM_VALUE.SIG_APPLICATION { MODELPARAM_VALUE.SIG_APPLICATION PARAM_VALUE.SIG_APPLICATION } {
# Procedure called to set VHDL generic/Verilog parameter value(s) based on TCL parameter value
set_property value [get_property value ${PARAM_VALUE.SIG_APPLICATION}] ${MODELPARAM_VALUE.SIG_APPLICATION}
}
proc update_MODELPARAM_VALUE.VERSION { MODELPARAM_VALUE.VERSION PARAM_VALUE.VERSION } {
# Procedure called to set VHDL generic/Verilog parameter value(s) based on TCL parameter value
set_property value [get_property value ${PARAM_VALUE.VERSION}] ${MODELPARAM_VALUE.VERSION}
}
proc update_MODELPARAM_VALUE.CHECKSUM_COUNT { MODELPARAM_VALUE.CHECKSUM_COUNT PARAM_VALUE.CHECKSUM_COUNT } {
# Procedure called to set VHDL generic/Verilog parameter value(s) based on TCL parameter value
set_property value [get_property value ${PARAM_VALUE.CHECKSUM_COUNT}] ${MODELPARAM_VALUE.CHECKSUM_COUNT}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment