NEW YORK (AP) _ Mentor Graphics Corp. ended its bitter five-month takeover battle for Quickturn Design Systems Inc. today, clearing the way for Quickturn to be sold to its white-knight bidder Cadence Design Systems Inc. for $271.3 million.

Mentor Graphics withdrew its $15 a share offer for Quickturn and canceled the special shareholders' meeting scheduled today after it became clear Mentor didn't have enough support to oust Quickturn's board of directors.

Mentor Graphics and Cadence both make computer software to design chips for the electronic and semiconductor industries. The two companies wanted to buy Quickturn because it makes the software that lets companies test the chip designs before putting them into finished products.

Mentor Graphics competes in Quickturn's business overseas, but has been prevented from going head-to-head with Quickturn in the United States because of a patent dispute, which is currently being resolved through the courts.

Mentor Graphics, which first offered $12.12 1/2 a share for Quickturn in August, and later tried increasing its price three times and filed two lawsuits against Quickturn, but to no avail.

In December, San Jose, Calif.-based Quickturn said it had agreed to be acquired by Cadence for $14 a share. Mentor and Cadence entered a brief bidding war, but Cadence, which is based San Diego, Calif., always had the support of Quickturn management.

Quickturn's stock fell 56 1/4 cents to $14.37 1/2 on the Nasdaq Stock Market, where Mentor Graphics' shares rose 37 1/2 cents to $10.37 1/2. On the New York Stock Exchange, Cadence's shares rose 31 1/4 cents to $30.31 1/4.