Home Methodologies OVM Example OVM Test
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 Test Example for testbench
Share This Articale:

OVM Test Example for testbench :

 

`ifndef __MEM_TEST_LIB
`define __MEM_TEST_LIB

class mem_base_test extends ovm_test;

    `ovm_component_utils(mem_base_test)

    mem_tb mem_tb_inst0;
    ovm_table_printer printer;

    function new (string name="mem_base_test", ovm_component parent=null);
        super.new (name, parent);
    endfunction : new 

    virtual function void build();
        super.build();
        //set_config_string("*.m_sequencer", "default_sequence", "simple_seq");
        // Enable transaction recording for everything
         set_config_int("*", "recording_detail", OVM_FULL);
        mem_tb_inst0 = mem_tb::type_id::create("mem_tb", this);
        // Create a specific depth printer for printing the created topology
        // set_config_string("mem_tb_inst0.m_env0.m_sequencer", "default_sequence", "simple_seq");
        printer = new();
        printer.knobs.depth = 3;
    endfunction : build

    task run ();
        mem_tb_inst0.m_env0.m_sequencer.default_sequence = "simple_seq";
        $display("SEQUENCER : Puneet \n");
        mem_tb_inst0.m_env0.m_sequencer.print();
        #10000;
        ovm_report_info(get_type_name(),"Calling global_stop_request() to end the run phase", OVM_LOW);
        global_stop_request();
    endtask : run 

    function void end_of_elaboration();
        // Set verbosity for the bus monitor 
        mem_tb_inst0.m_env0.m_monitor.set_report_verbosity_level(OVM_FULL);
        ovm_report_info(get_type_name(), $psprintf("Printing the test topology :\n%s", this.sprint(printer)), OVM_LOW);
    endfunction : end_of_elaboration



endclass : mem_base_test


class mem_read_write_test extends mem_base_test;

    `ovm_component_utils(mem_read_write_test)

    function new (string name="mem_read_write_test", ovm_component parent=null);
        super.new (name, parent);
    endfunction : new 

    virtual function void build ();
        set_config_string("mem_tb_inst0.m_env0.m_sequencer", "default_sequence", "ovm_random_sequence");
        super.build();
        ovm_report_info(get_type_name(),"INSIDE mem_read_write_test BUILD METHOD", OVM_LOW);
     endfunction : build

    task run ();
        ovm_report_info(get_type_name(),"INSIDE mem_read_write_test RUN METHOD", OVM_LOW);
        #2000;
        ovm_report_info(get_type_name(),"Calling global_stop_request() to end the run phase", OVM_LOW);
        global_stop_request();
    endtask : run 

endclass : mem_read_write_test

class mem_bitwalk_test extends mem_base_test;

    `ovm_component_utils(mem_bitwalk_test)

    function new (string name="mem_bitwalk_test", ovm_component parent=null);
        super.new (name, parent);
    endfunction : new 

    virtual function void build ();
        set_config_string("mem_tb_inst0.m_env0.m_sequencer", "default_sequence", "mem_bit_walk_seq");
        super.build();
    endfunction : build

    task run ();
        #2000;
        ovm_report_info(get_type_name(),"Calling global_stop_request() to end the run phase", OVM_LOW);
        global_stop_request();
    endtask : run

endclass : mem_bitwalk_test


// Boundry Value Check
class mem_boundry_val_test extends mem_base_test;

    `ovm_component_utils(mem_boundry_val_test)

    function new(string name = "mem_boundry_val_test", ovm_component parent=null);
        super.new(name,parent);
    endfunction : new

    virtual function void build();
        // Create the tb
        super.build();
        // Set the default sequence for the master and slave
        //set_config_string("*.m_sequencer", "default_sequence", "mem_boundry_val_seq");
        set_config_string("mem_tb_inst0.m_env0.m_sequencer", "default_sequence", "mem_boundry_val_seq");
    endfunction : build
    
    task run ();
        mem_tb_inst0.m_env0.m_sequencer.default_sequence = "mem_boundry_val_seq";
        $display("SEQUENCER : Puneet \n");
        mem_tb_inst0.m_env0.m_sequencer.print();
        ovm_report_info(get_type_name(),"STARTING mem_boundry_val_test : Puneet ", OVM_LOW);
        #2000;
        ovm_report_info(get_type_name(),"Calling global_stop_request() to end the run phase", OVM_LOW);
        global_stop_request();
    endtask : run

endclass : mem_boundry_val_test

`endif //__MEM_TEST_LIB


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


Prev << Top Level

Next >> OVM Sequence

Posted By : zied - Aug. 14, 2009, 5:07 a.m.

are u sure that this test code is working, because there is no mem_tb class available. Thanks.

Posted By : Puneet - Aug. 19, 2009, 1:33 p.m.

Hi Zied, I have added the zipped version of the example and I have sent you the example in mail. ~Puneet

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