diff --git a/Makefile b/Makefile index dfa20c4..aa773d5 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ CPP_BUILD_LOG=logs/$(PROJ)_build_cpp.log SIM_LOG=$(PROJ)_sim.log -SV_FILES=$(shell ls common/* src/*.sv tb/*.sv) -SV_SRC=$(UVM_HOME)/src/uvm_pkg.sv common/common_pkg.sv src/design_pkg.sv tb/tb_types.sv tb/tb_pkg.sv +SV_FILES=$(shell ls common/*.sv src/axi/*.sv tb/*.sv) +SV_SRC=$(UVM_HOME)/src/uvm_pkg.sv common/common_pkg.sv src/axi/axi_types.sv src/axi/axi_pkg.sv tb/tb_pkg.sv DPI_SRC=$(UVM_HOME)/src/dpi/uvm_dpi.cc DPI_INC=-I/usr/share/verilator/include SV_DEPS=$(SV_FILES) @@ -44,7 +44,7 @@ BUILD_ARGS=-I$(UVM_HOME)/src -I. \ +define+SVA_ON \ $(UVM_DEFINES) \ $(DISABLED_WARNINGS) \ - +incdir+common +incdir+src +incdir+tb \ + +incdir+common +incdir+src/axi +incdir+tb \ $(SV_SRC) ifndef TEST_NAME diff --git a/common/common_macros.svh b/common/common_macros.svh new file mode 100644 index 0000000..20bc9c7 --- /dev/null +++ b/common/common_macros.svh @@ -0,0 +1,8 @@ +// Convenience macros for AXI interfaces +`define AXI_INTF axi_intf #(.ADDR_WIDTH(`ADDR_WIDTH), \ + .CEIL_DATA_WIDTH_DIV_128(`CEIL_DATA_WIDTH_DIV_128), \ + .CEIL_DATA_WIDTH_DIV_128_TMS_4(`CEIL_DATA_WIDTH_DIV_128_TMS_4), \ + .CEIL_DATA_WIDTH_DIV_64(`CEIL_DATA_WIDTH_DIV_64), \ + .DATA_WIDTH(`DATA_WIDTH), \ + .DATA_WIDTH_DIV_8(`DATA_WIDTH_DIV_8)) + diff --git a/tb/tb_params.sv b/common/common_params.svh similarity index 78% rename from tb/tb_params.sv rename to common/common_params.svh index 7310759..5fc4bf5 100644 --- a/tb/tb_params.sv +++ b/common/common_params.svh @@ -29,11 +29,3 @@ // `define USER_DATA_WIDTH 1 // `define USER_REQ_WIDTH 1 // `define USER_RESP_WIDTH 1 - -// Defines -`define AXI_INTF axi_intf #(.ADDR_WIDTH(`ADDR_WIDTH), \ - .CEIL_DATA_WIDTH_DIV_128(`CEIL_DATA_WIDTH_DIV_128), \ - .CEIL_DATA_WIDTH_DIV_128_TMS_4(`CEIL_DATA_WIDTH_DIV_128_TMS_4), \ - .CEIL_DATA_WIDTH_DIV_64(`CEIL_DATA_WIDTH_DIV_64), \ - .DATA_WIDTH(`DATA_WIDTH), \ - .DATA_WIDTH_DIV_8(`DATA_WIDTH_DIV_8)) diff --git a/common/common_pkg.sv b/common/common_pkg.sv index 903cdb5..4aee578 100644 --- a/common/common_pkg.sv +++ b/common/common_pkg.sv @@ -1,3 +1,5 @@ `include "axi.intf.sv" +`include "common_params.svh" +`include "common_macros.svh" package common_pkg; endpackage diff --git a/tb/axi_agent.sv b/src/axi/axi_agent.sv similarity index 95% rename from tb/axi_agent.sv rename to src/axi/axi_agent.sv index bc243ae..a52de46 100644 --- a/tb/axi_agent.sv +++ b/src/axi/axi_agent.sv @@ -5,7 +5,7 @@ typedef axi_sequencer; class axi_agent extends uvm_agent; - agent_type_t agent_type; + axi_agent_type_t agent_type; virtual `AXI_INTF.MANAGER m_if; virtual `AXI_INTF.SUBORDINATE s_if; @@ -15,7 +15,7 @@ class axi_agent extends uvm_agent; axi_monitor monitor; `uvm_component_utils_begin(axi_agent) - `uvm_field_enum(agent_type_t, agent_type, UVM_DEFAULT) + `uvm_field_enum(axi_agent_type_t, agent_type, UVM_DEFAULT) `uvm_component_utils_end // -------------------------------------------------- @@ -26,7 +26,7 @@ class axi_agent extends uvm_agent; // -------------------------------------------------- // Set agent type - function void set_agent_type(agent_type_t atype); + function void set_agent_type(axi_agent_type_t atype); agent_type = atype; `uvm_info("set_agent_type", $sformatf("Agent type set to %s", agent_type.name()), UVM_LOW) endfunction diff --git a/tb/axi_driver.sv b/src/axi/axi_driver.sv similarity index 98% rename from tb/axi_driver.sv rename to src/axi/axi_driver.sv index 9dd20f2..c52216b 100644 --- a/tb/axi_driver.sv +++ b/src/axi/axi_driver.sv @@ -4,7 +4,7 @@ class axi_driver extends uvm_driver; // #(axi_transaction); virtual `AXI_INTF.MANAGER m_if; virtual `AXI_INTF.SUBORDINATE s_if; - agent_type_t agent_type; + axi_agent_type_t agent_type; `uvm_component_utils(axi_driver) @@ -16,7 +16,7 @@ class axi_driver extends uvm_driver; // #(axi_transaction); // -------------------------------------------------- // Set agent type - function void set_agent_type(agent_type_t atype); + function void set_agent_type(axi_agent_type_t atype); agent_type = atype; `uvm_info("set_agent_type", $sformatf("Agent type set to %s", agent_type.name()), UVM_LOW) endfunction diff --git a/tb/axi_monitor.sv b/src/axi/axi_monitor.sv similarity index 97% rename from tb/axi_monitor.sv rename to src/axi/axi_monitor.sv index d9b3a8b..4b9a37b 100644 --- a/tb/axi_monitor.sv +++ b/src/axi/axi_monitor.sv @@ -4,7 +4,7 @@ class axi_monitor extends uvm_monitor; // #(axi_transaction); virtual `AXI_INTF.MANAGER m_if; virtual `AXI_INTF.SUBORDINATE s_if; - agent_type_t agent_type; + axi_agent_type_t agent_type; // Declare the analysis export uvm_analysis_port ap; @@ -23,7 +23,7 @@ class axi_monitor extends uvm_monitor; // #(axi_transaction); // -------------------------------------------------- // Set agent type - function void set_agent_type(agent_type_t atype); + function void set_agent_type(axi_agent_type_t atype); agent_type = atype; `uvm_info("set_agent_type", $sformatf("Agent type set to %s", agent_type.name()), UVM_LOW) endfunction diff --git a/src/axi/axi_pkg.sv b/src/axi/axi_pkg.sv new file mode 100644 index 0000000..4619aff --- /dev/null +++ b/src/axi/axi_pkg.sv @@ -0,0 +1,14 @@ +package axi_pkg; + import uvm_pkg::*; + import axi_types::*; + + `include "uvm_macros.svh" + + // UVM data items + `include "axi_transaction.sv" + + // UVM components + `include "axi_driver.sv" + `include "axi_monitor.sv" + `include "axi_agent.sv" +endpackage diff --git a/tb/axi_transaction.sv b/src/axi/axi_transaction.sv similarity index 100% rename from tb/axi_transaction.sv rename to src/axi/axi_transaction.sv diff --git a/tb/tb_types.sv b/src/axi/axi_types.sv similarity index 75% rename from tb/tb_types.sv rename to src/axi/axi_types.sv index 407fb25..d6237dd 100644 --- a/tb/tb_types.sv +++ b/src/axi/axi_types.sv @@ -1,10 +1,10 @@ -// Types -package tb_types; +// AXI Types +package axi_types; // Agent type typedef enum { MANAGER, SUBORDINATE - } agent_type_t; + } axi_agent_type_t; typedef enum { AXI_READ, diff --git a/src/design_pkg.sv b/src/design_pkg.sv deleted file mode 100644 index e69de29..0000000 diff --git a/tb/tb_pkg.sv b/tb/tb_pkg.sv index 6a54baf..0259b61 100644 --- a/tb/tb_pkg.sv +++ b/tb/tb_pkg.sv @@ -1,19 +1,13 @@ -`include "tb_params.sv" `include "tb_intf.sv" package tb_pkg; import uvm_pkg::*; - import tb_types::*; + import common_pkg::*; + import axi_pkg::*; + import axi_types::*; `include "uvm_macros.svh" - // Testbench defines - // UVM data items - `include "axi_transaction.sv" - // UVM components - `include "axi_driver.sv" - `include "axi_monitor.sv" - `include "axi_agent.sv" `include "tb_env.sv" // UVM sequences