Phases of N = 1 supersymmetric SO / Sp gauge theories via matrix model