# Data width is 128 bits but only LSB 32-bits are valid

**URL:** <https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806>\
**Category:** UVM\
**Tags:** UVM, AMBA-AXI\
**Created:** [July 5, 2020, 4:44am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806 "2020-07-05T04:44:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![damera](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@damera](https://verificationacademy.com/forums/u/damera)\
**Post date:** [July 5, 2020, 4:44am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/1 "2020-07-05T04:44:20Z")

</div>

My AXI4 master and slave data width is 128 but each slave register size is of 32 bit.As per the design the lsb 32 bits of the data bus are valid. In my AXI4 vip the strobe is geting randomized. The valid attributes for are: Burst = FIxed , length = 0 , size = 32 bits.I forced Strobe to 16’000F But I am not getting write and read values from the registers same.  
So how to make LSB 32 bits as valid.

---

<div class="post-metadata">

**Author:** ![voraravi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/f6c823/32.png) [@voraravi](https://verificationacademy.com/forums/u/voraravi)\
**Post date:** [July 6, 2020, 5:32am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/2 "2020-07-06T05:32:49Z")

</div>

just issue a write or read transfer of size 32bit by constraining AxSIZE to value 2. like say  
constraint awsize\_c {awsize \<= 2;}  
constraint arsize\_c {arsize \<= 2;}  
Goal here is just to issue a transaction of size 32 bit only.

---

<div class="post-metadata">

**Author:** ![Subrahmanyam](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/8797f3/32.png) [@Subrahmanyam](https://verificationacademy.com/forums/u/Subrahmanyam)\
**Post date:** [July 6, 2020, 11:34pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/3 "2020-07-06T23:34:01Z")

</div>

_In reply to [voraravi](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/2):_

I would say it should be == rather than \<= …

````auto

``` verilog

constraint awsize_c {awsize == 2;}
constraint arsize_c {arsize == 2;}

````

```auto

```

---

<div class="post-metadata">

**Author:** ![voraravi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/f6c823/32.png) [@voraravi](https://verificationacademy.com/forums/u/voraravi)\
**Post date:** [July 7, 2020, 4:54am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/4 "2020-07-07T04:54:24Z")

</div>

_In reply to [Subrahmanyam](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/3):_

If your application wants narrow transfer, you can go with \<= or if your application wants just 32 bit use ==.

---

<div class="post-metadata">

**Author:** ![damera](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@damera](https://verificationacademy.com/forums/u/damera)\
**Post date:** [July 8, 2020, 1:26pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/5 "2020-07-08T13:26:16Z")

</div>

Thank you for the suggestions. I have written this below .

```verilog
module allign( input [127:0] axi_in_data,
                  input [15:0] in_strobe ,
                  output reg [15:0]out_strobe,
                  output reg [127:0] axi_out_data
                ) ;
  bit [7:0] temp [];
  typedef bit [31:0] a;
  bit [127:0] wdata;
  bit [127:0] wdata2;
  bit [31:0] wdata1;
  integer i,j;
  assign wdata = axi_in_data;
  assign axi_out_data = wdata2;
  assign out_strobe = 16'h000f;

  task automatic masking(bit [15:0] strobe);
    begin
    temp=new[4];
    j=0;
    for(i = 0; i<16; i=i+1) begin
      if(strobe[i]==1) begin
        temp[3-j] = wdata[8*i+:8];
        j=j+1;
      end
    end
    wdata1=a'(temp); // unpacked to packed array casting
    wdata2 = {96'h0,wdata1};
    end
  endtask

  always@(*) begin
    masking(in_strobe);
  end
 endmodule

```

---

<div class="post-metadata">

**Author:** ![damera](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@damera](https://verificationacademy.com/forums/u/damera)\
**Post date:** [July 8, 2020, 1:32pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/6 "2020-07-08T13:32:22Z")

</div>

_In reply to [voraravi](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/5):_

According to DUT ,only LSB 32 bits are valid and I am using write and read API which will automatically set the AxSIZE = 3’b010.

---

<div class="post-metadata">

**Author:** ![voraravi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/f6c823/32.png) [@voraravi](https://verificationacademy.com/forums/u/voraravi)\
**Post date:** [July 8, 2020, 3:31pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/7 "2020-07-08T15:31:56Z")

</div>

_In reply to [krishna\_](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/6):_

Suggestion: use a queue array instead of a dynamic array.

```verilog

task automatic masking(bit [15:0] strobe);
    for(i = 0; i<16; i=i+1) begin
       if(strobe[i]==1) begin
           temp.push_front(wdata[8*i+:8]); //use push_front if you want to least significant
       end //byte of wdata to be stored at higest index of
    end //temp or else if least significant byte to be 
endtask //stored at lower index of temp use push_back 

```

---

<div class="post-metadata">

**Author:** ![damera](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@damera](https://verificationacademy.com/forums/u/damera)\
**Post date:** [July 8, 2020, 4:48pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/8 "2020-07-08T16:48:58Z")

</div>

_In reply to [voraravi](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/7):_

Thank you for your suggestion sir. I will definitely consider queue inspite of an array.

---

<div class="post-metadata">

**Author:** ![smit\_patel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@smit\_patel](https://verificationacademy.com/forums/u/smit_patel)\
**Post date:** [August 27, 2024, 1:52pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/9 "2024-08-27T13:52:23Z")

</div>

Hi,  
I have a general query on narrow transfer:  
If I want to send 8-bit of data on 32-bit wide bus what could be AWSIZe value ? Assume start address = 0  
To support narrow transfer there could be two approach:

1. AWSIZE = Maximum bus width 32-bit in this case  
AWSIZE = 2 ( 2^2 = 4 byte= 32 bit) and play with wstrb  
i.e wstrb = 4’b0001 lower level driver or UVC will do this configuration while driving
2. AWSIZE = 0 ( 2^0 = 1 byte = 8bits) this approach would calculate number of data to be sent on bus with (awlen+1)_(2^awsize_8) // some glue logic around this to sent wstrb

in approach-1 we don’t care about awsize and purely depends on wstrb and in approach-2 is awsize followed by wstrb

From standard axi spec point of view which is correct?

---

<div class="post-metadata">

**Author:** ![smit\_patel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@smit\_patel](https://verificationacademy.com/forums/u/smit_patel)\
**Post date:** [September 5, 2024, 5:58pm UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/10 "2024-09-05T17:58:30Z")

</div>

@voraravi , @Subrahmanyam could you please help?

---

<div class="post-metadata">

**Author:** ![suraj\_10](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/59ef9b/32.png) [@suraj\_10](https://verificationacademy.com/forums/u/suraj_10)\
**Post date:** [September 24, 2024, 6:48am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/11 "2024-09-24T06:48:39Z")

</div>

Hi @smit_patel ,

Form Spec.  
/\*  
Size is communicated using the AWSIZE and ARSIZE signals on the write request and read request channels,  
respectively. In this specification, AxSIZE indicates AWSIZE and ARSIZE.  
\*/

**AWSIZE = Maximum bus width 32-bit in this case** is not a maximum bus size. It Indicates the maximum number of bytes in each data transfer within a transaction.

As per Spec.  
/\*  
Size must not exceed the data width of an interface, as determined by the DATA\_WIDTH property.  
\*/

I think both approaches are ok whatever the AxSIZE as long as proper strobe values are provided.

---

<div class="post-metadata">

**Author:** ![smit\_patel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@smit\_patel](https://verificationacademy.com/forums/u/smit_patel)\
**Post date:** [October 2, 2024, 7:55am UTC](https://verificationacademy.com/forums/t/data-width-is-128-bits-but-only-lsb-32-bits-are-valid/37806/12 "2024-10-02T07:55:52Z")

</div>

Hi @suraj_10  
Thank you for your response.  
I also believe that both approaches are fine.  
Thank you.
