How to make Configurable OVC?

Hi All,

I want to design “configurable OVC” with different type of parameters.

Example: I have configure parameters such as DATA_SIZE and ADDR_SIZE and these can vary based on the DUT under test.

One way I could achieve “Configurability” is using templated classes for all environment classes in the OVC in the following way…


class my_driver #(int DATA_SIZE=8, int ADDR_SIZE=16) extends ovm_driver #(my_seq_item #(DATA_SIZE, ADDR_SIZE));

endclass

class my_sequencer #(int DATA_SIZE=8, int ADDR_SIZE=16)
extends ovm_sequencer #(my_seq_item #(DATA_SIZE, ADDR_SIZE));

endclass

class my_agent #(int DATA_SIZE=8, ADDR_SIZE=16)
extends ovm_agent;
endclass

interface my_if #(int DATA_SIZE = 8, int ADDR_SIZE = 16)
(input bit clk, input bit rst);
endinterface

But issue with the above method is that using of typedef’s with these parameters.
i.e how can I configure/pass the parameter for the data types which are defined in ovc global params file ?

file: my_data_types_params.svh

typedef enum bit[DATA_SIZE - 1: 0] fifo_type; // Since OVC can be made configurable with Templated parameter but how to make these typedef’s with the same parameters?

Are there any better suggestions to make OVC configurable? Is there any other better way of doing configurable OVC?

Thanks
Santosh

Hi Santosh,

Not sure I get your question right ?
But why cant you have a seperate file containing all defines and import this file into your environment ?

thanks and regards

Assume I want to have same 2 instances but with different kinds of parameters in the top level virtual environment.

my_env inst1_env#(int DATA_SIZE=8, int ADDR_SIZE=16);
my_env inst2_env#(int DATA_SIZE=16, int ADDR_SIZE=32);

The above passing of parameters through templated mechanism makes OVC classes configurable. But the typedef’s which are defined in a global file and used across in all OVC classes will NOT configured.

Hi Santosh,

You can have the typedef local to your class and use parameters in the typedef.

For example:

module top;

        class c #(DATA_SIZE=0);

                typedef enum bit[DATA_SIZE-1:0] { true, false } some_enum;

                some_enum myvar;

        endclass
 

        c #(13) handle1 = new;

        c #(37) handle2 = new;

        initial $display($bits(handle1.myvar),,$bits(handle2.myvar));
endmodule

However, you cannot define the enum in the global scope and reference DATA_SIZE.

I’d suggest to define all your enums inside a package unless they are sized by parameters that need to different in a single simulation. Those you should push down inside a class definition and use the class parameter so you can specify the enum on a class instance basis.

Are there any other mechanisms/suggestions we can configure OVC in OVM? (Assume there are lot of parameters I need to pass)

Thanks,
Santosh