final report verification
final report verification
interface DMem_if;
logic clk;
logic RW = 0;
logic [31:0] DataW = 0;
logic [31:0] DataR;
logic [31:0] addr = 0;
endinterface
…………………………………………….
The second step is to define the package and the package container by using:
package pack1;
`inclcreaude "uvm_macros.svh"
………………………………………………………………………………………………
Then, we create the sequence item class that represents a single transaction with
the constraints of randomization.
class my_sequence_item extends uvm_sequence_item;
`uvm_object_utils(my_sequence_item);
super.new(name);
endfunction
endclass
……………………………………………………………………
The next step is to generate a sequence of transactions using body() and pre_body()
class my_sequence extends uvm_sequence;
my_sequence_item sequence_item;
`uvm_object_utils(my_sequence);
task pre_body();
sequence_item = my_sequence_item::type_id::create("sequence_item");
endtask
task body();
start_item(sequence_item);
if (!sequence_item.randomize())
finish_item(sequence_item);
end
Endtask
The next step is to create the driver class which is used to drive the interface
signals based on the sequence items received from the sequencer.
Using build phase() Retrieves the virtual interface (vif) from the configuration database.
And run_phase() gets sequence items and drives the interface signals.
my_sequence_item sequence_item;
`uvm_component_utils(my_driver);
// ...
endfunction
forever begin
@(posedge vif.clk);
seq_item_port.get_next_item(sequence_item);
seq_item_port.item_done();
end
endtask
Endclass
………………………………………………………………………………………………………..
The next step is to create the monitor class that is used to monitor the interface and
collect transactions.
class my_monitor extends uvm_monitor;
my_sequence_item sequence_item;
`uvm_component_utils(my_monitor);
uvm_analysis_port#(my_sequence_item) analysis_port;
endfunction
forever begin
@(posedge vif.clk); // IMPORTANT: Sample AFTER the write (or after a delay)
analysis_port.write(sequence_item);
end
endtask
endclass
The next step is to create the agent class that contains the driver, monitor and the
sequencer and connects the monitor’s analysis port.
class my_agent extends uvm_agent;
my_driver driver;
my_monitor monitor;
my_sequencer sequencer;
`uvm_component_utils(my_agent);
// ...
// ... Gets interface and sets it in the config DB for driver and monitor
endfunction
monitor.analysis_port.connect(analysis_port_agent);
driver.seq_item_port.connect(sequencer.seq_item_export);
endfunction
endclass
……………………………………………………………………………….
The next step is to create the scoreboard class to receive the transactions from the
monitor via FIFO.
class my_scoreboard extends uvm_scoreboard;
// ...
// ...
function void build_phase(uvm_phase phase);
endfunction
my_analysis_export.connect(scoreboard_fifo.analysis_export);
endfunction
scoreboard_fifo.get(sequence_item);
// Example: if (sequence_item.RW == 0) begin ... compare DataR with expected value ... end
end
endtask
endclass
………………………………………………………………………..
And finally we create the subscriber class in order to serve coverage collection and
performing, custom analysis, and basic checks.
// ...
covergroup g1;
coverpoint sequence_item.addr {