Home Methodologies OVM Example OVM Scoreboard
Main Menu
Home
System Verilog
Verilog
Methodologies
    - OVM Tutorial
    - OVM Example
        -- Sample DUT
        -- Sequence Item
        -- OVM Driver
        -- OVM Monitor
        -- OVM Sequencer
        -- OVM Scoreboard
        -- OVM Env
        -- OVM Env
        -- Dut Interface
        -- Top Level
        -- OVM Test
        -- OVM Sequence
    - UVM
    - VMM
    - VMM RAL
    - VMM Example
    - AVM Tutorial
Open Vera
Digital Concepts
Verification Basics
Protocols
Scripting
Articles
Videos
Interview Questions
Computer Architechture
C and C++
Blog/Article
AsicGuru Blog
Tags Cloud
Ads
Usefull Sites
Know Your IP/Location
Local Information India
Buy Car/Inverter Batteries
Real Estate India
Sports Accessories India
OVM scoreboard example
Share This Articale:

OVM Scoreboard example :

 

`ifndef __MEM_SCOREBOARD__
`define __MEM_SCOREBOARD__

class mem_scoreboard extends ovm_scoreboard;

    protected bit disable_scoreboard = 0;

    ovm_analysis_imp#(mem_transfer, mem_scoreboard) item_collected_export;

    mem_transfer mem_array [*];


    `ovm_component_utils_begin(mem_scoreboard)
        `ovm_field_int(disable_scoreboard, OVM_ALL_ON)
    `ovm_component_utils_end
    

    // new - constructor
    function new (string name, ovm_component parent);
        super.new(name, parent);
    endfunction : new

    //build
    function void build();
        item_collected_export = new("item_collected_export", this);
    endfunction

    // report
    virtual function void report();
        if(!disable_scoreboard) begin
            ovm_report_info(get_type_name(), $psprintf("Reporting scoreboard information...\n%s", this.sprint()), OVM_LOW);
        end
    endfunction : report

      // write
    virtual function void write(mem_transfer trans);
        if(!disable_scoreboard) begin
            ovm_report_info(get_type_name(), $psprintf("COMPARE HERE : ...\n%s", this.sprint()), OVM_LOW);
            compare (trans);
        end
    endfunction : write

    protected function void compare (mem_transfer trans);
        //trans.print();
        if (trans.read_write == WRITE) begin
            mem_array[trans.addr] = trans;
        end
        else if (trans.read_write == READ) begin
            if (mem_array.exists(trans.addr)) begin
                if (mem_array[trans.addr].data != trans.data) begin
                    ovm_report_error (get_type_name(), $psprintf("HIT DATA MISMATCH @ ADDR = 0x%x Got = 0x%x Expected = 0x%x\n", trans.addr, trans.data, mem_array[trans.addr].data));
                end
                else begin
                    ovm_report_info(get_type_name(), $psprintf("PASS: HIT DATA MATCH Addr = 0x%x Data = 0x%x", trans.addr, trans.data), OVM_LOW);
                end
            end
            else begin
                // Memory location is not yet written
                if (trans.data != (trans.addr & 'hFF)) begin
                    ovm_report_error (get_type_name(), $psprintf("MISS DATA MISMATCH @ ADDR = 0x%x Got = 0x%x Expected = 0x%x\n", trans.addr, trans.data, (trans.addr & 'hFF)));
                end
                else begin
                    ovm_report_info(get_type_name(), $psprintf("PASS: MISS DATA MATCH Addr = 0x%x Data = 0x%x", trans.addr, trans.data), OVM_LOW);
                end
            end
        end 
        else begin
            ovm_report_error (get_type_name(), "UNKNOWN TYPE FROM MEM_TRANSFER \n");
        end
            
    endfunction : compare


endclass : mem_scoreboard

`endif // __MEM_SCOREBOARD__


This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start


Prev << OVM Sequencer

Next >> OVM Env

 
Login/Register
Register
Sign In
Login with :-
gmail-yahoo-twitter-facebook
| | |  
  •  
  • Bookmark
    ADS