# Assign dynamic width

**URL:** <https://verificationacademy.com/forums/t/assign-dynamic-width/40206>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [March 26, 2022, 11:24am UTC](https://verificationacademy.com/forums/t/assign-dynamic-width/40206 "2022-03-26T11:24:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexd555](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@alexd555](https://verificationacademy.com/forums/u/alexd555)\
**Post date:** [March 26, 2022, 11:24am UTC](https://verificationacademy.com/forums/t/assign-dynamic-width/40206/1 "2022-03-26T11:24:46Z")

</div>

For example,  
I can assign dynamic array.

At beginning by declaration and when I know the size then assign.

```verilog
  logic do_update_check[];
    do_update_check = new [size]; //size - we know the value.

```

but how can I do the same if I declare ?

```verilog

    logic []do_update_check; //should be width

```

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [March 26, 2022, 2:53pm UTC](https://verificationacademy.com/forums/t/assign-dynamic-width/40206/2 "2022-03-26T14:53:34Z")

</div>

_In reply to [alexd555](https://verificationacademy.com/forums/t/assign-dynamic-width/40206):_

The size of an unpacked dynamic array can be set—dynamically; meaning by the execution of a procedural statement at runtime.

The size of an integral packed array (also known as the width) must be set at compile time because the width of an integral value it part of its datatype and cannot be changed at runtime. SystemVerilog is a [statically typed language](https://www.sitepoint.com/typing-versus-dynamic-typing/).
