Is there a way to cast a constant value into a signal in order to send it into a function's parameter ?

Let's say I have this function:

Function mylogic(signal a, b, c : std_logic) return std_logic is
    return ((not a) and (not b) and c);
End Function;

And I would like to call it this way:

... mylogic('0',a(3),a(4))...

I cannot send '0' as a parameter because the function expects a signal, is there any way to have it work without declaring another signal to hold the value '0' ?


1 Answer 1


Just make the formal parameters constants (i.e. delete the word signal in the function declaration).

You're not driving them within the function anyway. (If you are, it isn't a function)

Then, when you call the function, the current value of each signal is passed as a constant to the function.

This won't work if your function uses the signal's attributes (such as 'event or 'stable, but 'length etc which aren't specific to signals would be OK). If you DO need signal-specific attributes you'll need to add a signal anyway.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.