1
\$\begingroup\$

I have usually seen VHDL keyword null being used in the others part VHDL case blocks. However, it also sometimes appears in else part of if statements. Unlike Python that requires us to use the keyword pass, I don't think VHDL has any such requirements.

On the other hand, I heard someone tell me once that the reason he uses the keyword null in the else part of VHDL if blocks is to prevent warnings from synthesis tools. I am personally not sure what he was talking about.

Is it important to use keyword null in VHDL for synthesis although it seems redundant and does not do anything? When do we actually need it in modern VHDL?

\$\endgroup\$
3
  • \$\begingroup\$ TL/DR : Documentation. See stackoverflow.com/questions/42876613/null-statement-in-vhdl and electronics.stackexchange.com/questions/379822/… \$\endgroup\$
    – user16324
    Commented Aug 2, 2021 at 18:49
  • \$\begingroup\$ Simply an explicit way of describing "do nothing and I mean it". You don't need to use null in codes otherwise. \$\endgroup\$
    – Mitu Raj
    Commented Aug 2, 2021 at 18:51
  • \$\begingroup\$ It is VHDL's equivalent to, "This page intentionally left blank". This ensures that people who maintain the code in the future do not worry that something was accidentally deleted. \$\endgroup\$
    – Jim Lewis
    Commented Aug 2, 2021 at 19:03

1 Answer 1

4
\$\begingroup\$

I have been programming in VHDL for 12 years, and I have never found the use of null to be a requirement. There may be some older tools out there that require it, but I have yet to come across one.

null can be used to make your code more readable by explicitly stating that a certain condition doesn't do anything.

\$\endgroup\$

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.