# Functional Coverage: Sampling RTL signals in a hierarchy (gives error)

**URL:** <https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, functional-coverage, hierarchy\
**Created:** [February 13, 2014, 10:23am UTC](https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162 "2014-02-13T10:23:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alih110](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/alih110/32/2119_2.png) [@alih110](https://verificationacademy.com/forums/u/alih110)\
**Post date:** [February 13, 2014, 10:23am UTC](https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162/1 "2014-02-13T10:23:38Z")

</div>

Hello,

I am creating a functional coverage model. I am binding my coverage model with the design using the “bind” statement.  
I need to access some internal signals of a design instance inside the top level design module for using in my functional coverage model. However I get an error. Below is what I am trying =\>

In the RTL design module “dut\_berc”, there is a instance “dut\_berc\_cmd”. I need to access the signal “pct\_err\_status\_vec” in this “dut\_berc\_cmd” module.

So in design =\>

```auto
module dut_berc #(....)
  (clk, reset, ....
);

   dut_berc_cmd #(...) u_dut_berc_cmd (..);

```

```auto
module dut_berc_cmd #(....)
(.....
);

  logic [PCT_DEPTH-1:0] pct_err_status_vec; <----- This is the signal I need to sample inside my functional coverage model

```

In the top level TB file, the bind happens =\>

```auto
bind dut_berc
     dut_cov_berc #()
   FUNC_COVERAGE (.*);

```

In “dut\_cov\_berc” =\>

```auto
module dut_cov_berc #(...)
(
input [PCT_DEPTH-1:0] u_dut_berc_cmd.pct_err_status_vec,
........
)

```

## However I get the following error when I try this =\>

## \*\* Error: /view/…/src/dut\_cov\_berc.sv(36): near “.”: syntax error, unexpected ‘.’, expecting ‘)’

I tried directly accessing the signal in my functional coverage module but it gave an error that it is unable to find this signal.  
Please let me known what is the correct way to access design signals present in a hierarcy in the functional coverage model?

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:** [February 13, 2014, 4:12pm UTC](https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162/2 "2014-02-13T16:12:24Z")

</div>

When you use the **bind** construct, the syntax of bind instance should look exactly like it would if you had written it inside the target module. And the syntax of the module being bound uses normal Verilog syntax rules as well; you cannot have a port defined as a hierarchical reference. So change it to

```verilog
module dut_cov_berc #(...)
(
input [PCT_DEPTH-1:0] pct_err_status_vec,
........
)

```

Then change your bind statement to

```verilog
bind dut_berc
     dut_cov_berc #()
   FUNC_COVERAGE (.pct_err_status_vec(u_dut_berc_cmd.pct_err_status_vec),.*);

```

I suspect you may be trying to access signals from many different levels of your DUT hierarchy. so instead of having a single dut\_cov\_berc module, you should break it up into several modules with separate **bind** statements that bind deeper into the hierarchy of your DUT. For example, you could change the bind statement above to

```verilog
bind u_dut_berc.u_dut_berc_cmd
     dut_cov_berc #()
   FUNC_COVERAGE (.*);

```

---

<div class="post-metadata">

**Author:** ![alih110](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/alih110/32/2119_2.png) [@alih110](https://verificationacademy.com/forums/u/alih110)\
**Post date:** [February 19, 2014, 10:58am UTC](https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162/3 "2014-02-19T10:58:25Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/functional-coverage-sampling-rtl-signals-in-a-hierarchy-gives-error/29162/2):_

Thanks Dave. This worked well for me :-)  
I am creating separate functional coverage modules for the different modules in the DUT as you suggested.  
However this signal was in a sub-module which was inside the sub-module I was binding to.
