# Best Practice for Unit Tests Extending Chip-Level Tests

**URL:** <https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711>\
**Category:** UVM\
**Tags:** Inheritance, SystemVerilog\
**Created:** [April 4, 2024, 2:57pm UTC](https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711 "2024-04-04T14:57:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick\_411](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@nick\_411](https://verificationacademy.com/forums/u/nick_411)\
**Post date:** [April 4, 2024, 2:57pm UTC](https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711/1 "2024-04-04T14:57:20Z")

</div>

Hello,

I have a chip-level test with the structure of a base\_test and all specific test cases extend from base\_test. The environment consists of an I2C UVC and a register model with backdoor access. I want to create a unit test environment for a sub-component of the chip-level that would use the same register model and I2C UVC. The HDL path for backdoor access will differ for the unit test and some of the base\_test functionality is not possible for the unit test.

My question is this: Is it okay practice to use `ifdef macros to reuse the chip-level verification components (i.e. using a different hdl path, not compiling code only applicable to the chip-level)? Ideally I’d like to be able to run the same tests for both chip-level and unit level and this seems to be the most feasible way to do so.

Not sure what code I can share, but if there’s more context I can provide let me know.

---

<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:** [April 6, 2024, 4:50pm UTC](https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711/2 "2024-04-06T16:50:48Z")

</div>

It’s difficult to answer this question in a generic way. I know that the RAL model can be set up hierarchically to build the address maps without needed `ifdefs , but that may not always match how your design accesses the registers.

Also consider how code and functional coverage might be affected it you want to merge unit with chip level testing.
