set_user_flag & write output in each cycle