We demonstrate a compact, single-chip 40-channel, dense wavelength division multiplexing (DWDM) variable attenuator multi/demultiplexer (VMUX/DEMUX) by monolithic integration of an echelle grating and high-speed p-i-n VOA on the silicon-on-insulator (SOI) platform. The demonstrated device has a flat-top filter shape, on chip loss of 5.0 dB, low PDL of 0.3 dB after compensation of the polarization dependent frequency (PDF) shift, a fast attenuation response speed of 3 MHz, and an area of only 25 mm by 10 mm.