Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

When is it nessasary to use the VHDL null statement?

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

Are there any cases when the use of a VHDL "NULL" statement is mandatory?
I.E - when not using it will result in the synthesis of different logic...
 

No.
You would only use null when you wanted nothing to happen. In synthesisable logic its mostly just used to explicitly show you want nothing to happen, but its not mandatory.

In testbenches, it is very useful though, as it is the default assignment of an access type.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Null statement is roughly equivalent to a book having, "This page intentionally left blank."

That said, when a case target has no other code, it is nice to put "NULL ; " there as then in the future, when someone else is working on the next revision of the design, they know that they did not accidentally delete something.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
it is nice to put "NULL ;"
Yes, I understand that. writing comments in your code is also nice...

Is it ever mandatory to use "null"? if it is, please post an example...
 

There are no cases for synthesisable VHDL where null is mandatory.

Can you post a code example that shows when it's necessary to use "null" in simulation?
 

About the only time you need it is when checking that an access type has been allocated memory or not:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
type my_access_t is access integer;
variable ptr : my_access_t;
 
.....
 
if ptr = null then
  ptr := new integer'(7);
end if;

 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top