I thought that only standing units contribute wings.
In the case that both sides have only routed units left. I think that the attacker has to retreat and the defender wins....
routed units dont add morale but the dice still do. after the initial roll the dice are basically separate from the units. they change so much during the 3 rounds that you cant say anymore where each die came from.