Automatic design of NxN integrated Benes optical switch