EXHIBIT 5.1 OPINION OF COUNSEL March 19, 1999 Cardima, Inc. 47266 Benicia Street Fremont, CA 94538 Re: Cardima, Inc. (the "Company") Registration Statement on Form S-3 Ladies and Gentlemen: We have examined the Registration Statement on Form S-3 to be filed with the Securities and Exchange Commission (the "Registration Statement"), in connection with the registration under the Securities Act of 1933, as amended, of 8,604,806 shares of the Company's Common Stock. As your counsel, we have examined the proceedings taken in connection with the sale and issuance of the above-referenced securities. It is our opinion that the above-referenced securities, when issued and sold in the manner referred to in the Registration Statement, will be legally and validly issued, fully paid and nonassessable. We consent to the use of this opinion as an exhibit to the Registration Statement, and further consent to the use of our name wherever appearing in the Registration Statement, including the Prospectus constituting a part thereof, and any amendment thereto. Very truly yours, WILSON, SONSINI, GOODRICH & ROSATI Professional Corporation /s/ WILSON SONSINI GOODRICH & ROSATI