# Register blocks and map

**URL:** <https://verificationacademy.com/forums/t/register-blocks-and-map/31741>\
**Category:** UVM\
**Tags:** UVM, Cookbook-RegistersModelStructure\
**Created:** [April 21, 2016, 5:23pm UTC](https://verificationacademy.com/forums/t/register-blocks-and-map/31741 "2016-04-21T17:23:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/7bcc69/32.png) [@rma](https://verificationacademy.com/forums/u/rma)\
**Post date:** [April 21, 2016, 5:23pm UTC](https://verificationacademy.com/forums/t/register-blocks-and-map/31741/1 "2016-04-21T17:23:14Z")

</div>

Hello,  
I have for example, 4 channels, and each channel has the same register definitions.  
For instance, channel 0 to 3, each has reg0 and reg1.  
I would like first to verify those register in front door mode.  
So I have defined register 0 and reg1 like this:  
class reg0 extends uvm\_reg;  
`uvm_object_utils(reg0) //fields: //fields_cons //new //build endclass class reg1 extends uvm_reg; `uvm\_object\_utils(reg1)  
//fields:  
//fields\_cons  
//new  
//build  
endclass

And then I would like to construct a register block with a map.  
So, my question is, for the four channels, do I need to construct each channel its own register blocks and map, or is there a way to modulize the code and reuse the code? I don’t want to copy and paste a lot of similar code.

Thanks in advance.  
Rui

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [April 21, 2016, 6:27pm UTC](https://verificationacademy.com/forums/t/register-blocks-and-map/31741/2 "2016-04-21T18:27:19Z")

</div>

_In reply to [rma](https://verificationacademy.com/forums/t/register-blocks-and-map/31741):_

I’m not sure if I understood your question correctly. If you have the same register block for each channel you can implement 4 instances of the same model.
