modefied statemachin at gmii_rec.v