This second implementation adds a check for '0' to '1' transitions on clk by using the 'LASTVALUE attribute on the signal clk.