# I2C VVC Variable Data Length

**URL:** <https://forum.uvvm.org/t/i2c-vvc-variable-data-length/422>\
**Category:** Bitvis VIP I2C\
**Tags:** question\
**Created:** [February 27, 2024, 5:57pm UTC](https://forum.uvvm.org/t/i2c-vvc-variable-data-length/422 "2024-02-27T17:57:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![whiteway11890](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.uvvm.org/whiteway11890/32/144_2.png) [@whiteway11890](https://forum.uvvm.org/u/whiteway11890)\
**Post date:** [February 27, 2024, 5:57pm UTC](https://forum.uvvm.org/t/i2c-vvc-variable-data-length/422/1 "2024-02-27T17:57:04Z")

</div>

Hello!

I’ve been using UVVM for a while now. I need to emulate an external I2C device with UVVM. The length of data that the external device accepts is variable based on the op code (the first byte sent).

It seems like UVVM does not handle this situation well. I first tried to read a single byte, determine the op code, and then receive the correct number of bytes after that (using another call to i2c\_slave\_receive). Using two separate calls to i2c\_slave\_recieve does not work because the BFM expects a start and stop condition for each call to i2c\_slave\_receive.

Is there a way to receive a variable amount of data in a single I2C stream? I was hoping to give a max length and the function would return when a stop condition was seen.
