# Await\_value utils functionality issue

**URL:** <https://forum.uvvm.org/t/await-value-utils-functionality-issue/215>\
**Category:** Utility Library\
**Tags:** uvvm, question\
**Created:** [July 7, 2021, 9:50am UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215 "2021-07-07T09:50:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![KevNug](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KevNug](https://forum.uvvm.org/u/KevNug)\
**Post date:** [July 7, 2021, 9:50am UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/1 "2021-07-07T09:50:34Z")

</div>

Hi Marius,

I am trying to add self checking mechanism to another module I am currently verifying.

I currently have an issue when I use the following await\_value ie awaiting between 262000 ns & 270000 ns for state\_out value of “0110” (this is WRITE\_SDA state) to reach :

await\_value(state\_out, “0110”, 262000 ns, 270000 ns, “Waiting for WRITE\_SDA state to reach”);

& get the following error message:

UVVM: ==================================

# UVVM: \*\*\* ERROR #1 \*\*\*

# UVVM: 263100 ns TB seq.

# UVVM: await\_value(slv x"6", 262000 ns, 270000 ns) =\> Failed. Condition occurred too early, after 54900 ns. ‘Waiting for WRITE\_SDA state to reach’

# UVVM:

# UVVM: Simulator has been paused as requested after 1 ERROR

# UVVM: \*\*\* To find the root cause of this alert, step out the HDL calling stack in your simulator. \*\*\*

# UVVM: \*\*\* For example, step out until you reach the call from the test sequencer. \*\*\*

# UVVM: ================================

However, I am aware that there was another WRITE\_SDA state\_out “0110” that happened earlier @56300 ns and do not wanted to detect that one. Detected that one earlier but had to use also a bigger range band eg

await\_value(state\_out, “0110”, 54800 ns, 57000 ns, “Waiting for WRITE\_SDA state to reach”);

WRITE\_SDA state occurred here @56400 nS but had to use 54800 ns as start range and could not use eg 56300 ns ie 100 ns before it’s detection @56400 ns otherwise had a similar error that “Condition occurred too early, after 54900 ns”.

I performed already before hand a single WRITE\_SDA followed by a single READ\_SDA and at 263000 ns I was trying to perform another WRITE\_SDA.

Part of the code in my testbench I am trying to perform is:

::

await\_completion(I2CCONTROLLER\_VVCT, 1, 2082\*C\_CLK\_PERIOD, “Await completion”);

i2ccontroller\_write\_sda\_multiple\_bytes(I2CCONTROLLER\_VVCT, 1, 26, “I2CController module: WRITE\_SDA multi-byte transfer”);

log(ID\_SEQUENCER, “Wait until the target signal ‘state\_out’ equals the exp signal ‘0110’”, C\_SCOPE); – @263000 nS

await\_value(state\_out, “0110”, 262000 ns, 270000 ns, “Waiting for WRITE\_SDA state to reach”);

::

await\_completion(I2CCONTROLLER\_VVCT, 1, 26054\*C\_CLK\_PERIOD, “Await completion”);

::

The C\_CLK\_PERIOD I use is 100 ns ie 2082\*C\_CLK\_PERIOD stated above is 208200 ns

It should complete at 208200 ns from the await\_completion procedure used above and then execute the rest. Isn’t this the case?

Your reply to this matter will be appreciated.

Regards,  
Kevin

---

<div class="post-metadata">

**Author:** ![Marius](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.uvvm.org/marius/32/43_2.png) [@Marius](https://forum.uvvm.org/u/Marius)\
**Post date:** [July 7, 2021, 11:57am UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/2 "2021-07-07T11:57:52Z")

</div>

Hi Kevin,

Does your sequencer synchronize with all the commands, i.e. the sequencer has had an await\_completion() of the previous I2C command? The time window in the sequencer should look something like:

|-----…  
|-----i2c\_command() – cmd 1  
|-----await\_completion() – waiting from “now” and to 2082_C\_CLK\_PERIOD  
|-----i2c\_command() – cmd 2  
|-----await\_value() – waiting from “now” and to 2082_C\_CLK\_PERIOD  
|-----i2c\_command() – cmd 3  
|-----await\_completion() – waiting from “now” and to 2082\*C\_CLK\_PERIOD

So, the i2c commands will be synchronized by:

- await\_completion() for cmd 1
- await\_value() for cmd 2
- await\_completion() for cmd 3

That is, if await\_value() is waiting on something triggered by cmd 2.

You should for the await\_value() have a waiting time window set from “now” and to the number of clock periods the DUT is required to set the output you are waiting on.

Could you please check if your sequencer is correctly synchronized?

Br,  
Marius

---

<div class="post-metadata">

**Author:** ![KevNug](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KevNug](https://forum.uvvm.org/u/KevNug)\
**Post date:** [July 7, 2021, 1:27pm UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/3 "2021-07-07T13:27:54Z")

</div>

Hi Marius,

Thanks for your reply. The await\_completion() when executed then it assumes from “now”. I did not use any “now” as a parameter within the await\_completion. Please confirm.

I replaced within the await\_value() the start time to “now” wherever I try calling it.

My commands were still the same apart from adding the “now” as follows:

i2ccontroller\_write\_sda\_one\_byte() – cmd 1

await\_value(state\_out, “0110”, now, 57000 ns, “Waiting for WRITE\_SDA state to reach”);  
i2ccontroller\_check()  
i2ccontroller\_check()  
::  
i2ccontroller\_check()

await\_completion(I2CCONTROLLER\_VVCT, 1, 1055\*C\_CLK\_PERIOD, “Await completion”);  
– for cmd 1

–

i2ccontroller\_read\_sda\_one\_byte() – cmd 2

await\_value(rx\_buffer\_rdy, ‘1’, now, 199700 ns, “Waiting until rx\_buffer\_rdy = ‘1’”);  
i2ccontroller\_check()

await\_completion(I2CCONTROLLER\_VVCT, 1, 2082\*C\_CLK\_PERIOD, “Await completion”);  
– for cmd2

–

cmd 1 was executed ok and completed @105500 ns as expected but cmd 2 reported the following error:

# UVVM: \*\*\* ERROR #1 \*\*\*

# UVVM: 199500 ns TB seq.

# UVVM: await\_value(std\_logic 1, 105500 ns, 199700 ns) =\> Failed. Condition occurred too early, after 94000 ns. ‘Waiting until rx\_buffer\_rdy = ‘1’’

rx\_buffer\_rdy only gets asserted high in Simulation @199500 ns.  
Why it displayed “Failed. Condition occurred too early, after 94000 ns. 'Waiting until rx\_buffer\_rdy = ‘1’” ?

> > You should for the await\_value() have a waiting time window set from “now” and to the \>\>number of clock periods the DUT is required to set the output you are waiting on  
> > My waiting window is set from “now” to just right after the pulse rx\_buffer\_rdy occured. ‘0’ → ‘1’ rx\_buffer\_rdy pulse occurred @199500-199600 (1 clk cycle long).

The await\_value expects min\_time and max\_time parameters and not the number of clock cycles as you stated above. Please comment here.

```
await_value(target, exp, min_time, max_time, [alert_level], msg, […])

```

Regards,  
Kevin

---

<div class="post-metadata">

**Author:** ![KevNug](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KevNug](https://forum.uvvm.org/u/KevNug)\
**Post date:** [July 7, 2021, 1:48pm UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/4 "2021-07-07T13:48:04Z")

</div>

> [@KevNug](#):
>
> i2ccontroller\_write\_sda\_one\_byte() – cmd 1
> 
> await\_value(state\_out, “0110”, now, 57000 ns, “Waiting for WRITE\_SDA state to reach”);  
> i2ccontroller\_check()  
> i2ccontroller\_check()  
> ::  
> i2ccontroller\_check()
> 
> await\_completion(I2CCONTROLLER\_VVCT, 1, 1055\*C\_CLK\_PERIOD, “Await completion”);  
> – for cmd 1
> 
> –
> 
> i2ccontroller\_read\_sda\_one\_byte() – cmd 2
> 
> await\_value(rx\_buffer\_rdy, ‘1’, now, 199700 ns, “Waiting until rx\_buffer\_rdy = ‘1’”);  
> i2ccontroller\_check()
> 
> await\_completion(I2CCONTROLLER\_VVCT, 1, 2082\*C\_CLK\_PERIOD, “Await completion”);  
> – for cmd2

Hi Marius,

I think I see the issue now wrt the previous message sent. I removed the await\_completion for cmd 1 and just left 1 await completion at the end as follows and this worked ok 🙂

I will be checking the rest of my test code to fix the other issues seen. If any other problems will report back.

i2ccontroller\_write\_sda\_one\_byte() – cmd 1

await\_value(state\_out, “0110”, now, 57000 ns, “Waiting for WRITE\_SDA state to reach”);  
i2ccontroller\_check()  
i2ccontroller\_check()  
::  
i2ccontroller\_check()

–

i2ccontroller\_read\_sda\_one\_byte() – cmd 2

await\_value(rx\_buffer\_rdy, ‘1’, now, 199700 ns, “Waiting until rx\_buffer\_rdy = ‘1’”);  
i2ccontroller\_check()

await\_completion(I2CCONTROLLER\_VVCT, 1, 2082\*C\_CLK\_PERIOD, “Await completion”);  
– for cmd2

Regards,  
Kevin

---

<div class="post-metadata">

**Author:** ![KevNug](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KevNug](https://forum.uvvm.org/u/KevNug)\
**Post date:** [July 7, 2021, 3:00pm UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/5 "2021-07-07T15:00:07Z")

</div>

Hi Marius,

The 1st 2 commands are working fine:

|-----…  
|-----i2c\_command() – cmd 1  
|----- await\_value() – waiting from “now” and to 57000 ns  
|----- i2ccontroller\_check() - executes then 8 of these checks  
|----- :::  
|----- i2ccontroller\_check()  
|-----i2c\_command() – cmd 2  
|----- await\_value() – waiting from “now” and to 199700 ns  
|----- i2ccontroller\_check() - executes then 1 check  
|-----await\_completion() – waiting from “now” and to 208200 ns

Note: Just used 1 await\_completion() for cmds 1 & 2 above. So here the sequencer had 1 await\_completion() of the previous cmd1 & cmd2

The above i2c commands will be synchronized by:

- await\_value() for cmd 1
- await\_value() for cmd 2
- await\_completion() for cmd 2

* * *

I then execute within the same testbench:

|-----i2c\_command() – cmd 3  
|----- await\_value() – waiting from “now” and to 270000 ns  
|----- i2ccontroller\_check() - executes then 8 of these checks  
|----- :::  
|----- i2ccontroller\_check()  
|-----i2c\_command() – cmd 4  
|-----await\_completion() – waiting from “now” and to 5001300 ns

Note: Just used 1 await\_completion() for cmds 3 & 4 above. So here the sequencer had 1 await\_completion() of the previous cmd3 & cmd4

The above i2c commands will be synchronized by:

- await\_value() for cmd 3
- await\_completion() for cmd 4

but still see the following error wrt above cmd3 / cmd4 tests :

# UVVM: \*\*\* ERROR #1 \*\*\*

# UVVM: 263100 ns TB seq.

# UVVM: await\_value(slv x"6", 208200 ns, 270000 ns) =\> Failed. Condition occurred too early, after 54900 ns. ‘Waiting for WRITE\_SDA state to reach’

Same issue reported at the beginning of this ticket..

Wrt my previous message, the await\_value expects min\_time and max\_time parameters and not the number of clock cycles as you stated in your message. Please comment here.

Wrt your question:  
“Does your sequencer synchronize with all the commands, i.e. the sequencer has had an await\_completion() of the previous I2C command?”

Do we need to have an await\_completion() for each separate I2C command? I think the answer here is no. Please comment if I am wrong. The above sequence of commands were executed in the order listed.

Regards,  
Kevin

---

<div class="post-metadata">

**Author:** ![Marius](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.uvvm.org/marius/32/43_2.png) [@Marius](https://forum.uvvm.org/u/Marius)\
**Post date:** [July 8, 2021, 8:40am UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/6 "2021-07-08T08:40:15Z")

</div>

Hi Kevin,

You basically have two possible scenarios:

1A. issue a i2c VVC command  
1B. wait for the VVC command to finish execution  
1C. call the await\_value() procedure to check that the output changes value as expected after the VVC command has finished, i.e. DUT has received the message command and should perform some work and set an output.

2A. issue a i2c VVC command  
2B. call the await\_value() procedure to check that the output changes value.

In scenario 1 you know that the VVC has transmitted the command to the DUT and you expect an output change any time from time now and some clock cycles (depends on the time the DUT will need to update the output).

In scenario 2 you do not wait for the VVC to finish sending the command, so you will wait for the output to change from the time of the i2c command transfer starts and to some clock cycles needed by the DUT.

Note that await\_value() will return immediately if output = expected value when the procedure is called:

> Waits until the target signal equals the exp signal, or times out after max\_time.

Can you please check that your DUT output is not already set by any previous command?

Br.  
Marius

---

<div class="post-metadata">

**Author:** ![KevNug](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KevNug](https://forum.uvvm.org/u/KevNug)\
**Post date:** [July 8, 2021, 6:05pm UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/7 "2021-07-08T18:05:32Z")

</div>

Hi Marius,

Thanks for your reply.

I mainly use scenario2.

Had to add wait\_num\_rising\_edge() + wait\_until\_given\_time\_after\_rising\_edge() UVVM utils procedures to perform self checking tests at allocated certain times after eg I2C i2ccontroller\_write\_sda\_multiple\_bytes() VVC command was issued

eg

wait\_until\_given\_time\_after\_rising\_edge(in\_clk, xxx ns - now);

wait\_num\_rising\_edge(in\_clk,xx);

My self checking works fine now. Checks are performed at the right time. Had to review the simulation results and add the corresponding times as parameters to the eg above UVVM UTILS procedures.

ps  
“now” is pretty useful parameter to use. Could not see anything within UVVM documentation wrt using the “now” parameter. Please correct me if I am wrong here. Thanks for suggesting that 🙂

Best regards,

Kevin

---

<div class="post-metadata">

**Author:** ![Marius](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.uvvm.org/marius/32/43_2.png) [@Marius](https://forum.uvvm.org/u/Marius)\
**Post date:** [July 9, 2021, 8:01am UTC](https://forum.uvvm.org/t/await-value-utils-functionality-issue/215/8 "2021-07-09T08:01:07Z")

</div>

Hi Kevin,  
Glad to hear you fixed the simulations.  
The “now” keyword is a VHDL function that returns the current simulation time. It is often handy to use in checkers etc.

Br,  
Marius
