Open
Description
Describe the bug
I'm currently trying to define a function that splits a 128-bit Bits<128>
input into an array of four Bits<32>
elements and returns it. However, I encounter a syntax or compilation error when trying to return the array.
Code
function bits_to_elements {
returns
Bits<32>[4]
arguments
Bits<128> value
description {
Splits a 128-bit input into 4 elements of an array.
}
body {
Bits<32> result[4] = 0;
result[0] = value[31:0];
result[1] = value[63:32];
result[2] = value[95:64];
result[3] = value[127:96];
return result;
}
}
Bits<32> myArray[4] = bits_to_elements(128'h000102030405060708090A0B0C0D0E0F);
Error