1
\$\begingroup\$

Is there a difference between these two SystemVerilog function declarations? Does the "input" keyword change any functionality? I've seen it both ways in examples.

function int addition (input int a, b);
 return a + b;
endfunction
function int addition (int a, b);
 return a + b;
endfunction
toolic
10.8k11 gold badges31 silver badges35 bronze badges
asked May 2, 2022 at 15:47
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

There is no difference between the two functions. In your code, the input keyword is optional. Refer to IEEE Std 1800-2017, section 13.4 Functions:

Function declarations default to the formal direction input if no direction has been specified. Once a direction is given, subsequent formals default to the same direction.

answered May 2, 2022 at 15:56
\$\endgroup\$
0

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.