From fde54f11bd9df7fda11f497d4928cf4c81991812 Mon Sep 17 00:00:00 2001 From: brahmanapalli_aswini Date: Wed, 22 May 2024 12:15:29 +0000 Subject: [PATCH] Upload files to '' --- axi_env.sv | 40 ++++++++++++++ axi_m_monitor.sv | 108 +++++++++++++++++++++++++++++++++++++ axi_master_agent.sv | 50 +++++++++++++++++ axi_s_monitor.sv | 109 +++++++++++++++++++++++++++++++++++++ wrap_intf.sv | 128 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 435 insertions(+) create mode 100644 axi_env.sv create mode 100644 axi_m_monitor.sv create mode 100644 axi_master_agent.sv create mode 100644 axi_s_monitor.sv create mode 100644 wrap_intf.sv diff --git a/axi_env.sv b/axi_env.sv new file mode 100644 index 0000000..d0d536a --- /dev/null +++ b/axi_env.sv @@ -0,0 +1,40 @@ +class axi_env extends uvm_env; + `uvm_component_utils(axi_env) + + // Components + axi_master master; + axi_slave slave; + axi_scoreboard scb; + + env_config env_cfg; + + // + function new(string name, uvm_component parent); + super.new(name, parent); + endfunction //new() + + // Function: build_phase + extern function void build_phase(uvm_phase phase); + + // Function: connect_phase + extern function void connect_phase(uvm_phase phase); + +endclass //axi_env extends uvm_env + +function void axi_env::build_phase(uvm_phase phase); + /* note: Do not call super.build_phase() from any class that is extended from an UVM base class! */ + /* For more information see UVM Cookbook v1800.2 p.503 */ + //super.build_phase(phase); + + master = axi_master::type_id::create("master", this); + slave = axi_slave::type_id::create("slave", this); + scb = axi_scoreboard::type_id::create("scb", this); +endfunction: build_phase + +function void axi_env::connect_phase(uvm_phase phase); + super.connect_phase(phase); + + master.ap.connect(scb.m_ap_imp); + slave.ap.connect(scb.s_ap_imp); +endfunction: connect_phase + diff --git a/axi_m_monitor.sv b/axi_m_monitor.sv new file mode 100644 index 0000000..33ff218 --- /dev/null +++ b/axi_m_monitor.sv @@ -0,0 +1,108 @@ +class axi_m_monitor extends uvm_monitor; + `uvm_component_utils(axi_m_monitor) + + // Components + uvm_analysis_port#(axi_transaction#(D_WIDTH, A_WIDTH)) ap; + virtual axi_intf#(.D_WIDTH(D_WIDTH), .A_WIDTH(A_WIDTH)).SMON vif; + // variables + axi_transaction#(D_WIDTH, A_WIDTH) w_trans, r_trans; + bit w_done, r_done; + int b_size; + + // Methods + extern task run_mon(uvm_phase phase); + extern task write_monitor(); + extern task read_monitor(); + + function new(string name, uvm_component parent); + super.new(name, parent); + w_done = 1; + r_done = 1; + endfunction //new() + + // Function: build_phase + extern function void build_phase(uvm_phase phase); + + // Function: run_phase + extern task run_phase(uvm_phase phase); + +endclass //axi_m_monitor extends uvm_monitor + +function void axi_m_monitor::build_phase(uvm_phase phase); + ap = new("ap", this); +endfunction: build_phase + +task axi_m_monitor::run_phase(uvm_phase phase); + forever begin + run_mon(phase); + @(vif.mon_cb); + end +endtask: run_phase + +task axi_m_monitor::run_mon(uvm_phase phase); + fork + if(w_done) begin + phase.raise_objection(this); + w_done = 0; + write_monitor(); + w_done = 1; + phase.drop_objection(this); + end + if(r_done) begin + phase.raise_objection(this); + r_done = 0; + read_monitor(); + r_done = 1; + phase.drop_objection(this); + end + + join_none +endtask: run_mon + +task axi_m_monitor::write_monitor(); + if(vif.mon_cb.AWVALID && vif.mon_cb.AWREADY) begin + w_trans = axi_transaction#(D_WIDTH, A_WIDTH)::type_id::create("w_trans"); + w_trans.addr = vif.mon_cb.AWADDR; + w_trans.id = vif.mon_cb.AWID; + w_trans.b_size = vif.mon_cb.AWSIZE; + w_trans.b_len = vif.mon_cb.AWLEN; + w_trans.b_type = B_TYPE'(vif.mon_cb.AWBURST); + w_trans.data = new [w_trans.b_len+1]; + for (int i=0; i