/*
|
/*
|
* .--------------. .----------------. .------------.
|
* .--------------. .----------------. .------------.
|
* | .------------. | .--------------. | .----------. |
|
* | .------------. | .--------------. | .----------. |
|
* | | ____ ____ | | | ____ ____ | | | ______ | |
|
* | | ____ ____ | | | ____ ____ | | | ______ | |
|
* | ||_ || _|| | ||_ \ / _|| | | .' ___ || |
|
* | ||_ || _|| | ||_ \ / _|| | | .' ___ || |
|
* ___ _ __ ___ _ __ | | | |__| | | | | | \/ | | | |/ .' \_|| |
|
* ___ _ __ ___ _ __ | | | |__| | | | | | \/ | | | |/ .' \_|| |
|
* / _ \| '_ \ / _ \ '_ \ | | | __ | | | | | |\ /| | | | || | | |
|
* / _ \| '_ \ / _ \ '_ \ | | | __ | | | | | |\ /| | | | || | | |
|
* (_) | |_) | __/ | | || | _| | | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
|
* (_) | |_) | __/ | | || | _| | | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
|
* \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
|
* \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
|
* | | | | | | | | | | | |
|
* | | | | | | | | | | | |
|
* |_| | '------------' | '--------------' | '----------' |
|
* |_| | '------------' | '--------------' | '----------' |
|
* '--------------' '----------------' '------------'
|
* '--------------' '----------------' '------------'
|
*
|
*
|
* openHMC - An Open Source Hybrid Memory Cube Controller
|
* openHMC - An Open Source Hybrid Memory Cube Controller
|
* (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
|
* (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
|
* www.ziti.uni-heidelberg.de
|
* www.ziti.uni-heidelberg.de
|
* B6, 26
|
* B6, 26
|
* 68159 Mannheim
|
* 68159 Mannheim
|
* Germany
|
* Germany
|
*
|
*
|
* Contact: openhmc@ziti.uni-heidelberg.de
|
* Contact: openhmc@ziti.uni-heidelberg.de
|
* http://ra.ziti.uni-heidelberg.de/openhmc
|
* http://ra.ziti.uni-heidelberg.de/openhmc
|
*
|
*
|
* This source file is free software: you can redistribute it and/or modify
|
* This source file is free software: you can redistribute it and/or modify
|
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
* (at your option) any later version.
|
* (at your option) any later version.
|
*
|
*
|
* This source file is distributed in the hope that it will be useful,
|
* This source file is distributed in the hope that it will be useful,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
*
|
*
|
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
* along with this source file. If not, see .
|
* along with this source file. If not, see .
|
*
|
*
|
*
|
*
|
*/
|
*/
|
|
|
`include "axi4_stream_pkg.sv"
|
`include "axi4_stream_pkg.sv"
|
`include "hmc_module_pkg.sv"
|
`include "hmc_module_pkg.sv"
|
`include "cag_rgm_rfs_if.sv"
|
`include "cag_rgm_rfs_if.sv"
|
|
|
`timescale 100ps/10ps
|
`timescale 100ps/10ps
|
|
|
module tb_top ();
|
module tb_top ();
|
|
|
import uvm_pkg::*;
|
import uvm_pkg::*;
|
|
|
//-- include the UVCs
|
//-- include the UVCs
|
import axi4_stream_pkg::*;
|
import axi4_stream_pkg::*;
|
import hmc_module_pkg::*;
|
import hmc_module_pkg::*;
|
import hmc_base_types_pkg::*;
|
import hmc_base_types_pkg::*;
|
|
|
`include "cag_rgm.svh"
|
`include "cag_rgm.svh"
|
|
|
`ifdef X16
|
`ifdef X16
|
`include "register_file_model_16x.sv"
|
`include "register_file_model_16x.sv"
|
`else
|
`else
|
`include "register_file_model_8x.sv"
|
`include "register_file_model_8x.sv"
|
`endif
|
`endif
|
|
|
`include "hmc_packet.sv"
|
`include "hmc_packet.sv"
|
`include "hmc_req_packet.sv"
|
`include "hmc_req_packet.sv"
|
//`include "hmc_req_posted_packet.sv"
|
|
`include "hmc_2_axi4_sequencer.sv"
|
`include "hmc_2_axi4_sequencer.sv"
|
`include "hmc_2_axi4_sequence.sv"
|
`include "hmc_2_axi4_sequence.sv"
|
`include "tag_handler.sv"
|
`include "tag_handler.sv"
|
|
|
`include "hmc_link_config.sv"
|
`include "hmc_link_config.sv"
|
`include "hmc_vseqr.sv"
|
`include "vseqr.sv"
|
|
|
`include "axi4_stream_hmc_monitor.sv"
|
`include "axi4_stream_hmc_monitor.sv"
|
`include "bfm_2_hmc_monitor.sv"
|
`include "bfm_2_hmc_monitor.sv"
|
|
|
`include "hmc_tb.sv"
|
`include "hmc_tb.sv"
|
|
|
`include "test_lib.sv"
|
`include "test_lib.sv"
|
|
|
logic res_n, clk_user, clk_hmc_refclk;
|
logic res_n, clk_user, clk_hmc_refclk;
|
|
|
//-- instantiate the interfaces
|
//-- instantiate the interfaces
|
axi4_stream_if #(
|
axi4_stream_if #(
|
.DATA_BYTES(`AXI4BYTES),
|
.DATA_BYTES(`AXI4BYTES),
|
.TUSER_WIDTH(`AXI4BYTES)
|
.TUSER_WIDTH(`AXI4BYTES)
|
) axi4_hmc_req_if(
|
) axi4_hmc_req_if();
|
.ACLK(clk_user),
|
|
.ARESET_N(res_n)
|
|
);
|
|
|
|
axi4_stream_if #(
|
axi4_stream_if #(
|
.DATA_BYTES(`AXI4BYTES),
|
.DATA_BYTES(`AXI4BYTES),
|
.TUSER_WIDTH(`AXI4BYTES)
|
.TUSER_WIDTH(`AXI4BYTES)
|
) axi4_hmc_rsp_if(
|
) axi4_hmc_rsp_if();
|
.ACLK(clk_user),
|
|
.ARESET_N(res_n)
|
|
);
|
|
|
|
cag_rgm_rfs_if #(
|
cag_rgm_rfs_if #(
|
.ADDR_WIDTH(`RFS_HMC_CONTROLLER_RF_AWIDTH),
|
.ADDR_WIDTH(`RFS_OPENHMC_RF_AWIDTH),
|
.READ_DATA_WIDTH(`RFS_HMC_CONTROLLER_RF_RWIDTH),
|
.READ_DATA_WIDTH(`RFS_OPENHMC_RF_RWIDTH),
|
.WRITE_DATA_WIDTH(`RFS_HMC_CONTROLLER_RF_WWIDTH)
|
.WRITE_DATA_WIDTH(`RFS_OPENHMC_RF_WWIDTH)
|
) rfs_hmc_if();
|
) rfs_hmc_if();
|
|
|
dut dut_I (
|
dut dut_I (
|
.clk_user(clk_user),
|
.clk_user(clk_user),
|
.clk_hmc_refclk(clk_hmc_refclk),
|
.clk_hmc_refclk(clk_hmc_refclk),
|
.res_n(res_n),
|
.res_n(res_n),
|
|
|
.axi4_req(axi4_hmc_req_if),
|
.axi4_req(axi4_hmc_req_if),
|
.axi4_rsp(axi4_hmc_rsp_if),
|
.axi4_rsp(axi4_hmc_rsp_if),
|
|
|
.rfs_hmc(rfs_hmc_if)
|
.rfs_hmc(rfs_hmc_if)
|
);
|
);
|
|
|
initial begin
|
initial begin
|
|
|
uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_req", "vif", axi4_hmc_req_if);
|
uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_req", "vif", axi4_hmc_req_if);
|
uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_rsp", "vif", axi4_hmc_rsp_if);
|
uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_rsp", "vif", axi4_hmc_rsp_if);
|
|
|
//-- connect the BFM monitors with the Module UVC BFM to HMC Packet monitors
|
//-- connect the BFM monitors with the Module UVC BFM to HMC Packet monitors
|
uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_req_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_rsp_pkt[0]);
|
uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_req_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_rsp_pkt[0]);
|
uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_rsp_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_req_pkt[0]);
|
uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_rsp_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_req_pkt[0]);
|
|
|
//uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_req_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_req_pkt_err_cov[0]);
|
|
//uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_rsp_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_rsp_pkt_err_cov[0]);
|
|
|
|
run_test();
|
run_test();
|
end
|
end
|
|
|
initial begin
|
initial begin
|
clk_user <= 1'b1;
|
clk_user <= 1'b1;
|
clk_hmc_refclk <= 1'b1;
|
clk_hmc_refclk <= 1'b1;
|
res_n <= 1'b0;
|
res_n <= 1'b0;
|
#1000ns
|
#500ns;
|
@(posedge clk_user) res_n <= 1'b1;
|
@(posedge clk_user) res_n <= 1'b1;
|
end
|
end
|
|
|
//-- Generate the user clock
|
//-- Generate the user clock
|
always begin
|
always begin
|
case(`FPW)
|
case(`FPW)
|
2: begin
|
2: begin
|
if(`LOG_NUM_LANES==3) //8lanes
|
if(`LOG_NUM_LANES==3) //8lanes
|
#1.6ns clk_user = !clk_user;
|
#1.6ns clk_user = !clk_user;
|
else begin
|
else begin
|
#0.8ns clk_user = !clk_user;
|
#0.8ns clk_user = !clk_user;
|
end
|
end
|
end
|
end
|
4: begin
|
4: begin
|
if(`LOG_NUM_LANES==3) //8lanes
|
if(`LOG_NUM_LANES==3) //8lanes
|
#3.2ns clk_user = !clk_user;
|
#3.2ns clk_user = !clk_user;
|
else
|
else
|
#1.6ns clk_user = !clk_user;
|
#1.6ns clk_user = !clk_user;
|
end
|
end
|
6: begin
|
6: begin
|
if(`LOG_NUM_LANES==3) //8lanes
|
if(`LOG_NUM_LANES==3) //8lanes
|
#4.8ns clk_user = !clk_user;
|
#4.8ns clk_user = !clk_user;
|
else
|
else
|
#2.4ns clk_user = !clk_user;
|
#2.4ns clk_user = !clk_user;
|
end
|
end
|
8: begin
|
8: begin
|
if(`LOG_NUM_LANES==3) //8lanes
|
if(`LOG_NUM_LANES==3) //8lanes
|
#6.4ns clk_user = !clk_user;
|
#6.4ns clk_user = !clk_user;
|
else
|
else
|
#3.2ns clk_user = !clk_user;
|
#3.2ns clk_user = !clk_user;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
|
|
//-- 125 MHz
|
//-- 125 MHz HMC/Transceiver refclock
|
always #4ns clk_hmc_refclk <= ~clk_hmc_refclk;
|
always #4ns clk_hmc_refclk <= ~clk_hmc_refclk;
|
|
|
|
|