• 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 21350
  • 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
Parents
  • 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
Reply
  • 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
Children
  • 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