# Question Regarding Hierarchical References

**URL:** <https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742>\
**Category:** SystemVerilog\
**Created:** [September 22, 2026, 4:20pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742 "2026-09-22T16:20:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![doggkin](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/7993a0/32.png) [@doggkin](https://verificationacademy.com/forums/u/doggkin)\
**Post date:** [September 22, 2026, 4:20pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742/1 "2026-09-22T16:20:49Z")

</div>

Hi all,

After reading LRM sections 23.7–23.9, I have a few questions about the concept of hierarchical references.

Q1.

```verilog
int i = 8;
module tb;
  initial begin: init_blk
    $display("i: %0d", i);
  end
endmodule

```

According to LRM Chapter 23.9: _“If an identifier is referenced directly (without a hierarchical path)… If the item is a variable, it shall stop at a module boundary.”_  
So the search should stop once it reaches `module tb`. But in practice, the variable `i` can still be referenced. What is meant by _“module boundary”_ in this context?

Q2.

```verilog
interface intf;
  int i = 8;
endinterface

module tb;
  initial begin: init_blk
    $display("i: %0d", intf.i);
  end
endmodule

```

According to LRM Chapter 23.9: _“If an identifier is referenced with a hierarchical name, the path can start with a module name, interface name…”._  
In my case, I used the interface name `intf`, but the compiler still reports an error.

Q3.

Based on the rules and examples in LRM Chapter 23.8 _Upwards Name Referencing_, it appears that `scope_name` in a hierarchical reference can be a module name only when it refers to the module containing the statement. In all other cases, only instance names are allowed, and `item_name` always refers to an instance name. Is my understanding of this correct?

Also, based on my understanding, the search first proceeds in the declaration scope until it reaches the design element scope, and then it continues in the scope where the module is instantiated. Does this mean the lookup alternates between the declaration scope and the instantiation scope?

BR,  
Boris

---

<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:** [September 22, 2026, 11:07pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742/2 "2026-09-22T23:07:49Z")

</div>

This section of the LRM has several issues, some of which are listed below.

A1: The declaration in `i ` is in the compilation unit (`$unit`), which is treated like an implicit package import from the compilation unit. See Section. _3.12.1 Compilation unit_. Other sections of the LRM were never updated to deal with this functionality.

A2: You need to read the sentence that follows the one you quoted. _The names shall be searched first at the current level and then in higher level modules until found._  
In your example, `tb` at the highest level. Modules and interfaces are not part of `$unit`

A3. No, `scope_name` is always a module (or interface) name in either the module in which the reference appears or at an upper hierarchical level. `item_name` is almost any identifier you’ve declared except for type names.

> **[01268: search order for data object and scope names is unclear and inaccurate...](https://accellera.mantishub.io/view.php?id=1268)**

> **[01043: 22.8 "Upwards name referencing" description has problems - Accellera...](https://accellera.mantishub.io/view.php?id=1043)**

---

<div class="post-metadata">

**Author:** ![doggkin](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/7993a0/32.png) [@doggkin](https://verificationacademy.com/forums/u/doggkin)\
**Post date:** [September 23, 2026, 3:35pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742/3 "2026-09-23T15:35:04Z")

</div>

Thank you, Dave. I have some new questions regarding your explanation.

Q1.

```verilog
module harness;
  int i = 8;
  initial $display("i: %0d", u_harness.i);
endmodule

module tb;
  harness u_harness ();
endmodule

```

You mentioned that “_scope\_name is always a module (or interface) name in either the module in which the reference appears or at an upper hierarchical level._” However, in the code above, `u_harness` is an instance name, yet it can still be resolved correctly. Or does the tool implicitly prepend the module name `tb` in front of `u_harness`, so that it is equivalent to `tb.u_harness.i`?

BR

---

<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:** [September 23, 2026, 11:39pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742/4 "2026-09-23T23:39:47Z")

</div>

Your original post cut off the sentence, which included _instance name_

---

<div class="post-metadata">

**Author:** ![doggkin](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/7993a0/32.png) [@doggkin](https://verificationacademy.com/forums/u/doggkin)\
**Post date:** [September 23, 2026, 11:57pm UTC](https://verificationacademy.com/forums/t/question-regarding-hierarchical-references/51742/6 "2026-09-23T23:57:58Z")

</div>

Thank you for your patient reply.

My expression may not have been clear enough. I am aware that the original rules include “_instance name_” and that is exactly why my original question Q3 asked whether the name is a module name only when the hierarchical reference statement is contained within a module, and otherwise is always an instance name.

BR
