VHDL Issue Number: 0039 Classification: Language Definition Problem Language Version: VHDL-87 Summary: The definitions of the attributes Last_Active, Last_Event, and Last_Value are contradicted by the exemplifying statements that follow their definitions. Related Issues: none Relevant LRM Sections: 14.1 Key Words and Phrases: predefined attributes Current Status: Aproved by the VASG 1076-1993 Disposition: Closed (All Issues Completely Addressed) Disposition Rationale: Section 14.1 was revised. Superseded By: N/A ----------------------- Date Submitted: Author of Submission: Ray Ryan Author's Affiliation: Vantage Analysis Systems, Inc. Author's Post Address: Author's Phone Number: (415) 659 0901 Author's Fax Number: Author's Net Address: Alec@Sierra.Stanford.edu ----------------------- Date Analyzed: 1988/11/30 Author of Analysis: A. G. Stanculescu Revision Number: $Revision: 1.8 $ Date Last Revised: $Date: 1995/05/13 19:34:42 $ Description of Problem ---------------------- The descriptions of S'LAST_EVENT, S'LAST_ACTIVE and S'LAST_VALUE are confusing. The following discussion describes the problem and a suggested resolution for S'LAST_EVENT and S'LAST_VALUE. The difficulty with S'LAST_ACTIVE is analogous to S'LAST_EVENT (ie replace EVENT by ACTIVE, and STABLE by QUIET). Notes: i) This discussion in part assumes S'EVENT and S'ACTIVE are initially FALSE. ii) Lines in the LRM that are incorrect are prefixed by '>'. S'LAST_EVENT Kind: Function Prefix: Any signal denoted by the static signal name S. Result Type: Type Time. Result: The amount of time that has elapsed since the last event occurred on signal S. Specifically: > For a scalar signal S, S'LAST_EVENT returns the largest value T of > type Time for which S'DELAYED(T)'STABLE would return TRUE, if such > a value for T exists; otherwise it returns Ons. For a composite signal S, S'LAST_EVENT returns the minimum of the values R'LAST_EVENT for every scalar subelement R of S. For the section marked by '>'s consider the following VHDL excerpt: Signal S : BOOLEAN; :: process begin S <= FALSE after 0ns, TRUE after 10ns; wait for 20ns; T := S'LAST_EVENT; wait; end process; The value of T (The amount of time that has elapsed since the last event) should be 10ns (which is currently the value of T in an Analyst simulation). However, consider the value of S'DELAYED(10ns)'STABLE. The implicit signal S'DELAYED(10ns) has an event occuring at Time 20ns. Since this is the same simulation cycle that the STABLE attribute is computed (based on the above example) the value of S'DELAYED(10ns)'STABLE would be FALSE. The "largest value T of type TIME for which S'DELAYED(T)'STABLE would return TRUE turns out to be 10ns-1fs (since 1fs is the resolution limit for TIME). Further consider modifing the above example as follows: Signal S : BOOLEAN; :: process begin S <= FALSE after 0ns, TRUE after 10ns; wait for 20ns; wait for 0ns; T := S'LAST_EVENT; assert (S'DELAYED(15ns)'STABLE) report "S'DELAYED(15ns)'STABLE is FALSE"; wait; end process; In this case S'DELAYED(T)'STABLE (if evaluated in the simulation cycles that the value of S'LAST_EVENT is accessed) would be TRUE for ANY value of T. This evaluation is occuring in the second delta at time 20ns. An implicit delayed signal must transition in the first delta of a time value. The value of S'STABLE(0ns) is FALSE only if S has changed in the same simulation cycle. Lastly, there is no discussion of the value of S'LAST_EVENT in the case where the signal S has never been changed from its initial value. S'LAST_VALUE Kind: Function Prefix: Any signal denoted by the static signal name S. Result Type: The base type of S. Result: The previous value of S, immediately before the last change of S. Specifically: > For a scalar signal s, S'LAST_VALUE = S'DELAYED(T) where > T >= Ons is the smallest value such that S'STABLE(T) is FALSE. > If no such T exists, then S'LAST_VALUE is equal to S. For a composite signal S, S'LAST_VALUE is equal to the aggregate of the previous values of each element of S. (Note that: (1) if S'STABLE(T) is FALSE, then by definition, for some t where Ons <= t <= T, S'DELAYED(t)/=S; and (2) if Ts is the smallest value such that S'STABLE(Ts) is FALSE, then for all t where Ons <=t's consider the following VHDL excerpt: Type atoh is ( a, b, c, d, e, f, g, h ); Signal S : atoh := a; :: process Variable last1, last2, last3 : atoh; begin S <= b after 5ns, c after 10ns; wait for 20ns; S <= d after 0ns; wait for 0ns; S <= e after 0ns; wait for 0ns; -- test delta 1 last1 := S'LAST_VALUE; wait for 0ns; -- test delta 2 last2 := S'LAST_VALUE; wait for 0ns; S <= f after 0ns; wait for 0ns; -- test delta 3 last3 := S'LAST_VALUE; wait; end process; If the value of a signal is updated on different deltas of the same time point, the value of the attribute S'LAST_VALUE becomes: a) if S changed in the current simulation cycle then S'LAST_VALUE is the value of S in the preceeding delta, even of the same time value, ( test delta 1,3 in the example ). b) if S has changed on some delta of the current time value, but not in the current simulation cycle then S'LAST_VALUE is the value of S just before (1fs before) the current time - which may not be the "last" value on S. This is because S'STABLE(0ns) is TRUE if S has not change on the current simulation cycle (test delta 2 ). The result is that with this description S'LAST_VALUE has two undesirable characteristics: 1) S'LAST_VALUE does not always yield the "last" value to appear on S. 2) S'LAST_VALUE can change values when S does not. (test delta 2) Proposed Resolution ------------------- Possibly better descriptions might be: S'LAST_EVENT Kind: Function Prefix: Any signal denoted by the static signal name S. Result Type: Type Time. Result: The amount of time that has elapsed since the last event occurred on signal S. Specifically: For a scalar signal S, S'LAST_EVENT returns the largest value T of type Time for which S'STABLE(T) is TRUE, if such a value for T exists; otherwise it returns Ons. If the S'STABLE(T) is TRUE for all non-negative values of T (No events have occured on S) then S'LAST_EVENT returns the value TIME'HIGH. For a composite signal S, S'LAST_EVENT returns the minimum of the values R'LAST_EVENT for every scalar subelement R of S. S'LAST_VALUE Kind: Function Prefix: Any signal denoted by the static signal name S. Result Type: The base type of S. Result: The previous value of S, immediately before the last change of S. Specifically: For a scalar signal s, S'LAST_VALUE = S'DELAYED(T) where T = S'LAST_EVENT. For a composite signal S, S'LAST_VALUE is equal to the aggregate of the previous values of each element of S. > VASG-ISAC Analysis & Rationale ------------------------------ The definition of S'LAST_EVENT is clearly the amount of time that has elapsed since the last event occured on signal S. The statement following this definition is considered an exemplifying statement and therefore not part of the standard IEEE 1076. As currently presented in the LRM, the exemplifying statement is wrong, because depending in which delta of a timepoint one inquires about the value of the attribute LAST_EVENT, one gets different answers: always 0 ns if the inquireing is not made in the first delta of the timepoint and the expected value minus 1 fs if the inquireing is made in the first delta of a timepoint. LAST_ACTIVE is indeed similar to LAST_EVENT. The definition of S'LAST_VALUE is clearly the last value the signal had before the current one. Speciffically, the value the signal had in the previous delta if there is a previous delta and if such a value is different from the current one. The proposed resolutions would fix the problems described above. VASG-ISAC Recommendation for IEEE Std 1076-1987 ----------------------------------------------- The definition of the attributes should stand as they currently are. The exemplifying statements that follow the definitions should be regarded as incorrect. VASG-ISAC Recommendation for Future Revisions --------------------------------------------- The definition of the attributes should stand as they currently are. The exemplifying statements that follow the definitions should be modified as suggested in the proposed resolution. =================