# Is it possible to map 2 different sequencers to a reg\_map one for read one for write?

**URL:** <https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100>\
**Category:** UVM\
**Tags:** UVM, uvm\_reg\_block, multiple-sequencers\
**Created:** [December 13, 2022, 12:13pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100 "2022-12-13T12:13:51Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanthvvs1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@srikanthvvs1](https://verificationacademy.com/forums/u/srikanthvvs1)\
**Post date:** [December 13, 2022, 12:13pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/1 "2022-12-13T12:13:51Z")

</div>

Hi,  
I’m working on validating an IP which has AXI as main interface. TB has two different sequencers one for AXI read channel and one for AXI write channel to drive txns independently.  
So, i want reg model to select appropriate rd\_sequencer or wr\_sequencer based on whether its a read access or write access. is this possible ?  
should i create two different reg maps one for read and one for write and do connections as below or is there a better way?

```verilog
axi_reg_blk.rd_reg_map.set_sequencer(rd_sequencer,rd_adapter);
axi_reg_blk.wr_reg_map.set_sequencer(wr_sequencer,wr_adapter);

```

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 14, 2022, 8:36pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/2 "2022-12-14T20:36:12Z")

</div>

_In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100):_

As per my ( current ) understanding ::

**A register map can be mapped to a Single Sequencer .**

**You would need 2 register maps** since you have 2 different sequencer / interface for write and read .

I am curios about following ::

\*\*For a “RW” register would you map it to both register maps ( with same offset address ) ?

Eg : rd\_reg\_map with “RO” access and wr\_reg\_map with “RW” access .\*\*

---

<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:** [December 15, 2022, 9:04am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/3 "2022-12-15T09:04:59Z")

</div>

_In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/2):_

> Hi,  
> I’m working on validating an IP which has AXI as main interface. TB has two different sequencers one for AXI read channel and one for AXI write channel to drive txns independently.  
> So, i want reg model to select appropriate rd\_sequencer or wr\_sequencer based on whether its a read access or write access. is this possible ?  
> should i create two different reg maps one for read and one for write and do connections as below or is there a better way?

```verilog
axi_reg_blk.rd_reg_map.set_sequencer(rd_sequencer,rd_adapter);
axi_reg_blk.wr_reg_map.set_sequencer(wr_sequencer,wr_adapter);

```

The key question is if your UVM architecture is correct. You need only 2 agent when you have a dual-port memory.  
Is this really the case?

---

<div class="post-metadata">

**Author:** ![srikanthvvs1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@srikanthvvs1](https://verificationacademy.com/forums/u/srikanthvvs1)\
**Post date:** [December 15, 2022, 9:13am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/4 "2022-12-15T09:13:12Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/3):_

My understanding is, for a single set of registers(instances), multiple reg\_maps can exists.  
reg\_maps are used to calculate final adress (map\_base\_addr+reg\_offset).Ex., if an IP has multiple interfaces, and base address of IP could be different through different interfaces. This requires two different reg\_maps. You can write through one interface and read through other interface, read will reflect write value even though maps are different.

I realized in this scenario its better to use uvm\_frontdoor\_seq instead of ral adapter. Any ral access invocation will call user defined seq extended from uvm\_frontdoor\_seq, where we can perform the register access normally through frontdoor.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 15, 2022, 9:28am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/5 "2022-12-15T09:28:53Z")

</div>

_In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/4):_

> I realized in this scenario its better to use uvm\_frontdoor\_seq instead of ral adapter.

**You ALWAYS need an adapter for Frontdoor Access**

---

<div class="post-metadata">

**Author:** ![srikanthvvs1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@srikanthvvs1](https://verificationacademy.com/forums/u/srikanthvvs1)\
**Post date:** [December 15, 2022, 9:28am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/6 "2022-12-15T09:28:58Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/5):_

Only reason to separate out rd and wr sequencer is to maintain the independent nature of AXI Wr and Rd channels. I think this can be achieved through single sequencer by forking off(join\_none) driver code for Wr and Rd tasks and using semaphores to block task reentry until previous Rd/Wr are done. In this case there wont be any issue with RAL.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 15, 2022, 9:34am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/7 "2022-12-15T09:34:11Z")

</div>

_In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/6):_

If you have 2 separate interfaces for Write and Read then you would have 2 sequencer , one sequencer for each interface .

Generally the built-in sequencer is used as it is , how do you intend to add semaphore to it ? . Also this won’t duplicate the independent nature of the channels

---

<div class="post-metadata">

**Author:** ![srikanthvvs1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@srikanthvvs1](https://verificationacademy.com/forums/u/srikanthvvs1)\
**Post date:** [December 15, 2022, 9:45am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/8 "2022-12-15T09:45:35Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/7):_

> _In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/7):_  
> **You ALWAYS need an adapter for Frontdoor Access**

I think not necessary. Adapter is used by RAL to convert write/read calls to specific sequence item and execute that on the registered sequencer. This is one method to do it.

```verilog
ral_model.apb_map.set_sequencer(apb_vip.apb_seqr, apb_reg_adapter);

```

In second method(which i just came to know) you register the user defined frontdoor sequence with ral. When read/write task is invoked on a register, ral will directly execute frontdoor sequence. In this sequence you will explicitly do what adapter does(usign rw\_info variable available in uvm\_frontoor\_seq). After that call uvm\_do on the sequence items, if write select wr\_sequencer if read select read\_sequencer.

```verilog
my_vreg_frontdoor_sequence frontdoor;
frontdoor = my_vreg_frontdoor_sequence::type_id::create(“frontdoor”);
regmodel.reg0.set_frontdoor(frontdoor);

```

---

<div class="post-metadata">

**Author:** ![srikanthvvs1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@srikanthvvs1](https://verificationacademy.com/forums/u/srikanthvvs1)\
**Post date:** [December 15, 2022, 9:51am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/9 "2022-12-15T09:51:11Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/8):_

> _In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/8):_  
> If you have 2 separate interfaces for Write and Read then you would have 2 sequencer , one sequencer for each interface .  
> Generally the built-in sequencer is used as it is , how do you intend to add semaphore to it ? . Also this won’t duplicate the independent nature of the channels

I mean in the driver task not in sequencer.

```verilog
task drive_wr_txn(txn t);
   wr_sema.get(); 
   fork
   begin
     //driver code
     wr_sema.put()
   end
   join_none //if a read pkt exists in driver tlm fifo this wont block that
endtask

```

…

Just a general idea. Should see if it really works.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 15, 2022, 10:36am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/10 "2022-12-15T10:36:07Z")

</div>

_In reply to [srikanthvvs1](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/9):_

> I think not necessary. Adapter is used by RAL to convert write/read calls to specific sequence item and execute that on the registered sequencer. This is one method to do it.  
> ral\_model.apb\_map.set\_sequencer(apb\_vip.apb\_seqr, apb\_reg\_adapter);

**What’s the second argument to set\_sequencer ? Isn’t that the adapter ?**

Regarding the User-defined Frontdoor I am not aware on it’s internal working so won’t be able to comment on it .

> Just a general idea. Should see if it really works.

Do update us once you have a complete **working code**.

---

<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:** [December 15, 2022, 3:01pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/11 "2022-12-15T15:01:48Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/10):_

Using 1 sequencer/driver pair supports the independent RD/WR channels.  
Depending on the access type you can either execute the WR or the RD part in the driver. Tere ios no metaphore needed, because you cannot WR and RD at the same time.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 15, 2022, 3:12pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/12 "2022-12-15T15:12:00Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/11):_

Yes , I do agree with that . Since the Write and Read channel are independent , there should be 2 Driver - Sequencer pair ( one pair for each channel ) .

---

<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:** [December 15, 2022, 3:32pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/13 "2022-12-15T15:32:59Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/12):_

I do not understand why you think we need 2 sequencer/driver pairs. The independence will be controlled by the sequences.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 15, 2022, 7:12pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/14 "2022-12-15T19:12:56Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/13):_

Oh sorry I didn’t read your previous reply correctly .  
I was of the belief that via 2 driver-sequencer pair we could initiate Write and Read transfers in parallel .  
Write could target a different register and read could target a different register at the same time thereby replicating the independent channel behavior.

> The independence will be controlled by the sequences.

I didn’t get this . Do you intend to send read and write transactions in sequence via fork join ? The driver on receiving a sequence item would either send a write OR read transaction on the channel .  
With a single pair how can we replicate a scenario where both accesses are initiated at same time

---

<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:** [December 16, 2022, 8:07am UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/15 "2022-12-16T08:07:19Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/14):_

In my understanding AXI does not allow concurrent RD and WR accesses. Do you agree?

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 16, 2022, 2:41pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/16 "2022-12-16T14:41:18Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/15):_

> AXI does not allow concurrent RD and WR accesses

I believe this is incorrect ( Feel free to correct me ) .  
The AXI Specification doesn’t restrict such concurrent accesses .

I discussed this with a few friends ( one of them used to work in VIP team for AXI ) and both of them agreed with concurrent write and read access being legal .

After all they are called independent channels in the specification .

The following is from AXI 3 Specification .

```verilog

9.1 About the data buses 

The AXI protocol has two independent data buses, one for read data and one for write data.
Because these data buses have their own individual handshake signals, it is possible for data
transfers to occur on both buses at the same time.

```

---

<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:** [December 16, 2022, 2:56pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/17 "2022-12-16T14:56:07Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/16):_

I’m not so familiar with the AXI. But I was asking earlier if a concurrent access is possible and did not get a clear answer.  
Wrt to the spec you are showing here we need definitely 2 agents with independent sequencer/driver pairs.

---

<div class="post-metadata">

**Author:** ![MICRO\_91](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@MICRO\_91](https://verificationacademy.com/forums/u/MICRO_91)\
**Post date:** [December 16, 2022, 3:34pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/18 "2022-12-16T15:34:19Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/17):_

While discussing with the friend with VIP experience he pointed to a few things ::

(1) If we go with multiple driver-sequencer pair approach ::

```
 (a) There would be different sequence items for write and read . 
      So write channels driver-sequencer pair would use write sequence item .

 (b) Write and read sequence would be different and they would be started in parallel from test .

```

(2) If we go with single driver-sequencer pair ::

```
 (a) Single sequence_item would encapsulate all write and read properties 
       The single driver-sequencer pair would use it for parameterization .           

 (b) Single sequence would exist for write and read and it would be started in test ( unlike parallel sequences (1)(b) )

```

Post-discussion I agree that we can go with single driver-sequencer pair as well.

---

<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:** [December 16, 2022, 4:10pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/19 "2022-12-16T16:10:11Z")

</div>

_In reply to [MICRO\_91](https://verificationacademy.com/forums/t/is-it-possible-to-map-2-different-sequencers-to-a-reg-map-one-for-read-one-for-write/41100/18):_

Looks like it is a question of taste. Of course, you need different seq\_items or 1 combined.
