Subject: Re: 'EVENT attribute.
From: Dale E Martin (dmartin@cliftonlabs.com)
Date: Thu Apr 19 2001 - 14:51:52 MDT
Hi - I'm Ccing DJ's reply about this to the list at large.
-- Dale E. Martin, Clifton Labs, Inc. Senior Computer Engineer dmartin@cliftonlabs.com http://www.cliftonlabs.com pgp key available
attached mail follows:
Hello,
> > Hi! > > In the next code cc<=cc+1 in the line 16 > never will be done because the > CK'event newer will be occured. Why? > CK assign have been done before ck'event checking. >
As defined in the VHDL'93 LRM (Language Reference Manual) (Page 187):
"For a Scalar Signal S, S'EVENT returns the value TRUE if an event has occured on S during the current simulation cycle; otherwise, it return the value FALSE"
In your example, the signal assignment "ck <= not ck;" does not involve any delays and a implicit "after 0 ns" delay is assumed (as per the LRM). Hence, the signal assignment occurs during the next delta cycle and "CK'EVENT" will return TRUE during the next delta cycle. However, the process "clock" has a wait clause of "1 us" and is not sensitive to CK. Consequently the next time the process is executed "CK'EVENT" will be FALSE because there are no events on "CK" in that simulation cycle.
There are several ways you could modify your source. I tried doing this one, and it worked:
ck <= not ck after 1 us;
hope this helped.
thanks
with regards -DJ
> > ---------------------- CUT HERE -------------------- > library std; > use std.textio.all; > > entity ts7 is > end ts7; > > architecture behav of ts7 is > signal CK : bit := '0'; -- clock > signal s1, cc : integer := 0; > begin > -- clock processing > clock : process > begin > ck <= not ck; > if (CK'event and CK = '1') then -- CK'event newer will be occured! > cc <= cc + 1; -- clock counter > end if; > wait for 1 us; > end process; > -- output > output : process (CK) > file RESULT_FILE : text open write_mode is "../ts7.out"; > variable myout : line; > begin > s1 <= s1 + 1; > write (myout, cc); write (myout, '_'); write (myout, s1); > writeLine (RESULT_FILE, myout); > end process; > end behav;
This archive was generated by hypermail 2b25 : Mon Mar 18 2002 - 13:00:01 MST