# Config\_db - parameters for set/get method

**URL:** <https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871>\
**Category:** UVM\
**Tags:** UVM, config\_db\
**Created:** [December 31, 2017, 12:56pm UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871 "2017-12-31T12:56:47Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![verif\_learner1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/7993a0/32.png) [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Post date:** [January 18, 2018, 3:13am UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/21 "2018-01-18T03:13:17Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/20):_

Sorry. I disagree. For me, UVM reference manual is closest to language LRM that we have. If that does not explain clearly the meaning of parameters that designers of UVM defined, what else will?

---

<div class="post-metadata">

**Author:** ![germanbravolopez](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@germanbravolopez](https://verificationacademy.com/forums/u/germanbravolopez)\
**Post date:** [February 13, 2020, 11:56am UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/22 "2020-02-13T11:56:08Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/21):_

> _In reply to [verif\_learner](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/21):_  
> There is a mistake here. The first argument to the set/get methods is a context handle. That is an instance of a uvm\_component. These methods take the first two arguments and concatenates them together [sv]{ arg1.get\_full\_name() , arg2 }

````auto
. 
Normally arg1 is **this** or **null** depending if you want to specify a relative or absolute path. Only the result of the concatenation matters, not how the original two strings piece together.

Hi Dave,

How can I solve the problem ***"Range width must be constant expression"*** in an assignment like the following, when I get the value of this constant from database?:

``` verilog

data_a = data_b [RDW*i +: RDW];

````

To make more clear:  
In my top test I have a parameter that I receive as a generic from cmd line when I simulate the test:

```verilog

module test_top #(RDW= 16);
    initial begin
        uvm_config_db #(int)::set(null, "uvm_test_top.*", "RDW", RDW);
    end
endmodule

```

Then in my scoreboard I have:

```verilog

int RDW;
function void build_phase (uvm_phase phase);
   void'(uvm_config_db #(int)::get(this, "*", "RDW", RDW));
endfunction

task write ();
   data_a = data_b [RDW*i +: RDW];
endtask

```

Thank you very much!

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [February 13, 2020, 3:42pm UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/23 "2020-02-13T15:42:44Z")

</div>

_In reply to [germanbravolopez](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/22):_

The value to the right of ‘+:’ needs to be a constant. In your case, it is a variable.

Typically you would use a static value or a parameter.

---

<div class="post-metadata">

**Author:** ![germanbravolopez](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@germanbravolopez](https://verificationacademy.com/forums/u/germanbravolopez)\
**Post date:** [February 16, 2020, 11:52pm UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/24 "2020-02-16T23:52:03Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/23):_

Yes, that’s it. I thought to define “RDW” as a parameter, but the problem is that I cannot change the value of a parameter with the function “uvm\_config\_db()”.

I also thought to define my scoreboard parametric, like this:

```verilog

class my_scoreboard #(RDW = 8) extends uvm_scoreboard;

```

But now I am force to define as parametric the environment and the test also. And to call the test from the “test\_top” do I need to do something similar to the following code?

```verilog

initial begin
   run_test("base_test(RDW)");
end

```

I don’t know what to do…

---

<div class="post-metadata">

**Author:** ![rgarcia07](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@rgarcia07](https://verificationacademy.com/forums/u/rgarcia07)\
**Post date:** [February 17, 2020, 2:57am UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/25 "2020-02-17T02:57:01Z")

</div>

_In reply to [germanbravolopez](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/24):_

I think it is a good idea to revisit a bit your approach to the problem you need to solve, most of the times what may seem a parameter, it is not and can be passed using a config object. Now if you really need to pass the parameter from command line normally simulators provide some switches to do so (not the purpose nor this forum), also you could selectively add to the compile list a file or package with the parameters you need and import that package where needed.

Also with the first code shown you could assign in a for loop the bits you want.

```verilog

task write();
  for (int i=0; i<RDW; i++)begin
    data_b[i] = data_a[i+RDW]; //Or whatever logic meet your requirements
  end
endtask

```

Probably somebody else will provide you a more elaborate solution.

Anyways hope this helps.

-R

PS: I think it would be better to ask a new question as your problem is a bit different from what the original thread was about.

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [February 17, 2020, 3:01am UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/26 "2020-02-17T03:01:50Z")

</div>

_In reply to [germanbravolopez](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/25):_

Create a package of design parameters, and use that package to specialize your scoreboard in the environment:

```verilog

typedef my_scoreboard#(param_pkg::RDW) my_scoreboard_t;

```

---

<div class="post-metadata">

**Author:** ![germanbravolopez](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@germanbravolopez](https://verificationacademy.com/forums/u/germanbravolopez)\
**Post date:** [February 19, 2020, 10:42am UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/27 "2020-02-19T10:42:15Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/26):_

I can edit this pkg from command line each time that I want to perform a simulation with different values in the parameters, but in that case I need to recompile with this new values, right?

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [February 19, 2020, 12:30pm UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/28 "2020-02-19T12:30:29Z")

</div>

_In reply to [germanbravolopez](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/27):_

No you do not need recompile your code. You are passing the actual parameter values as switches of the simulator command to your code.

---

<div class="post-metadata">

**Author:** ![germanbravolopez](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@germanbravolopez](https://verificationacademy.com/forums/u/germanbravolopez)\
**Post date:** [February 19, 2020, 1:24pm UTC](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/29 "2020-02-19T13:24:38Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871/28):_

Okey thank you very much!!

[Previous page](https://verificationacademy.com/forums/t/config-db-parameters-for-set-get-method/33871.md?page=1)
