forked from pulp-platform/axi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
axi_dwc_downsizer: Add testbench for the DW Downsizer
- Loading branch information
1 parent
7b8dc23
commit adce885
Showing
7 changed files
with
185 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add wave -position insertpoint \ | ||
sim:/tb_axi_dw_downsizer/i_dw_converter/gen_dw_downsize/i_axi_dw_downsizer/AxiMstDataWidth \ | ||
sim:/tb_axi_dw_downsizer/i_dw_converter/gen_dw_downsize/i_axi_dw_downsizer/AxiSlvDataWidth \ | ||
sim:/tb_axi_dw_downsizer/i_dw_converter/gen_dw_downsize/i_axi_dw_downsizer/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// Copyright 2020 ETH Zurich and University of Bologna. | ||
// Copyright and related rights are licensed under the Solderpad Hardware | ||
// License, Version 0.51 (the "License"); you may not use this file except in | ||
// compliance with the License. You may obtain a copy of the License at | ||
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law | ||
// or agreed to in writing, software, hardware and materials distributed under | ||
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
|
||
// File : tb_axi_dw_downsizer.sv | ||
// Author : Matheus Cavalcante <[email protected]> | ||
// Created : 09.02.2019 | ||
|
||
// Copyright (C) 2020 ETH Zurich, University of Bologna | ||
// All rights reserved. | ||
|
||
`include "axi/assign.svh" | ||
|
||
module tb_axi_dw_downsizer; | ||
|
||
parameter AW = 64; | ||
parameter IW = 4; | ||
parameter DW = 32; | ||
parameter UW = 8; | ||
parameter MULT = 8; | ||
|
||
localparam tCK = 1ns; | ||
|
||
logic clk = 0; | ||
logic rst = 1; | ||
logic done = 0; | ||
|
||
AXI_BUS_DV #( | ||
.AXI_ADDR_WIDTH (AW ), | ||
.AXI_DATA_WIDTH (MULT * DW), | ||
.AXI_ID_WIDTH (IW ), | ||
.AXI_USER_WIDTH (UW ) | ||
) axi_master_dv (clk); | ||
|
||
AXI_BUS #( | ||
.AXI_ADDR_WIDTH (AW ), | ||
.AXI_DATA_WIDTH (MULT * DW), | ||
.AXI_ID_WIDTH (IW ), | ||
.AXI_USER_WIDTH (UW ) | ||
) axi_master(); | ||
|
||
axi_test::rand_axi_master #( | ||
.AW (AW ), | ||
.DW (MULT * DW), | ||
.IW (IW ), | ||
.UW (UW ), | ||
.MAX_READ_TXNS (8 ), | ||
.MAX_WRITE_TXNS (8 ), | ||
.TA (200ps ), | ||
.TT (700ps ) | ||
) axi_master_drv = new ( axi_master_dv ); | ||
|
||
AXI_BUS_DV #( | ||
.AXI_ADDR_WIDTH (AW), | ||
.AXI_DATA_WIDTH (DW), | ||
.AXI_ID_WIDTH (IW), | ||
.AXI_USER_WIDTH (UW) | ||
) axi_slave_dv (clk); | ||
|
||
AXI_BUS #( | ||
.AXI_ADDR_WIDTH (AW), | ||
.AXI_DATA_WIDTH (DW), | ||
.AXI_ID_WIDTH (IW), | ||
.AXI_USER_WIDTH (UW) | ||
) axi_slave (); | ||
|
||
axi_test::rand_axi_slave #( | ||
.AW (AW ), | ||
.DW (DW ), | ||
.IW (IW ), | ||
.UW (UW ), | ||
.TA (200ps), | ||
.TT (700ps) | ||
) axi_slave_drv = new (axi_slave_dv); | ||
|
||
`AXI_ASSIGN(axi_master, axi_master_dv); | ||
`AXI_ASSIGN(axi_slave_dv, axi_slave) ; | ||
|
||
axi_dw_converter #( | ||
.AxiSlvDataWidth(MULT*DW), | ||
.AxiMstDataWidth(DW ), | ||
.AxiIdWidth (IW ), | ||
.AxiUserWidth (UW ), | ||
.AxiMaxTrans (4 ) | ||
) i_dw_converter ( | ||
.clk_i (clk ), | ||
.rst_ni(rst ), | ||
.slv (axi_master), | ||
.mst (axi_slave ) | ||
); | ||
|
||
initial begin | ||
#tCK; | ||
rst <= 0; | ||
#tCK; | ||
rst <= 1; | ||
#tCK; | ||
while (!done) begin | ||
clk <= 1; | ||
#(tCK/2); | ||
clk <= 0; | ||
#(tCK/2); | ||
end | ||
end | ||
|
||
initial begin | ||
axi_master_drv.reset() ; | ||
axi_master_drv.add_memory_region({AW{1'b0}}, {AW{1'b1}}, axi_pkg::WTHRU_NOALLOCATE); | ||
axi_master_drv.run(50, 50) ; | ||
done = 1; | ||
end | ||
|
||
initial begin | ||
axi_slave_drv.reset(); | ||
axi_slave_drv.run() ; | ||
end | ||
|
||
// vsim -voptargs=+acc work.tb_axi_dw_downsizer | ||
endmodule : tb_axi_dw_downsizer |