• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Parameterized UVM Environment Creation Issue.

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 66
  • Views 21348
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Parameterized UVM Environment Creation Issue.

Selvavinayak
Selvavinayak over 10 years ago

Hi all, 

  when we are trying to create Parameterized UVM environment, we are not able to pass parameter from top to bottom of the component.Please help Us to solve this Issue, Our Dummy Environment should be like below,

class driver (parameter DATAWIDTH)

bit[DATAWIDTH-1:0]data;

endclass:driver

class agent(parameter DATAWIDTH)

driver#(DATAWIDTH) driver_m;

class agent

class env();

  agent#() agent_m[];

function new();

  

endfunction

function build_phase();

  agent_m=new[3];

  agent_m[0]=agent#(32)::type_id::create("agent", this)

  agent_m[1]=agent#(64)::type_id::create("agent", this)

  agent_m[2]=agent#(128)::type_id::create("agent", this)

endfunction

endclass:env

we need to create agent with different parameters. we tried but, parameter value is not passing correctly some time we are facing fatal error.

Is any one have experience with this environment. please share the Information

Thanks,

selvavinayakam.na

  • Cancel
  • Tudor Timi
    Tudor Timi over 10 years ago

    You can't store your agents with different parameterizations in the same array. For example, agent #(64) is a totally different class than agent #(128), even though they specialize the same parameterized class.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Selvavinayak
    Selvavinayak over 10 years ago

    Thanks for your response Tudor timi, now I checked with single agent flow like below, class driver (parameter DATAWIDTH=32)

    bit[DATAWIDTH-1:0]data;

    endclass:driver

    class agent(parameter DATAWIDTH=32)

    driver#(DATAWIDTH) driver_m; function build_phase();
    driver_m = driver#(DATAWIDTH)::type_id::create("driver", this); endfunction
    endclass agent

    class env();

    agent#(64) agent_m;

    function build_phase();

    agent_m=agent#(64)::type_id::create("agent", this)

    endfunction

    endclass:env when we Tried above setup we are getting below error, driver_m = driver#(DATAWIDTH)::type_id::create("driver", this);
    |
    ncelab: *E,TYCMPAT (agent.sv,15|58): assignment operator type check failed (expecting datatype compatible with 'class $unit::driver#(.DATAWIDTH(32))' but found 'class $unit::driver#(.DATAWIDTH(64))' instead).
    can you please share Information how to solve This Issue. thanks, selvavinayakam.na

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • TAM1
    TAM1 over 10 years ago

    The original answer was right. The problem is in the declaration of the agent_m array. Because each instance of the parameterized agent is of a different width, each is a completely different type according to SystemVerilog rules.

    The declaration:

      agent agent_m[3];

    declares an array of 3 handles to agent#(32) class objects. That is because the default parameter for DATAWIDTH is 32. That's why you can't assign a 64 bit wide agent's handle to it.

    The workaround is to declare the agent_m array to be of the base class from which the specialized agent classes are derived.

      uvm_agent agent_m[3];

    This array can store any flavor of agent handle as long as it is of a class derived from uvm_agent. But remember, when you go to use them, you have to type cast them.

      agent#(32) agent0;

      if ( !$cast(agent0,agent_m[0]) ) uvm_fatal(...);

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Selvavinayak
    Selvavinayak over 10 years ago

    Hi TAM Thanks for your Information is possible to share the full information with any example. Because It will helpful for us to understand.

    Thanks,

    selvavinayakam.na

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Selvavinayak
    Selvavinayak over 10 years ago
    Thanks Tudor timi & TAM, we resolved Parameterized environment Issue with some more changes in Environment. we are able to pass the two different parameter to two separate environment...
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dhavalpatel
    dhavalpatel over 8 years ago

    Hi,

    I was facing the same issue when i am creating multiple Parameterized agent.

    You just will have to do is :

    // UVM Automation macros
    `uvm_component_utils(agent#(DATA_WIDTH));

    Here you will have to declare parameterize uvm automation macros in all the class where you have used the parametrization in class.

    please let me know if there is a issue.

    Regards,

    Dhaval

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • keerthim
    keerthim over 6 years ago in reply to Selvavinayak

    Hi, I'm facing similar issue where I have a lot of agents whose sequencers are parameterized by width. I want to push them all in a associative array and there is no way to do it as it is giving type mismatch coz of parameterization. May I know how you resolved this issue. If you could provide some code example that will be great. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • keerthim
    keerthim over 6 years ago in reply to dhavalpatel

    Hi Don't you have to use 

    `uvm_component_param_utils(agent#(DATA_WIDTH));

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • keerthim
    keerthim over 6 years ago in reply to TAM1

    I'm having similar issue but with array of uvm sequencers. Declaring the base of the array as a uvm_sequencer doesn't seem to work when assigning parameterized sequencers to the array element.

    I'm getting a compile time error for type mismatch. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information