Questions for ovm tutorial2-Second example

Dear all,
I am glad to take the practice with the second example from Doulos.
I find ovm is very difficult for hardware engineer,even with C++ and sv background.
It’s more complicated than AVM.
Here are some question:
1.I run the simulation and find:nothing happen:

run -all
# OVM_INFO @ 0: reporter [RNTST] Running test ...
# ** Note: $finish    : ../../ovm-1.0.1/src/base/ovm_env.sv(274)
#    Time: 0 ns  Iteration: 16  Instance: /ovm_pkg::ovm_env::run_test
# 1
# Break in Task run_test at ../../ovm-1.0.1/src/base/ovm_env.sv 
line 274

even i remove the // before:

// Define to start my_sequence_1 manually from the test and switch off the random sequencer
//`define START_SEQUENCE_MANUALLY
// Define to use ovm_factory to generate the transaction within my_sequence
`define USE_TRANSACTION_FACTORY

It did not run.I am surprised that if the code was not written by me how to debug?

2.why we should use `ovm_component_utils ?

`ovm_component_utils_begin(my_driver)
      `ovm_field_object(m_dut_if_wrapper, OVM_ALL_ON)
    `ovm_component_utils_end

In ovm_component_utils,it have ovm_field_object `ovm_ field_init …?
why we need it?how to use it?

Does it mean if we did not use `ovm_field_object,we can not use set_config_object?just for this purpose?

set_config_object("*.m_driver", "m_dut_if_wrapper", m_dut_if_wrapper, 0);

I cannot see any diffirence between using new and config.
Do you have any example to show the right purpose/benifit for it?

4.Sequencer…My god!It’s more complicated!

`ovm_sequencer_utils(my_sequencer)
....
`ovm_sequence_utils(my_sequence_1, my_sequencer)

Maybe I need to read more again.
Thank you!

Hi,

1.I run the simulation and find:nothing happen:

You need to tell the simulator the name of the test that you want to run, e.g.

vsim -c top +OVM_TESTNAME=my_test

2.why we should use `ovm_component_utils ?

It registers the component with the factory, otherwise create_component will not find it.

In ovm_component_utils,it have ovm_field_object ovm_ field_init .....? why we need it?how to use it? Does it mean if we did not use ovm_field_object,we can not use set_config_object?just for this purpose?

These field automation macros are required to use set_config_*. They also generate some useful utility functions for copying, comparing and packing fields.

I cannot see any diffirence between using new and config.
Do you have any example to show the right purpose/benifit for it?

Creating objects using new is not very flexible, they always get built in the same way.

Using set_config_* sets up the configuration tables used when objects are built by the factory. These are read during the build phase an can set the initial value of members, e.g.

`include "ovm_macros.svh"

package my_pkg;
  `ifdef INCA 
    `include "ovm.svh"
  `else
    import ovm_pkg::*;
  `endif

class tb_comp extends ovm_component;
   typedef enum {NONE,UP,DOWN} dir_t;

   dir_t dir = NONE;

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

   `ovm_component_utils_begin(tb_comp)
     `ovm_field_enum(dir_t,dir,OVM_ALL_ON)
   `ovm_component_utils_end

endclass : tb_comp
endpackage

module top();
  `ifndef INCA 
     import ovm_pkg::*;
  `endif

  import my_pkg::*;
   tb_comp c1;
   
   initial
     begin
        set_config_int("*","dir",tb_comp::UP);
        c1 = new("c1",null);
        c1.build();
        c1.print();
        c1.dir = tb_comp::DOWN; c1.print();
     end
endmodule // top

Gives the following output. Note that the value of dir is set by the config rather than the initial value assigned in the class:

----------------------------------------------------------------------
Name                     Type                Size                Value
----------------------------------------------------------------------
c1                       tb_comp             -                   @1116
  dir                    dir_t               32                     UP
----------------------------------------------------------------------
----------------------------------------------------------------------
Name                     Type                Size                Value
----------------------------------------------------------------------
c1                       tb_comp             -                   @1116
  dir                    dir_t               32                   DOWN
----------------------------------------------------------------------

4.Sequencer…My god!It’s more complicated!

Well, I would say that sequences are probably one of the most difficult parts of OVM to understand in detail. However, once you have got the idea, they are quite easy to use so it’s worth persevering!

Good luck!

Regards,
Dave

Hi Dave,
Thanks for your professinoal guide.
1.Could you recommend something for the fresh man like me to start with the sequencer?White paper or TechNotes?
2.OVM make me feel it really need a COOKBOOK to educate the user how to do it step by step and more important thing is to help them know the basic idear of those method,such as factory ,sequencer,call back etc.
Otherwise,I would said VMM have more papers and books for user to start with it.Is it right?

Thank you!

Hi,

1.Could you recommend something for the fresh man like me to start with the sequencer?White paper or TechNotes?

OVM sequences are based on Cadence URM sequences. If you are a Cadence customer, I would recommend having a look through their “Incisive® Plan-to-Closure Methodology Universal Reuse Methodology (URM) SystemVerilog Class-Based Implementation User Guide” to give you a bit more background. The idea originated with e sequences so you might get a further insight by looking through some e-based papers (try a search on “e”, “specman” and “sequences”), although the e approach works somewhat differently to OVM.

Otherwise,I would said VMM have more papers and books for user to start with it.Is it right?

OVM is quite new compared to VMM so it is not surprising that there hasn’t yet been so much written about it. On the plus side, this means that OVM can make use of some SystemVerilog features that were not fully developed or supported when VMM was created.

Mentor are writing a OVM cookbook that is based on their AVM cookbook. In the meantime, it is worthwhile reading through the AVM cookbook to get a better understanding of those OVM features that came from AVM (although you won’t find anything about sequences in there).

I believe that several others are also working on OVM books/guides too.

Regards,
Dave

[quote=dlong]
Creating objects using new is not very flexible, they always get built in the same way.

Using set_config_* sets up the configuration tables used when objects are built by the factory. These are read during the build phase an can set the initial value of members, e.g.

[code]`include “ovm_macros.svh”

package my_pkg;
ifdef INCA include “ovm.svh”
else import ovm_pkg::*; endif

class tb_comp extends ovm_component;
typedef enum {NONE,UP,DOWN} dir_t;

dir_t dir = NONE;

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

`ovm_component_utils_begin(tb_comp)
&nbsp%3

Hi,
Creating objects using new is not very flexible, they always get built in the same way.
Using set_config_* sets up the configuration tables used when objects are built by the factory. These are read during the build phase an can set the initial value of members, e.g.

`include "ovm_macros.svh"
package my_pkg;
`ifdef INCA 
`include "ovm.svh"
`else
import ovm_pkg::*;
`endif
class tb_comp extends ovm_component;
typedef enum {NONE,UP,DOWN} dir_t;
dir_t dir = NONE;
function new(string name="", ovm_component parent=null);
super.new(name,parent);
endfunction : new
`ovm_component_utils_begin(tb_comp)
`ovm_field_enum(dir_t,dir,OVM_ALL_ON)
`ovm_component_utils_end
endclass : tb_comp
endpackage
module top();
`ifndef INCA 
import ovm_pkg::*;
`endif
import my_pkg::*;
tb_comp c1;
initial
begin
set_config_int("*","dir",tb_comp::UP);
c1 = new("c1",null);
c1.build();
c1.print();
c1.dir = tb_comp::DOWN; c1.print();
end
endmodule // top

Hi, Dave:
This example doesn’t show the valuable of factory method, could you show some advantage of factory to new method? So thk!
(As I know, set_*_override is valuable of factory method, is there any other valuable of this method? Some codes which can describe the valuable of many doc say are perfect.)