0
\$\begingroup\$

I want to ask what is the order of procedure call in VHDL.

Below I have VHDL code showing a procedure called 'IncrementWrap' and a process which calls the procedure multiple times.

I got the code form a Youtube video and of course have not run it myself, but will this code even execute?

When the Tick value is = clock_frequency-1 just before the rising edge, the tick value gets reset back to 0 as shown by the procedure. But what about the conditional check beneath it? Will that also be evaluated? And the procedure 'IncrementWrap' called but for seconds?

Is the procedure and the conditional check beneath it evaluated in parallel?

enter image description here

Mitu Raj
11k6 gold badges25 silver badges49 bronze badges
asked Aug 13, 2021 at 3:32
\$\endgroup\$
0

2 Answers 2

1
\$\begingroup\$

Looks like you are not aware of when a signal is updated inside a clocked process in VHDL.

In your code, the procedure IncrementWrap () will execute and update the respective signals if the preceding condition is true, and the update is not 'immediate'. The signals are updated after a delta delay by the simulator, i.e., the signals are scheduled to be updated only at the end of the execution of process (Clk) at the rising edge of Clk.

When the Tick value is = clock_frequency-1 just before the rising edge, the tick value gets reset back to 0 as shown by the procedure. But what about the conditional check beneath it?

Since the if condition goes true at the rising edge of Clk, Ticks is scheduled to be updated to 0 by the IncrementWrap() only at the end of process (Clk) execution. Hence, Ticks would still be ClockFrequencyHz-1 for the below statements to evaluate, for the current rising edge of Clk.

answered Aug 13, 2021 at 4:32
\$\endgroup\$
0
\$\begingroup\$

The effect of a sequential signal assignment in VHDL is not visible until the process ends. Procedures are irrelevant to this rule and behave as any other code in a process (the end of a procedure does not make any sequential effects become visible).

So, yes, your conditional will be hit even though the preceding procedure call sets the variable to 0.

answered Aug 13, 2021 at 4:29
\$\endgroup\$
1
  • \$\begingroup\$ Until the process ends, or reaches a "wait". \$\endgroup\$ Commented Aug 13, 2021 at 16:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.