# Non integral expressions

**URL:** <https://verificationacademy.com/forums/t/non-integral-expressions/34191>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [March 13, 2018, 1:15pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191 "2018-03-13T13:15:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![laureen.giac](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@laureen.giac](https://verificationacademy.com/forums/u/laureen.giac)\
**Post date:** [March 13, 2018, 1:15pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/1 "2018-03-13T13:15:39Z")

</div>

Hi,

Can someone please tell me what the SV LRM means by 'nonintegral expressions" ? Thanks

---

<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 13, 2018, 3:14pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/2 "2018-03-13T15:14:56Z")

</div>

_In reply to [laureen.giac](https://verificationacademy.com/forums/t/non-integral-expressions/34191):_

Not having an integral value, not an integer. Reals and class variables are non integral types

---

<div class="post-metadata">

**Author:** ![laureen.giac](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@laureen.giac](https://verificationacademy.com/forums/u/laureen.giac)\
**Post date:** [March 13, 2018, 6:51pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/3 "2018-03-13T18:51:56Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/non-integral-expressions/34191/2):_

Are strings too considered non-integral?

---

<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 13, 2018, 9:24pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/4 "2018-03-13T21:24:11Z")

</div>

_In reply to [laureen.giac](https://verificationacademy.com/forums/t/non-integral-expressions/34191/3):_

No. See Section _6.11.1 Integral types_ in the 1800-2017 LRM for a definition. Everything else is nonintegral.

---

<div class="post-metadata">

**Author:** ![bhosaleakash00](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/ac91a4/32.png) [@bhosaleakash00](https://verificationacademy.com/forums/u/bhosaleakash00)\
**Post date:** [August 25, 2026, 6:10pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/5 "2026-08-25T18:10:58Z")

</div>

Hi Sir,

**6.11.1 Integral types**

```verilog
The term integral is used throughout this standard to refer to the data types
that can represent a single basic integer data type, packed array, packed structure, packed union, or enum.

```

**6.16 String data type** says a string variable can be accessed from index 0 (leftmost character) to N-1 (where N is the length of the string)

As per my understanding since a string variable can be indexed similar to a packed array it’s considered an integral type. Please correct me if I am wrong

Since the leaf level expression in a constraint comprises of integral types, why are random string variables not legal ?

**Is it because the (packed) length of the string can’t be constrained unlike size of dynamic array or queue ?**

---

<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:** [August 25, 2026, 7:37pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/6 "2026-08-25T19:37:38Z")

</div>

Selecting a character from a string is an integral value, but the variable itself and a range of characters selected from it are not.

The rules for what can be declared as a random variable with `rand` are stricter than what variables can be used in a constraint. I suppose there’s no technical reason why you couldn’t declare a string as a random variable, but they just never thought it was useful enough to put into the LRM.

---

<div class="post-metadata">

**Author:** ![bhosaleakash00](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/ac91a4/32.png) [@bhosaleakash00](https://verificationacademy.com/forums/u/bhosaleakash00)\
**Post date:** [August 26, 2026, 12:10pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/7 "2026-08-26T12:10:37Z")

</div>

Hello Sir,

> [@dave\_59](#):
>
> Selecting a character from a string is an integral value, **but the variable itself** and a range of characters selected from it are not.

Do you mean to say a string variable isn’t considered an integral type ?

I am confused as I believed that string variables are integer type based on your [earlier response](https://verificationacademy.com/forums/t/non-integral-expressions/34191/4)

(also as per LRM string variable can be indexed similar to a packed array)

---

<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:** [August 26, 2026, 6:18pm UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/8 "2026-08-26T18:18:04Z")

</div>

A string variable is not an integral type because integral types have a fixed bit size at compile time, while strings are dynamically sized. You can have types like unpacked arrays and structs composed of integral types, but the aggregate is not an integral type.

---

<div class="post-metadata">

**Author:** ![Tobias187](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@Tobias187](https://verificationacademy.com/forums/u/Tobias187)\
**Post date:** [September 1, 2026, 11:12am UTC](https://verificationacademy.com/forums/t/non-integral-expressions/34191/9 "2026-09-01T11:12:53Z")

</div>

Strings indeed behave like packed arrays but they are not.
