Added scoreboard implementation, add check in place

This commit is contained in:
Florian Zaruba 2017-04-09 11:58:50 +02:00
parent 63841ebe07
commit 39b5c93180
7 changed files with 44 additions and 10 deletions

View file

@ -40,4 +40,4 @@ class fu_if_agent extends uvm_component;
m_monitor.m_cfg = m_cfg;
endfunction: connect_phase
endclass : fu_if_agent
endclass : fu_if_agent

View file

@ -43,19 +43,18 @@ class fu_if_monitor extends uvm_component;
forever begin : cmd_loop
longint result;
// using clocking blocks this is possible
@(negedge fu.pck)
cmd.operator = fu.pck.operator;
cmd.operand_a = fu.pck.operand_a;
cmd.operand_b = fu.pck.operand_b;
cmd.operand_c = fu.pck.operand_c;
cmd.result = fu.pck.result;
@(fu.pck)
$cast(cloned_item, cmd.clone());
ap.write(cloned_item);
end : cmd_loop
endtask : run_phase
endclass : fu_if_monitor

View file

@ -69,7 +69,7 @@ class fu_if_seq_item extends uvm_sequence_item;
$sformat(s, "%s\n", super.convert2string());
// Convert to string function reusing s:
$sformat(s, "%s\n operator\t%0h\n operandA\t%0h\n operandB\t%0b\n operandC\t%0h\n", s, operator, operand_a, operand_b, operand_c);
$sformat(s, "%s\n operator\t%0h\n operandA\t%0h\n operandB\t%0h\n operandC\t%0h\n result\t%0h\n", s, operator, operand_a, operand_b, operand_c, result);
return s;
endfunction:convert2string

9
tb/env/alu_env.svh vendored
View file

@ -13,7 +13,7 @@ class alu_env extends uvm_env;
fu_if_agent m_fu_if_agent;
fu_if_sequencer m_fu_if_sequencer;
alu_env_config m_cfg;
alu_scoreboard m_scoreboard;
//------------------------------------------
// Methods
//------------------------------------------
@ -37,10 +37,13 @@ class alu_env extends uvm_env;
// Get sequencer
m_fu_if_sequencer = fu_if_sequencer::type_id::create("m_fu_if_sequencer", this);
// create scoreboard
m_scoreboard = alu_scoreboard::type_id::create("m_scoreboard", this);
endfunction:build_phase
function void connect_phase(uvm_phase phase);
m_fu_if_sequencer = m_fu_if_agent.m_sequencer;
m_fu_if_agent.m_monitor.ap.connect(m_scoreboard.item_export);
endfunction: connect_phase
endclass : alu_env
endclass : alu_env

View file

@ -8,8 +8,10 @@ package alu_env_pkg;
`include "uvm_macros.svh"
// Testbench related imports
import fu_if_agent_pkg::*;
import ariane_pkg::*;
// Includes for the config for the environment
`include "alu_env_config.svh"
`include "alu_scoreboard.svh"
// Includes the environment
`include "alu_env.svh"
endpackage

31
tb/env/alu_scoreboard.svh vendored Normal file
View file

@ -0,0 +1,31 @@
class alu_scoreboard extends uvm_scoreboard;
`uvm_component_utils(alu_scoreboard);
uvm_analysis_imp#(fu_if_seq_item, alu_scoreboard) item_export;
bit [63:0] result;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction : new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
item_export = new("item_export", this);
endfunction : build_phase
virtual function void write (fu_if_seq_item seq_item);
seq_item.print();
result = 64'b0;
case (alu_op'(seq_item.operator))
add:
result = seq_item.operand_a + seq_item.operand_b;
endcase
if (result != seq_item.result)
`uvm_error("ALU Scoreboard", $sformatf("Result: %0h, Expected %0h", seq_item.result, result))
endfunction : write;
endclass : alu_scoreboard

View file

@ -9,7 +9,6 @@ package alu_lib_pkg;
import fu_if_agent_pkg::*;
import alu_env_pkg::*;
import alu_sequence_pkg::*;
// Test based includes like base test class and specializations of it
// ----------------
// Base test class