Mock UVM store queue interface

This commit is contained in:
Florian Zaruba 2017-05-29 18:47:58 +02:00
parent 778d63355b
commit db0ba0d6e1
17 changed files with 751 additions and 169 deletions

View file

@ -1,6 +1,6 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 24.4.2017
// Description: Arbitrates the memory ports
// Description: Arbitrates the dcache ports
//
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
@ -66,6 +66,7 @@ module dcache_arbiter #(
logic [DATA_WIDTH-1:0] out_data;
logic pop;
// FIFO to keep track of the responses
fifo #(
.dtype ( logic [DATA_WIDTH-1:0] ),
.DEPTH ( 4 )
@ -74,6 +75,7 @@ module dcache_arbiter #(
.rst_ni ( rst_ni ),
.single_element_o ( single_element ),
// the flush is accomplished implicitly by waiting for the queue to be drained before accepting any new request
// it is the responsibility of the attached units to make sure it handles any outstanding responses
.flush_i ( 1'b0 ),
.full_o ( full ),
.empty_o ( empty ),

View file

@ -0,0 +1,57 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: Main agent object store_queue_if. Builds and instantiates the appropriate
// subcomponents like the monitor, driver etc. all based on the
// agent configuration object.
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_agent extends uvm_component;
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_if_agent)
//------------------------------------------
// Data Members
//------------------------------------------
store_queue_if_agent_config m_cfg;
//------------------------------------------
// Component Members
//------------------------------------------
uvm_analysis_port #(store_queue_if_seq_item) ap;
store_queue_if_driver m_driver;
store_queue_if_monitor m_monitor;
store_queue_if_sequencer m_sequencer;
//------------------------------------------
// Methods
//------------------------------------------
// Standard UVM Methods:
function new(string name = "store_queue_if_agent", uvm_component parent = null);
super.new(name, parent);
endfunction : new
function void build_phase(uvm_phase phase);
if (!uvm_config_db #(store_queue_if_agent_config)::get(this, "", "store_queue_if_agent_config", m_cfg) )
`uvm_fatal("CONFIG_LOAD", "Cannot get() configuration store_queue_if_agent_config from uvm_config_db. Have you set() it?")
m_driver = store_queue_if_driver::type_id::create("m_driver", this);
m_sequencer = store_queue_if_sequencer::type_id::create("m_sequencer", this);
m_monitor = store_queue_if_monitor::type_id::create("m_monitor", this);
endfunction : build_phase
function void connect_phase(uvm_phase phase);
m_driver.seq_item_port.connect(m_sequencer.seq_item_export);
// m_monitor.ap.connect(m_cov_monitor.analysis_port)
m_driver.m_cfg = m_cfg;
m_monitor.m_cfg = m_cfg;
endfunction: connect_phase
endclass : store_queue_if_agent

View file

@ -0,0 +1,37 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: Agent configuration object store_queue_if
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_agent_config extends uvm_object;
// UVM Factory Registration Macro
`uvm_object_utils(store_queue_if_agent_config)
// Virtual Interface
virtual store_queue_if m_vif;
//------------------------------------------
// Data Members
//------------------------------------------
// Is the agent active or passive
uvm_active_passive_enum active = UVM_ACTIVE;
// Standard UVM Methods:
function new(string name = "store_queue_if_agent_config");
super.new(name);
endfunction : new
endclass : store_queue_if_agent_config

View file

@ -0,0 +1,37 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue_if_agent package - compile unit
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
package store_queue_if_agent_pkg;
// UVM Import
import uvm_pkg::*;
`include "uvm_macros.svh"
// Sequence item to model transactions
`include "store_queue_if_seq_item.svh"
// Agent configuration object
`include "store_queue_if_agent_config.svh"
// Driver
`include "store_queue_if_driver.svh"
// Coverage monitor
// `include "store_queue_if_coverage_monitor.svh"
// Monitor that includes analysis port
`include "store_queue_if_monitor.svh"
// Sequencer
`include "store_queue_if_sequencer.svh"
// Main agent
`include "store_queue_if_agent.svh"
// Sequence
`include "store_queue_if_sequence.svh"
endpackage: store_queue_if_agent_pkg

View file

@ -0,0 +1,47 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: Driver for interface store_queue_if
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_driver extends uvm_driver #(store_queue_if_seq_item);
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_if_driver)
// Virtual Interface
virtual store_queue_if m_vif;
//---------------------
// Data Members
//---------------------
store_queue_if_agent_config m_cfg;
// Standard UVM Methods:
function new(string name = "store_queue_if_driver", uvm_component parent = null);
super.new(name, parent);
endfunction
task run_phase(uvm_phase phase);
store_queue_if_seq_item cmd;
seq_item_port.get_next_item(cmd);
seq_item_port.item_done();
endtask : run_phase
function void build_phase(uvm_phase phase);
if (!uvm_config_db #(store_queue_if_agent_config)::get(this, "", "store_queue_if_agent_config", m_cfg) )
`uvm_fatal("CONFIG_LOAD", "Cannot get() configuration store_queue_if_agent_config from uvm_config_db. Have you set() it?")
m_vif = m_cfg.m_vif;
endfunction: build_phase
endclass : store_queue_if_driver

View file

@ -0,0 +1,62 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue_if Monitor, monitors the DUT's pins and writes out
// appropriate sequence items as defined for this particular dut
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_monitor extends uvm_component;
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_if_monitor)
// analysis port
uvm_analysis_port #(store_queue_if_seq_item) m_ap;
// Virtual Interface
virtual store_queue_if m_vif;
//---------------------
// Data Members
//---------------------
store_queue_if_agent_config m_cfg;
// Standard UVM Methods:
function new(string name = "store_queue_if_driver", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
if (!uvm_config_db #(store_queue_if_agent_config)::get(this, "", "store_queue_if_agent_config", m_cfg) )
`uvm_fatal("CONFIG_LOAD", "Cannot get() configuration store_queue_if_agent_config from uvm_config_db. Have you set() it?")
m_ap = new("m_ap", this);
endfunction: build_phase
function void connect_phase(uvm_phase phase);
// connect virtual interface
m_vif = m_cfg.m_vif;
endfunction
task run_phase(uvm_phase phase);
store_queue_if_seq_item cmd = store_queue_if_seq_item::type_id::create("cmd");
store_queue_if_seq_item cloned_item;
$cast(cloned_item, cmd.clone());
m_ap.write(cloned_item);
endtask : run_phase
endclass : store_queue_if_monitor

View file

@ -0,0 +1,89 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue_if Sequence item
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_seq_item extends uvm_sequence_item;
// UVM Factory Registration Macro
`uvm_object_utils(store_queue_if_seq_item)
//------------------------------------------
// Data Members (Outputs rand, inputs non-rand)
//------------------------------------------
// TODO: set data members
//------------------------------------------
// Methods
//------------------------------------------
// Standard UVM Methods:
function new(string name = "store_queue_if_seq_item");
super.new(name);
endfunction
function void do_copy(uvm_object rhs);
store_queue_if_seq_item rhs_;
if(!$cast(rhs_, rhs)) begin
`uvm_fatal("do_copy", "cast of rhs object failed")
end
super.do_copy(rhs);
// Copy over data members:
// e.g.:
// operator = rhs_.operator;
endfunction:do_copy
function bit do_compare(uvm_object rhs, uvm_comparer comparer);
store_queue_if_seq_item rhs_;
if(!$cast(rhs_, rhs)) begin
`uvm_error("do_copy", "cast of rhs object failed")
return 0;
end
// TODO
return super.do_compare(rhs, comparer); // && operator == rhs_.operator
endfunction:do_compare
function string convert2string();
string s;
$sformat(s, "%s\n", super.convert2string());
// Convert to string function reusing s:
// TODO
// $sformat(s, "%s\n operator\n", s, operator);
return s;
endfunction:convert2string
function void do_print(uvm_printer printer);
if(printer.knobs.sprint == 0) begin
$display(convert2string());
end
else begin
printer.m_string = convert2string();
end
endfunction:do_print
function void do_record(uvm_recorder recorder);
super.do_record(recorder);
// Use the record macros to record the item fields:
// TODO
// `uvm_record_field("operator", operator)
endfunction:do_record
endclass : store_queue_if_seq_item

View file

@ -0,0 +1,53 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue_if sequence consisting of store_queue_if_sequence_items
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_sequence extends uvm_sequence #(store_queue_if_seq_item);
// UVM Factory Registration Macro
`uvm_object_utils(store_queue_if_sequence)
//-----------------------------------------------
// Data Members (Outputs rand, inputs non-rand)
//-----------------------------------------------
//------------------------------------------
// Constraints
//------------------------------------------
//------------------------------------------
// Methods
//------------------------------------------
// Standard UVM Methods:
function new(string name = "store_queue_if_sequence");
super.new(name);
endfunction
task body;
store_queue_if_seq_item req;
begin
req = store_queue_if_seq_item::type_id::create("req");
start_item(req);
assert(req.randomize());
finish_item(req);
end
endtask:body
endclass : store_queue_if_sequence

View file

@ -0,0 +1,29 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue_if Sequencer for store_queue_if_sequence_item
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_if_sequencer extends uvm_sequencer #(store_queue_if_seq_item);
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_if_sequencer)
// Standard UVM Methods:
function new(string name="store_queue_if_sequencer", uvm_component parent = null);
super.new(name, parent);
endfunction
endclass: store_queue_if_sequencer

56
tb/env/store_queue/store_queue_env.svh vendored Normal file
View file

@ -0,0 +1,56 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: Environment which instantiates the agent and all environment
// related components such as a scoreboard etc.
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_env extends uvm_env;
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_env)
//------------------------------------------
// Data Members
//------------------------------------------
store_queue_if_agent m_store_queue_if_agent;
store_queue_if_sequencer m_store_queue_if_sequencer;
store_queue_env_config m_cfg;
//------------------------------------------
// Methods
//------------------------------------------
// Standard UVM Methods:
function new(string name = "store_queue_env", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
if (!uvm_config_db #(store_queue_env_config)::get(this, "", "store_queue_env_config", m_cfg))
`uvm_fatal("CONFIG_LOAD", "Cannot get() configuration store_queue_env_config from uvm_config_db. Have you set() it?")
// Conditional instantiation goes here
// Create agent configuration
uvm_config_db #(store_queue_if_agent_config)::set(this, "m_store_queue_if_agent*",
"store_queue_if_agent_config",
m_cfg.m_store_queue_if_agent_config);
m_store_queue_if_agent = store_queue_if_agent::type_id::create("m_store_queue_if_agent", this);
// Get sequencer
m_store_queue_if_sequencer = store_queue_if_sequencer::type_id::create("m_store_queue_if_sequencer", this);
endfunction:build_phase
function void connect_phase(uvm_phase phase);
m_store_queue_if_sequencer = m_store_queue_if_agent.m_sequencer;
endfunction: connect_phase
endclass : store_queue_env

View file

@ -0,0 +1,29 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue configuration object
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_env_config extends uvm_object;
// UVM Factory Registration Macro
`uvm_object_utils(store_queue_env_config)
// a functional unit master interface
virtual store_queue_if m_store_queue_if;
// an agent config
store_queue_if_agent_config m_store_queue_if_agent_config;
endclass : store_queue_env_config

View file

@ -0,0 +1,26 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue package
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
package store_queue_env_pkg;
// Standard UVM import & include:
import uvm_pkg::*;
`include "uvm_macros.svh"
// Testbench related imports
import store_queue_if_agent_pkg::*;
// Includes for the config for the environment
`include "store_queue_env_config.svh"
// Includes the environment
`include "store_queue_env.svh"
endpackage

View file

@ -23,32 +23,35 @@ module store_queue_tb;
logic store_valid;
logic slave_data_gnt;
mem_if slave(clk);
dcache_if slave(clk);
store_queue_if store_queue(clk);
store_queue dut (
.clk_i ( clk ),
.rst_ni ( rst_ni ),
.flush_i ( store_queue.flush ),
.paddr_o ( store_queue.check_paddr ),
.data_o ( store_queue.check_data ),
.valid_o ( store_queue.valid ),
.be_o ( store_queue.check_be ),
.commit_i ( store_queue.commit ),
.ready_o ( store_queue.ready ),
.valid_i ( store_queue.store_valid ),
.paddr_i ( store_queue.store_paddr ),
.data_i ( store_queue.store_data ),
.be_i ( store_queue.store_be ),
.clk_i ( clk ),
.rst_ni ( rst_ni ),
.flush_i ( store_queue.flush ),
.paddr_o ( store_queue.check_paddr ),
.data_o ( store_queue.check_data ),
.valid_o ( store_queue.valid ),
.be_o ( store_queue.check_be ),
.commit_i ( store_queue.commit ),
.ready_o ( store_queue.ready ),
.valid_i ( store_queue.store_valid ),
.paddr_i ( store_queue.store_paddr ),
.data_i ( store_queue.store_data ),
.be_i ( store_queue.store_be ),
.address_o ( slave.address ),
.data_wdata_o ( slave.data_wdata ),
.data_req_o ( slave.data_req ),
.data_we_o ( slave.data_we ),
.data_be_o ( slave.data_be ),
.data_gnt_i ( slave.data_gnt ),
.data_rvalid_i ( slave.data_rvalid )
.address_index_o ( slave.address_index ),
.address_tag_o ( slave.address_tag ),
.data_wdata_o ( slave.data_wdata ),
.data_req_o ( slave.data_req ),
.data_we_o ( slave.data_we ),
.data_be_o ( slave.data_be ),
.kill_req_o ( slave.kill_req ),
.tag_valid_o ( slave.tag_valid ),
.data_gnt_i ( slave.data_gnt ),
.data_rvalid_i ( slave.data_rvalid )
);
initial begin
@ -62,9 +65,9 @@ module store_queue_tb;
#10ns clk = ~clk;
end
// combinatorial signals
assign store_queue.store_valid = store_valid & store_queue.ready;
assign slave.data_gnt = slave_data_gnt;
// // combinatorial signals
// assign store_queue.store_valid = store_valid & store_queue.ready;
// assign slave.data_gnt = slave_data_gnt;
// simulator stopper, this is suboptimal better go for coverage
initial begin
@ -72,151 +75,8 @@ module store_queue_tb;
$stop;
end
program testbench (mem_if slave, store_queue_if store_queue);
// data to store
class store_data;
rand logic [63:0] address;
rand logic [63:0] data;
rand logic [7:0] be;
program testbench (dcache_if slave, store_queue_if store_queue);
function new (logic [63:0] address, logic [63:0] data, logic [7:0] be);
this.address = address;
this.data = data;
this.be = be;
endfunction : new
function string convert2string();
string s;
$sformat(s, "Address: %0h, Data: %0h, BE: %0h", address, data, be);
return s;
endfunction : convert2string
function bit do_compare(store_data rhs);
if (rhs.address == address && rhs.data == data && rhs.be == be)
return 1;
else return 0;
endfunction : do_compare
endclass : store_data
store_data data = new(64'b0, 64'b0, 8'b0);
semaphore sem = new(1);
logic flush;
// ----------
// Driver
// ----------
// make a new store if it is possible
initial begin
// reset assignment
store_valid <= 'b0;
store_queue.mck.store_paddr <= 'b0;
store_queue.mck.store_data <= 'b0;
store_queue.mck.store_be <= 'b0;
store_queue.mck.commit <= 1'b0;
wait(rst_ni);
forever begin
@(store_queue.mck);
if (store_queue.mck.ready) begin
// get some randomized data
void'(data.randomize());
store_queue.mck.store_paddr <= data.address;
store_queue.mck.store_data <= data.data;
store_queue.mck.store_be <= data.be;
store_valid <= 1'b1;
// commit a couple of cycles later
fork
commit_block: begin
sem.get(1);
@(store_queue.mck)
wait(~flush);
store_queue.mck.commit <= 1'b1;
@(store_queue.mck)
store_queue.mck.commit <= 1'b0;
sem.put(1);
end
join_none
end else begin
store_valid <= 1'b0;
end
end
end
// grant process
initial begin
forever begin
slave_data_gnt = 1'b0;
wait (slave.data_req);
// randomize grant delay
// repeat ($urandom_range(0,4)) @(slave.mck);
slave_data_gnt = 1'b1;
wait (~slave.data_req);
end
end
// write memory interface
initial begin
forever begin
@(slave.mck);
if (slave.mck.data_req)
slave.mck.data_rvalid <= 1'b1;
else
slave.mck.data_rvalid <= 1'b0;
end
end
// random flush signal
initial begin
flush = 1'b0;
store_queue.mck.flush <= 0;
forever begin
repeat (20) @(store_queue.mck);
// TODO: Implement Flush test, needs some more test logic
store_queue.mck.flush <= 0;
flush = 1'b1;
repeat (4) @(store_queue.mck);
store_queue.mck.flush <= 0;
flush = 1'b0;
end
end
// -------------------
// Monitor && Checker
// -------------------
store_data request_data_queue [$];
store_data tmp;
store_data result;
// check that all requested stores got through
// therefore put them in a queue when requested from the LSU and check them on the
// memory interface output
initial begin
forever begin
@(store_queue.pck iff store_queue.pck.store_valid)
tmp = new(store_queue.pck.store_paddr, store_queue.pck.store_data, store_queue.pck.store_be);
request_data_queue.push_back(tmp);
// $display("[LSU] Got: %s", tmp.convert2string());
end
end
// check here what we actually got on the memory interface
initial begin
automatic store_data queue_data;
forever begin
@(slave.pck iff slave.pck.data_req & slave.pck.data_gnt)
result = new(slave.pck.address, slave.pck.data_wdata, slave.pck.data_be);
// $display("[MEM] Got: %s", result.convert2string());
// pop from queue and check if this was indeed requested
queue_data = request_data_queue.pop_front();
assert(queue_data.do_compare(result)) else $error("Mismatch: Expected %s, Got: %s", queue_data.convert2string() , result.convert2string());
end
end
endprogram

View file

@ -0,0 +1,41 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: Main test package contains all necessary packages
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
package store_queue_lib_pkg;
// Standard UVM import & include:
import uvm_pkg::*;
`include "uvm_macros.svh"
// Import the memory interface agent
import store_queue_if_agent_pkg::*;
// ------------------------------------------------
// Environment which will be instantiated
// ------------------------------------------------
import store_queue_env_pkg::*;
// ----------------
// Sequence Package
// ----------------
import store_queue_sequence_pkg::*;
// Test based includes like base test class and specializations of it
// ----------------
// Base test class
// ----------------
`include "store_queue_test_base.svh"
// -------------------
// Child test classes
// -------------------
`include "store_queue_test.svh"
endpackage

View file

@ -0,0 +1,25 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue sequence package
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
package store_queue_sequence_pkg;
import store_queue_if_agent_pkg::*;
import uvm_pkg::*;
`include "uvm_macros.svh"
// Include your sequences here e.g.:
// `include "fibonacci_sequence.svh"
endpackage

View file

@ -0,0 +1,50 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue main test class
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_test extends store_queue_test_base;
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_test)
// TODO: declare sequence here
// store_queue_sequence store_queue;
//------------------------------------------
// Methods
//------------------------------------------
// Standard UVM Methods:
function new(string name = "store_queue_test", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
task run_phase(uvm_phase phase);
phase.raise_objection(this, "store_queue_test");
//fibonacci_sequence fibonacci;
super.run_phase(phase);
// store_queue = new("store_queue");
// TODO: Start sequence here
// store_queue.start(sequencer_h);
// Testlogic goes here
#100ns;
phase.drop_objection(this, "store_queue_test");
endtask
endclass : store_queue_test

View file

@ -0,0 +1,82 @@
// Author: Florian Zaruba, ETH Zurich
// Date: 29.05.2017
// Description: store_queue base test class
//
// Copyright (C) 2017 ETH Zurich, University of Bologna
// All rights reserved.
// This code is under development and not yet released to the public.
// Until it is released, the code is under the copyright of ETH Zurich and
// the University of Bologna, and may contain confidential and/or unpublished
// work. Any reuse/redistribution is strictly forbidden without written
// permission from ETH Zurich.
// Bug fixes and contributions will eventually be released under the
// SolderPad open hardware license in the context of the PULP platform
// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
// University of Bologna.
class store_queue_test_base extends uvm_test;
// UVM Factory Registration Macro
`uvm_component_utils(store_queue_test_base)
//------------------------------------------
// Data Members
//------------------------------------------
//------------------------------------------
// Component Members
//------------------------------------------
// environment configuration
store_queue_env_config m_env_cfg;
// environment
store_queue_env m_env;
store_queue_if_sequencer sequencer_h;
// reset_sequence reset;
// ---------------------
// Agent configuration
// ---------------------
// functional unit interface
store_queue_if_agent_config m_store_queue_if_cfg;
//------------------------------------------
// Methods
//------------------------------------------
// standard UVM methods:
function new(string name = "store_queue_test_base", uvm_component parent = null);
super.new(name, parent);
endfunction
// build the environment, get all configurations
// use the factory pattern in order to facilitate UVM functionality
function void build_phase(uvm_phase phase);
// create environment
m_env_cfg = store_queue_env_config::type_id::create("m_env_cfg");
// create agent configurations and assign interfaces
// create agent store_queue_if configuration
m_store_queue_if_cfg = store_queue_if_agent_config::type_id::create("m_store_queue_if_cfg");
m_env_cfg.m_store_queue_if_agent_config = m_store_queue_if_cfg;
// get store_queue_if virtual interfaces
// get master interface DB
if (!uvm_config_db #(virtual store_queue_if)::get(this, "", "store_queue_if", m_store_queue_if_cfg.m_vif))
`uvm_fatal("VIF CONFIG", "Cannot get() interface store_queue_if from uvm_config_db. Have you set() it?")
m_env_cfg.m_store_queue_if = m_store_queue_if_cfg.m_vif;
// create environment
uvm_config_db #(store_queue_env_config)::set(this, "*", "store_queue_env_config", m_env_cfg);
m_env = store_queue_env::type_id::create("m_env", this);
endfunction
function void end_of_elaboration_phase(uvm_phase phase);
sequencer_h = m_env.m_store_queue_if_sequencer;
endfunction
task run_phase(uvm_phase phase);
// reset = new("reset");
// reset.start(sequencer_h);
endtask
endclass : store_queue_test_base