# Verilog code confusion, I do not understand this line of code

**URL:** <https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044>\
**Category:** SystemVerilog\
**Tags:** assign, SystemVerilog, logical-equality, logical-AND, current-value\
**Created:** [November 26, 2022, 7:35pm UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044 "2022-11-26T19:35:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lala](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/lala/32/3472_2.png) [@lala](https://verificationacademy.com/forums/u/lala)\
**Post date:** [November 26, 2022, 7:35pm UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/1 "2022-11-26T19:35:02Z")

</div>

read\_data = read\_address == 4’d8 && y\_ff$ETY\_N && y\_ff$D\_O;  
What will be the value of “read\_data” after this line has been executed? I do not understand whats happening in this line.

---

<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:** [November 28, 2022, 6:49pm UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/2 "2022-11-28T18:49:10Z")

</div>

_In reply to [lala](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044):_

We cannot tell you the value of “read\_data” without knowing the value of **read\_address** , **y\_ff$ETY\_N** , and **y\_ff$D\_O**. But it can only be one of three choices 1’b1, 1b0, 1’bx.

---

<div class="post-metadata">

**Author:** ![lala](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/lala/32/3472_2.png) [@lala](https://verificationacademy.com/forums/u/lala)\
**Post date:** [November 28, 2022, 8:22pm UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/3 "2022-11-28T20:22:35Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/2):_

> _In reply to [lala](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/2):_  
> We cannot tell you the value of “read\_data” without knowing the value of **read\_address** , **y\_ff$ETY\_N** , and **y\_ff$D\_O**. But it can only be one of three choices 1’b1, 1b0, 1’bx.

Thankyou Dave. Also can you please explain this part **read\_address == 4’d8 && y\_ff$ETY\_N && y\_ff$D\_O**. Example:- **A == 4’d8 && B && C** taking any example for A, B and C. Also how does this evaluates to either 1’b1, 1’b0 or 1’bx.  
Thankyou.

---

<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:** [November 28, 2022, 9:33pm UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/4 "2022-11-28T21:33:54Z")

</div>

_In reply to [lala](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/3):_

Table 11-21 in the [IEEE 1800-2017 SystemVerilog LRM](https://ieeexplore.ieee.org/document/8299595) tells you the result of the == and && operators are 1-bit expressions. And table 11-3 gives you the precedence for evaluating these operators.

```verilog
 D = ( ( (A == 4'd8 ) && B ) && C )

```

---

<div class="post-metadata">

**Author:** ![lala](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/lala/32/3472_2.png) [@lala](https://verificationacademy.com/forums/u/lala)\
**Post date:** [November 29, 2022, 12:13am UTC](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/5 "2022-11-29T00:13:48Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/4):_

> _In reply to [lala](https://verificationacademy.com/forums/t/verilog-code-confusion-i-do-not-understand-this-line-of-code/41044/4):_  
> Table 11-21 in the [IEEE 1800-2017 SystemVerilog LRM](https://ieeexplore.ieee.org/document/8299595) tells you the result of the == and && operators are 1-bit expressions. And table 11-3 gives you the precedence for evaluating these operators.

```verilog
 D = ( ( (A == 4'd8 ) && B ) && C )

```

Thankyou very much Dave. The IEEE Standard for SV book on that link was very helpful, it is a gold for me. The table was also very helpful. I was confused about the result of this ‘==’ operator, I thought its boolean “True or False”, but it turns out to be scalar value 0 for False and 1 for True. BTW I am learning SystemVerilog myself (self learning) and that book will help me alot. Thankyou so much. I really appreciate your help.
