VHDL Issue Number: 2032 Language_Version: VHDL-2002 Classification: Language Definition Problem Summary: Function "now" is not pure Relevant_LRM_Sections: 7.4.2 Globally static primaries 14.2 Package STANDARD Related_Issues: Key_Words_and_Phrases: Authors_Name: Chuck Swart Authors_Phone_Number: 503.685.0846 Authors_Fax_Number: 503.685.0921 Authors_Email_Address: cswart@model.com Authors_Affiliation: Model Technology Authors_Address1: 8005 SW Boeckman Road Authors_Address2: Wilsonville, OR 97070 Authors_Address3: Current Status: VASG-Approved Superseded By: ------------------------ Date Submitted: 25 November 2003 Date Analyzed: 29 July 2004 Author of Analysis: Ajayharsh Varikat Revision Number: 0.3 Date Last Revised: 20 July 2005 Description of Problem ---------------------- Declaring NOW to be pure is a technical mistake. 1. According to the rules for globally static expressions, expressions involving NOW can be globally static since "An expression is said to be globally static if and only if every operator in the expression denotes a pure function and every primary in the expression is a globally static primary...and is one of the following: i) A function call whose function name denotes a pure function and whose actual parameters are each globally static expressions" Obviously,expressions involving now can compute different values at different simulation times. So claiming that NOW is pure breaks the notion of staticness. 2. Some optimizations can be performed as early as analysis time if functions are known to be pure. If NOW is considered pure, these optimizations become much more difficult, since they can only be done with knowledge of the bodies of all functions to insure that no calls to NOW occur, either directly or indirectly. 3. Historically, the declaration of NOW to be pure caused problems for VITAL. However, VITAL 2000 has correctly resolved these issues, and, in fact, their glitch handling depends on NOW being impure (their code takes different actions for time 0 than for positive time values). Proposed Resolution ------------------- Declare NOW to be impure, as it was in VHDL-93 VASG-ISAC Analysis & Rationale ------------------------------ In VHDL-93, a pure function returns the same value every time it is called with a given set of globally static expressions as it's input parameters. Calling NOW a pure function changes this. The definition of a globally static expression is affected by this change in the behavior of pure functions. Defining NOW as a pure function permits a globally static expression to have different values at different points of simulation. This conflicts with the normally accepted meaning of staticness, and makes the new definitions of pure functions and staticness useless for many kinds of optimizations that simulators do. Functions in the VITAL 2000 package that call NOW have been declared as impure, so this is no longer an issue for VITAL. On the other hand, changing NOW back to an impure function can impact user functions that were written based on the VHDL 2002 standard. However, the ISAC members feel that the penetration of this VHDL 2002 feature within the user community is very low, and hence there is little likelyhood of code compatibility issues coming up if we were to revert to the earlier definition. VASG-ISAC Recommendation for IEEE Std 1076-2002 ----------------------------------------------- Deprecated in IEEE Std 1076-2002. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- Revert to the VHDL-93 definition of NOW.