# \[Register\] error while reading value from a register array

**URL:** <https://forum.p4.org/t/register-error-while-reading-value-from-a-register-array/342>\
**Category:** Getting Started with P4\
**Created:** [May 19, 2022, 2:08pm UTC](https://forum.p4.org/t/register-error-while-reading-value-from-a-register-array/342 "2022-05-19T14:08:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AcmeT](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@AcmeT](https://forum.p4.org/u/AcmeT)\
**Post date:** [May 19, 2022, 2:08pm UTC](https://forum.p4.org/t/register-error-while-reading-value-from-a-register-array/342/1 "2022-05-19T14:08:48Z")

</div>

Hi,

I am trying to read values from a register array on Tofino model with P4-16, but I got the following error:

I don’t know what `Wide operations not supported in stateful alu, will only operate on bottom 32 bits` means.

```bash
/root/tnb/votePipe/p4src/votepipe.p4(115): [--Werror=target-error] error: Wide operations not supported in stateful alu, will only operate on bottom 32 bits
    RegisterAction<flow_ID_t, register_array_size_t, flow_ID_t>(S1_flow_ID_array) read_S1_flow_ID = { void apply(inout flow_ID_t val, out flow_ID_t rv) { rv = val; } };

```

Here is my types and consts:

```nohighlight
typedef bit<104> flow_ID_t;
typedef bit<32> count_value_t;
typedef bit<32> register_array_size_t;

const register_array_size_t register_array_size = 1024;

```

Here is my register array:

```nohighlight
Register<flow_ID_t, register_array_size_t>(register_array_size, 0) S1_flow_ID_array;

```

And here I defined a `READ_REGISTER` out of control block to read values from `S1_flow_ID_array` :

```nohighlight
#define READ_REGISTER(reg_name, reg_action_name, reg_data_t, reg_size_t) \
    RegisterAction<reg_data_t, reg_size_t, reg_data_t>(reg_name) reg_action_name = { \
        void apply(inout reg_data_t val, out reg_data_t rv) { \
            rv = val; \
        } \
    }

```

Then I create this inside control block to get value from `S1_flow_ID_array` :

```nohighlight
READ_REGISTER(S1_flow_ID_array, read_S1_flow_ID, flow_ID_t, register_array_size_t);

```

Finally here is my apply block:

```nohighlight
apply {
    register_array_size_t arrayIndex = 100; // a value got from somewhere
    flow_ID_t id = read_S1_flow_ID.execute(arrayIndex);
}

```

where did I go wrong?

---

<div class="post-metadata">

**Author:** ![AcmeT](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@AcmeT](https://forum.p4.org/u/AcmeT)\
**Post date:** [May 19, 2022, 3:06pm UTC](https://forum.p4.org/t/register-error-while-reading-value-from-a-register-array/342/2 "2022-05-19T15:06:05Z")

</div>

Well, I found that register only support " bit\<8\>, int\<8\>, bit\<16\>, int\<16\>, bit\<32\>, or int\<32\> values".

However, I want to store a 5-tuple(104b) in data plane.

are there any other components can store that in data plane? I need to read or write with a specific 5-tuple.

Thanks!

---

<div class="post-metadata">

**Author:** ![vgurevich](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/vgurevich/32/23_2.png) [@vgurevich](https://forum.p4.org/u/vgurevich)\
**Post date:** [May 19, 2022, 11:07pm UTC](https://forum.p4.org/t/register-error-while-reading-value-from-a-register-array/342/3 "2022-05-19T23:07:28Z")

</div>

@AcmeT ,

First of all, I would recommend you direct all your Tofino-specific questions to the appropriate support communities at Intel.

However, with regards to your specific one, there is a simple answer: you can use multiple registers working in parallel: one register to store the first 32-bits of your 104-bit string, another one to store the next 32-bits of that 104-bit string, etc. Ultimately, this is no different compared to how we store data in computer memory by dividing it into 8-bit chunks, called “bytes”.
