Different doping levels in different parts of PN junction to produce shaped depletion layer