Array-waveguide grating (AWG) is a kind of passive wavelength router. It can perform nonblocking switching functions in conjunction with tunable wavelength converters (TWCs). For optical switching systems with large number of ports, however, the scalability of the AWG is restricted by coherent crosstalk. In this paper, we propose a modular method of designing arrays of AWGs for large-scale switching systems, in which a contention-free connection from an idle input to an idle output can always be established regardless of the number of existing connections in progress. The construction process of AWG networks is sometimes called AWG function decomposition. For the decomposition of an N × N AWG, we describe the modular architecture of a functionally equivalent three-stage network of smaller AWGs, and derive the necessary and sufficient conditions on the number of smaller AWG modules needed for nonblocking switching. Our results can be applied to the decomposition of any AWG components employed in an AWG-based switching network to suppress the coherent crosstalk.