Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions hw/dv/vip/axi4_vip/axi4_vip.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CAPI=2:
# Copyright lowRISC contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name : lowrisc:dv:axi4_vip:0.1

filesets:
files_dv:
files:
- axi4_vip_if.sv
- axi4_vip_pkg.sv
- axi4_vip_defines.svh: {is_include_file: true}
- axi4_vip_types.svh: {is_include_file: true}
- axi4_vip_cfg.svh: {is_include_file: true}
- axi4_vip_item.svh: {is_include_file: true}
- axi4_vip_driver.svh: {is_include_file: true}
- axi4_vip_sequencer.svh: {is_include_file: true}
- axi4_vip_monitor.svh: {is_include_file: true}
- axi4_vip_master_agent.svh: {is_include_file: true}
- axi4_vip_slave_agent.svh: {is_include_file: true}
- axi4_vip_env.svh: {is_include_file: true}
file_type: systemVerilogSource

targets:
default:
filesets:
- files_dv
102 changes: 102 additions & 0 deletions hw/dv/vip/axi4_vip/axi4_vip_cfg.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright lowRISC contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef AXI4_VIP_CFG_SVH
`define AXI4_VIP_CFG_SVH

class axi4_vip_cfg extends uvm_object;

// Currently this is a passive VIP (monitor only)
string m_inst_id = "AXI4";
bit m_has_master = 0;
uvm_active_passive_enum m_master_active_passive = UVM_PASSIVE;
bit m_has_slave = 0;
uvm_active_passive_enum m_slave_active_passive = UVM_PASSIVE;

// Future placeholders
bit m_has_coverage = 1;
bit m_has_checker = 1;

// actual bus widths (<= max defines)
int unsigned m_id_width = 16;
int unsigned m_addr_width = 64;
int unsigned m_data_width = 512;
int unsigned m_user_width = 32;
int unsigned m_region_width = 8;
int unsigned m_qos_width = 8;

`uvm_object_utils_begin(axi4_vip_cfg)
`uvm_field_string( m_inst_id, UVM_DEFAULT | UVM_STRING)
`uvm_field_int ( m_has_master, UVM_DEFAULT)
`uvm_field_int ( m_has_slave, UVM_DEFAULT)
`uvm_field_int ( m_has_coverage, UVM_DEFAULT)
`uvm_field_int ( m_has_checker, UVM_DEFAULT)
`uvm_field_enum (uvm_active_passive_enum, m_master_active_passive, UVM_DEFAULT)
`uvm_field_enum (uvm_active_passive_enum, m_slave_active_passive, UVM_DEFAULT)
`uvm_field_int ( m_id_width, UVM_DEFAULT)
`uvm_field_int ( m_addr_width, UVM_DEFAULT)
`uvm_field_int ( m_data_width, UVM_DEFAULT)
`uvm_field_int ( m_user_width, UVM_DEFAULT)
`uvm_field_int ( m_region_width, UVM_DEFAULT)
`uvm_field_int ( m_qos_width, UVM_DEFAULT)
`uvm_object_utils_end

// External Method Declarations
extern function new(string name="axi4_vip_cfg");

extern virtual function void set_config(string inst_id = "",
bit has_master = 0,
uvm_active_passive_enum master_active_passive = UVM_PASSIVE,
bit has_slave = 0,
uvm_active_passive_enum slave_active_passive = UVM_PASSIVE,
bit has_coverage = 0,
bit has_checker = 0,
int unsigned id_width = 16,
int unsigned addr_width = 64,
int unsigned data_width = 512,
int unsigned user_width = 32,
int unsigned region_width = 8,
int unsigned qos_width = 8
);

endclass : axi4_vip_cfg

//------------------------------------------------------------------------------
// External Method Implementations
//------------------------------------------------------------------------------

function axi4_vip_cfg::new(string name="axi4_vip_cfg");
super.new(name);
endfunction : new

function void axi4_vip_cfg::set_config(string inst_id = "",
bit has_master = 0,
uvm_active_passive_enum master_active_passive = UVM_PASSIVE,
bit has_slave = 0,
uvm_active_passive_enum slave_active_passive = UVM_PASSIVE,
bit has_coverage = 0,
bit has_checker = 0,
int unsigned id_width = 16,
int unsigned addr_width = 64,
int unsigned data_width = 512,
int unsigned user_width = 32,
int unsigned region_width = 8,
int unsigned qos_width = 8
);
m_inst_id = inst_id;
m_has_master = has_master;
m_master_active_passive = master_active_passive;
m_has_slave = has_slave;
m_slave_active_passive = slave_active_passive;
m_has_coverage = has_coverage;
m_has_checker = has_checker;
m_id_width = id_width;
m_addr_width = addr_width;
m_data_width = data_width;
m_user_width = user_width;
m_region_width = region_width;
m_qos_width = qos_width;
endfunction : set_config

`endif // AXI4_VIP_CFG_SVH
16 changes: 16 additions & 0 deletions hw/dv/vip/axi4_vip/axi4_vip_defines.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright lowRISC contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef AXI4_VIP_DEFINES_SVH
`define AXI4_VIP_DEFINES_SVH

// maximum supported bus widths
`define AXI4_MAX_ID_WIDTH 16
`define AXI4_MAX_ADDR_WIDTH 64
`define AXI4_MAX_DATA_WIDTH 512
`define AXI4_MAX_USER_WIDTH 32
`define AXI4_MAX_REGION_WIDTH 8
`define AXI4_MAX_QOS_WIDTH 8

`endif // AXI4_VIP_DEFINES_SVH
49 changes: 49 additions & 0 deletions hw/dv/vip/axi4_vip/axi4_vip_driver.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright lowRISC contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef AXI4_VIP_DRIVER_SVH
`define AXI4_VIP_DRIVER_SVH

class axi4_vip_driver extends uvm_driver #(axi4_vip_item);

`uvm_component_utils(axi4_vip_driver)

axi4_vip_cfg m_cfg;
virtual axi4_vip_if vif;

// External Method Declarations
extern function new(string name, uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);

endclass : axi4_vip_driver

//------------------------------------------------------------------------------
// External Method Implementations
//------------------------------------------------------------------------------

function axi4_vip_driver::new(string name, uvm_component parent);
super.new(name, parent);
endfunction : new

function void axi4_vip_driver::build_phase(uvm_phase phase);
super.build_phase(phase);
if (! uvm_config_db #(axi4_vip_cfg)::get(this, "", "m_cfg", m_cfg)) begin
`uvm_fatal("NOCFG", {"Configuration item must be set for: ", get_full_name(), "m_cfg"})
end

if (! uvm_config_db #(virtual interface axi4_vip_if)::get(this, get_full_name(),"vif", vif)) begin
`uvm_fatal("NOVIF",{"virtual interface must be set for: ",get_full_name(),".vif"})
end
endfunction : build_phase

task axi4_vip_driver::run_phase(uvm_phase phase);
forever begin
// TODO: Placeholder
seq_item_port.get_next_item(req);
seq_item_port.item_done();
end
endtask : run_phase

`endif // AXI4_VIP_DRIVER_SVH
47 changes: 47 additions & 0 deletions hw/dv/vip/axi4_vip/axi4_vip_env.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright lowRISC contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef AXI4_VIP_ENV_SVH
`define AXI4_VIP_ENV_SVH

class axi4_vip_env extends uvm_env;

`uvm_component_utils(axi4_vip_env)

axi4_vip_cfg m_cfg;

axi4_vip_master_agent m_master;
axi4_vip_slave_agent m_slave;

// External Method Declarations
extern function new(string name, uvm_component parent);
extern function void build_phase(uvm_phase phase);

endclass : axi4_vip_env

//------------------------------------------------------------------------------
// External Method Implementations
//------------------------------------------------------------------------------

function axi4_vip_env::new(string name, uvm_component parent);
super.new(name, parent);
endfunction : new

function void axi4_vip_env::build_phase(uvm_phase phase);
super.build_phase(phase);

if (! uvm_config_db #(axi4_vip_cfg)::get(this, "", "m_cfg", m_cfg)) begin
`uvm_fatal("NOCFG", {"Configuration item must be set for: ", get_full_name(), "m_cfg"})
end

if (m_cfg.m_has_master == 1) begin
m_master = axi4_vip_master_agent::type_id::create("m_master", this);
end

if (m_cfg.m_has_slave == 1) begin
m_slave = axi4_vip_slave_agent::type_id::create("m_slave", this);
end
endfunction : build_phase

`endif // AXI4_VIP_ENV_SVH
Loading
Loading