<PAGE>   1
                                                                EXHIBIT 10.4(b)



                               ALTERA CORPORATION

                        1987 EMPLOYEE STOCK PURCHASE PLAN

                            (As amended May 1, 2001)


        The following constitute the provisions of the 1987 Employee Stock
Purchase Plan of Altera Corporation.

        1. Purpose. The purpose of the Plan is to provide employees of the
Company and its Designated Subsidiaries with an opportunity to purchase Common
Stock of the Company through accumulated payroll deductions. It is the intention
of the Company to have the Plan qualify as an "Employee Stock Purchase Plan"
under Section 423 of the Internal Revenue Code of 1986, as amended. The
provisions of the Plan shall, accordingly, be construed so as to extend and
limit participation in a manner consistent with the requirements of that section
of the Code.

        2. Definitions.

           (a) "Board" shall mean the Board of Directors of the Company.

           (b) "Code" shall mean the Internal Revenue Code of 1986, as amended.

           (c) "Common Stock" shall mean the Common Stock, $0.001 par value, of
the Company.

           (d) "Company" shall mean Altera Corporation, a Delaware corporation.

           (e) "Compensation" shall mean all regular straight-time gross
earnings, plus sales commissions and sales incentives, but exclusive of payments
for overtime, shift premium, other incentive compensation, other incentive
payments, bonuses, or other compensation.

           (f) "Continuous Status as an Employee" shall mean the absence of any
interruption or termination of service as an Employee. Continuous Status as an
Employee shall not be considered interrupted in the case of a leave of absence
agreed to in writing by the Company, provided that such leave is for a period of
not more than ninety (90) days or reemployment upon the expiration of such leave
is guaranteed by contract or statute.

           (g) "Designated Subsidiaries" shall mean the Subsidiaries which have
been designated by the Board from time to time in its sole discretion as
eligible to participate in the Plan.



                                       1
<PAGE>   2

           (h) "Employee" shall mean any person, including an officer, who is
customarily employed for at least twenty (20) hours per week and more than five
(5) months in a calendar year by the Company or one of its Designated
Subsidiaries.

           (i) "Exercise Date" shall mean the last day of each offering period
of the Plan.

           (j) "Offering Date" shall mean the first day of each offering period
of the Plan.

           (k) "Plan" shall mean this Employee Stock Purchase Plan.

           (l) "Subsidiary" shall mean a corporation, domestic or foreign, of
which not less than fifty percent (50%) of the voting shares are held by the
Company or a Subsidiary, whether or not such corporation now exists or is
hereafter organized or acquired by the Company or a Subsidiary.

        3. Eligibility.

           (a) Any person who is an Employee as of the Offering Date of a given
offering period shall be eligible to participate in such offering period under
the Plan, subject to the requirements of paragraph 5(a) and the limitations
imposed by Section 423(b) of the Code.

           (b) Any provisions of the Plan to the contrary notwithstanding, no
Employee shall be granted an option under the Plan (i) if, immediately after the
grant, such Employee (or any other person whose stock would be attributed to
such Employee pursuant to Section 425(d) of the Code) would own stock and/or
hold outstanding options to purchase stock possessing five percent (5%) or more
of the total combined voting power or value of all classes of stock of the
Company or of any subsidiary of the Company; or (ii) which permits his rights to
purchase stock under all employee stock purchase plans (described in Section 423
of the Code) of the Company and its subsidiaries to accrue at a rate which
exceeds Twenty-five Thousand Dollars ($25,000) of fair market value of such
stock (determined at the time such option is granted) for each calendar year in
which such option is outstanding at any time.

        4. Offering Periods. The Plan shall be implemented by one offering
during each six- (6) month period of the Plan, commencing on or about August 16,
1988, and continuing thereafter until terminated in accordance with paragraph 19
hereof. The Board shall have the power to change the duration of offering
periods with respect to future offerings without shareholder approval if such
change is announced at least fifteen (15) days prior to the scheduled beginning
of the first offering period to be affected.

        5. Participation.

           (a) An eligible Employee may become a participant in the Plan by
completing a subscription agreement authorizing payroll deduction, on the form
provided by the Company, and filing it with the Company's payroll office prior
to the applicable Offering Date, unless a later



                                       2
<PAGE>   3

time for filing the subscription agreement is set by the Board for all eligible
Employees with respect to a given offering.

           (b) Payroll deductions for a participant shall commence on the first
payroll following the Offering Date and shall end on the Exercise Date of the
offering to which such authorization is applicable, unless sooner terminated by
the participant as provided in paragraph 6(c) or 10.

        6. Payroll Deductions.

           (a) At the time a participant files his subscription agreement, he
shall elect to have payroll deductions made on each payday during the offering
period in an amount not exceeding ten percent (10%) of the Compensation which he
receives on such payday, and the aggregate of such payroll deductions during the
offering period shall not exceed ten percent (10%) of his aggregate Compensation
during said offering period.

           (b) All payroll deductions made by a participant shall be credited to
his account under the Plan. A participant may not make any additional payments
into such account.

           (c) A participant may discontinue his participation in the Plan as
provided in paragraph 10. A participant may also lower to zero, but not
thereafter increase, the rate of his payroll deductions during the offering
period by notifying the Company in writing. The decrease shall be effective
fifteen (15) days following the Company's receipt of the notification. Should an
eligible Employee decided to again participate in the Plan for future offering
periods, he must complete and file with the Company a new authorization for
payroll deduction.

        7. Grant of Option.

           (a) On the Offering Date of each offering period, each eligible
Employee participating in the Plan shall be granted an option to purchase (at
the per-share option price) up to a number of shares of the Company's Common
Stock determined by dividing such Employee's payroll deductions accumulated
during such offering period (not to exceed an amount equal to ten percent (10%)
of his Compensation during the applicable offering period) by the option price
as defined in Section 7(b) herein, subject to the limitations set forth in
Sections 3(b) and 12 hereof, and provided, however, that in no event shall such
option be exercisable for a number of shares in excess of Twelve Thousand Five
Hundred Dollars ($12,500) divided by eighty-five percent (85%) of the fair
market value of a share of the Company's Common Stock on the Offering Date. Fair
market value of a share of the Company's Common Stock shall be determined as
provided in Section 7(b) herein.

           (b) The option price per share of the shares offered in a given
offering period shall be the lower of: (i) eighty-five percent (85%) of the fair
market value of a share of the Common Stock of the Company on the Offering Date;
or (ii) eighty-five percent (85%) of the fair market value of a share of the
Common Stock of the Company on the Exercise Date. The fair market value of the
Company's Common Stock on a given date shall be determined by the Board



                                       3
<PAGE>   4

in its discretion; provided, however, that where there is a public market for
the Common Stock, the fair market value per share shall be the mean of the bid
and asked prices of the Common Stock for such date, as reported in The Wall
Street Journal (or, if not so reported, as otherwise reported by the National
Association of Securities Dealers Automated Quotation (NASDAQ) System) or, in
the event the Common Stock is listed on a stock exchange, the fair market value
per share shall be the closing price on such exchange on such date, as reported
in The Wall Street Journal.

        8. Exercise of Option. Unless a participant withdraws from the Plan as
provided in paragraph 10, his option for the purchase of shares will be
exercised automatically on the Exercise Date of the offering period, and the
maximum number of full shares subject to option will be purchased for him at the
applicable option price with the accumulated payroll deductions in his account.
The shares purchased upon exercise of an option hereunder shall be deemed to be
transferred to the participant on the Exercise Date. During his lifetime, a
participant's option to purchase shares hereunder is exercisable only by him.

        9. Delivery. As promptly as practicable after the Exercise Date of each
offering period, the Company shall arrange the delivery to each participant, as
appropriate, of a certificate representing the shares purchased upon exercise of
his option. Any cash remaining to the credit of a participant's account under
the Plan at the termination of each offering period which is insufficient to
purchase a full share of Common Stock of the Company shall be credited to the
participant's account for the next offering period, thereby reducing the maximum
amount which may be withheld from Compensation during such next offering period
if it would otherwise exceed the limits set forth in paragraphs 3(b) or 6(a),
or, if requested by the participant or if the participant has elected not to
participate for such following period, shall be returned to said participant.

        10. Withdrawal; Termination of Employment.

            (a) A participant may withdraw all, but not less than all, the
payroll deductions credited to his account under the Plan at any time prior to
the Exercise Date of the offering period by giving written notice to the
Company. All of the participant's payroll deductions credited to his account
will be paid to him promptly after receipt of his notice of withdrawal, and his
option for the current period will be automatically terminated, and no further
payroll deductions for the purchase of shares will be made during the offering
period.

            (b) Upon termination of the participant's Continuous Status as an
Employee prior to the Exercise Date of the offering period for any reason,
including retirement or death, the payroll deductions credited to his account
will be returned to him or, in the case of his death, to the person or persons
entitled thereto under paragraph 14, and his option will be automatically
terminated.

            (c) In the event an Employee fails to remain in Continuous Status as
an Employee of the Company for at least twenty (20) hours per week during the
offering period in which the employee is a participant, he will be deemed to
have elected to withdraw from the



                                       4
<PAGE>   5

Plan, and the payroll deductions credited to his account will be returned to him
and his option terminated.

            (d) A participant's withdrawal from an offering will not have any
effect upon his eligibility to participate in a succeeding offering or in any
similar plan which may hereafter be adopted by the Company.

        11. Interest. No interest shall accrue on the payroll deductions of a
participant in the Plan.

        12. Stock.

            (a) The maximum number of shares of the Company's Common Stock which
shall be made available for sale under the Plan shall be fourteen million two
hundred thousand (14,200,000) shares, subject to adjustment upon changes in
capitalization of the Company as provided in paragraph 18. If the total number
of shares which would otherwise be subject to options granted pursuant to
Section 7(a) hereof on the Offering Date of an offering period exceeds the
number of shares then available under the Plan (after deduction of all shares
for which options have been exercised or are then outstanding), the Company
shall make a pro rata allocation of the shares remaining available for option
grant in as uniform a manner as shall be practicable and as it shall determine
to be equitable. In such event, the Company shall give written notice of such
reduction of the number of shares subject to the option to each Employee
affected thereby, and shall similarly reduce the rate of payroll deductions, if
necessary.

            (b) The participant will have no interest or voting right in shares
covered by his option until such option has been exercised.

            (c) Shares to be delivered to a participant under the Plan will be
registered in the name of the participant or in the name of the participant and
his spouse.

        13. Administration. The Plan shall be administered by the Board of the
Company or a committee of members of the Board appointed by the Board. The
administration, interpretation or application of the Plan by the Board or its
committee shall be final, conclusive and binding upon all participants. Members
of the Board who are eligible Employees are permitted to participate in the
Plan, provided that:

            (a) Members of the Board who are eligible to participate in the Plan
may not vote on any matter affecting the administration of the Plan or the grant
of any option pursuant to the Plan.

            (b) If a committee is established to administer the Plan, no member
of the Board who is eligible to participate in the Plan may be a member of the
committee.



                                       5
<PAGE>   6

        14. Designation of Beneficiary.

            (a) A participant may file a written designation of a beneficiary
who is to receive any shares and cash, if any, from the participant's account
under the Plan in the event of such participant's death subsequent to the end of
the offering period but prior to delivery to him of such shares and cash. In
addition, a participant may file a written designation of a beneficiary who is
to receive any cash from the participant's account under the Plan in the event
of such participant's death prior to the Exercise Date of the offering period.

            (b) Such designation of beneficiary may be changed by the
participant at any time by written notice. In the event of the death of a
participant, and in the absence of a beneficiary validly designated under the
Plan who is living at the time of such participant's death, the Company shall
deliver such shares and/or cash to the executor or administrator of the estate
of the participant; or, if no such executor or administrator has been appointed
(to the knowledge of the Company), the Company, in its discretion, may deliver
such shares and/or cash to the spouse or to any one or more dependents or
relatives of the participant; or, if no spouse, dependent or relative is known
to the Company, then to such other person as the Company may designate.

        15. Transferability. Neither payroll deductions credited to a
participant's account nor any rights, with regard to the exercise of an option
or to receive shares under the Plan, may be assigned, transferred, pledged or
otherwise disposed of in any way (other than by will, the laws of descent and
distribution or as provided in paragraph 14 hereof) by the participant. Any such
attempt at assignment, transfer, pledge or other disposition shall be without
effect, except that the Company may treat such act as an election to withdraw
funds in accordance with paragraph 10.

        16. Use of Funds. All payroll deductions received or held by the Company
under the Plan may be used by the Company for any corporate purpose, and the
Company shall not be obligated to segregate such payroll deductions.

        17. Reports. Individual accounts will be maintained for each participant
in the Plan. Statements of account will be given to participating Employees
promptly following the Exercise Date, which statements will set forth the
amounts of payroll deductions, the per share purchase price, the number of
shares purchased and the remaining cash balance, if any.

        18. Adjustments Upon Changes in Capitalization. Subject to any required
action by the shareholders of the Company, the number of shares of Common Stock
covered by each option under the Plan which has not yet been exercised and the
number of shares of Common Stock which have been authorized for issuance under
the Plan but have not yet been placed under option (collectively, the
"Reserves"), as well as the price per share of Common Stock covered by each
option under the Plan which has not yet been exercised, shall be proportionately
adjusted for any increase or decrease in the number of issued shares of Common
Stock resulting from a stock split, reverse stock split, stock dividend,
combination or reclassification of the Common Stock, or any other increase or
decrease in the number of shares of Common Stock effected without receipt of
consideration by the Company; provided, however, that conversion of any
convertible



                                       6
<PAGE>   7

securities of the Company shall not be deemed to have been "effected without
receipt of consideration." Such adjustment shall be made by the Board, whose
determination in that respect shall be final, binding and conclusive. Except as
expressly provided herein, no issue by the Company of shares of stock of any
class, or securities convertible into shares of stock of any class, shall
affect, and no adjustment by reason thereof shall be made with respect to, the
number or price of shares of Common Stock subject to an option.

        In the event of the proposed dissolution or liquidation of the Company,
the offering period will terminate immediately prior to the consummation of such
proposed action, unless otherwise provided by the Board. In the event of a
proposed sale of all or substantially all of the assets of the Company, or the
merger of the Company with or into another corporation, each option under the
Plan shall be assumed or an equivalent option shall be substituted by such
successor corporation or a parent or subsidiary of such successor corporation,
unless the Board determines, in the exercise of its sole discretion and in lieu
of such assumption or substitution, that the participant shall have the right to
exercise the option as to all of the optioned stock, including shares as to
which the option would not otherwise be exercisable. If the Board makes an
option fully exercisable in lieu of assumption or substitution in the event of a
merger or sale of assets, the Board shall notify the participant that the option
shall be fully exercisable for a period of fifteen (15) days from the date of
such notice, and the option will terminate upon the expiration of such period.

        The Board may, if it so determines in the exercise of its sole
discretion, also make provision for adjusting the Reserves, as well as the price
per share of Common Stock covered by each outstanding option, in the event that
the Company effects one or more reorganizations, recapitalizations, rights
offerings or other increases or reductions of shares of its outstanding Common
Stock, and in the event of the Company being consolidated with or merged into
any other corporation.

        19. Amendment or Termination. The Board may at any time terminate or
amend the Plan. Except as provided in paragraph 18, no such termination can
affect options previously granted, nor may an amendment make any change in any
option theretofore granted which adversely affects the rights of any
participant, nor may an amendment be made without prior approval of the
shareholders of the Company (obtained in the manner described in paragraph 21)
if such amendment would:

            (a) Increase the number of shares that may be issued under the Plan;

            (b) Permit payroll deductions at a rate in excess of ten percent
(10%) of the participant's Compensation;

            (c) Change the designation of the employees (or class of employees)
eligible for participation in the Plan; or



                                       7
<PAGE>   8

            (d) If the Company has a class of equity securities registered under
Section 12 of the Securities Exchange Act of 1934, as amended (the "Exchange
Act") at the time of such amendment, materially increase the benefits which may
accrue to participants under the Plan.

        If any amendment requiring shareholder approval under this paragraph 19
of the Plan is made subsequent to the first registration of any class of equity
securities by the Company under Section 12 of the Exchange Act, such shareholder
approval shall be solicited as described in paragraph 21 of the Plan.

        20. Notices. All notices or other communications by a participant to the
Company under or in connection with the Plan shall be deemed to have been duly
given when received in the form specified by the Company at the location, or by
the person, designated by the Company for the receipt thereof.

        21. Shareholder Approval.

            (a) Continuance of the Plan shall be subject to approval by the
shareholders of the Company within twelve (12) months before or after the date
the Plan is adopted. If such shareholder approval is obtained at a duly held
shareholders' meeting, it must be obtained by the affirmative vote of the
holders of a majority of the outstanding shares of the Company, or if such
shareholder approval is obtained by written consent, it must be obtained by the
unanimous written consent of all shareholders of the Company; provided, however,
that approval at a meeting or by written consent may be obtained by a lesser
degree of shareholder approval if the Board determines, in its discretion after
consultation with the Company's legal counsel, that such a lesser degree of
shareholder approval will comply with all applicable laws and will not adversely
affect the qualification of the Plan under Section 423 of the Code.

            (b) If and in the event that the Company registers any class of
equity securities pursuant to Section 12 of the Exchange Act, any required
approval of the shareholders of the Company obtained after such registration
shall be solicited substantially in accordance with Section 14(a) of the
Exchange Act and the rules and regulations promulgated thereunder.

            (c) If any required approval by the shareholders of the Plan itself
or of any amendment thereto is solicited at any time otherwise than in the
manner described in paragraph 21(b) hereof, then the Company shall, at or prior
to the first annual meeting of shareholders held subsequent to the later of (i)
the first registration of any class of equity securities of the Company under
Section 12 of the Exchange Act; or (ii) the granting of an option hereunder to
an officer or director after such registration, do the following:

               (1) furnish in writing to the holders entitled to vote for the
Plan substantially the same information which would be required (if proxies to
be voted with respect to approval or disapproval of the Plan or amendment were
then being solicited) by the rules and regulations in effect under Section 14(a)
of the Exchange Act at the time such information is furnished; and



                                       8
<PAGE>   9

               (2) file with, or mail for filing to, the Securities and Exchange
Commission four (4) copies of the written information referred to in subsection
(1) hereof not later than the date on which such information is first sent or
given to shareholders.

        22. Conditions Upon Issuance of Shares. Shares shall not be issued with
respect to an option unless the exercise of such option and the issuance and
delivery of such shares pursuant thereto shall comply with all applicable
provisions of law, domestic or foreign, including, without limitation, the
Securities Act of 1933, as amended, the Securities Exchange Act of 1934, as
amended, the rules and regulations promulgated thereunder, and the requirements
of any stock exchange upon which the shares may then be listed, and shall be
further subject to the approval of counsel for the Company with respect to such
compliance.

        As a condition to the exercise of an option, the Company may require the
person exercising such option to represent and warrant at the time of any such
exercise that the shares are being purchased only for investment and without any
present intention to sell or distribute such shares if, in the opinion of
counsel for the Company, such a representation is required by any of the
aforementioned applicable provisions of law.

        23. Term of Plan. The Plan shall become effective upon the earlier to
occur of its adoption by the Board or its approval by the shareholders of the
Company as described in paragraph 21. It shall continue in effect for a term of
twenty (20) years unless sooner terminated under paragraph 19.



                                       9
<PAGE>   10
                               ALTERA CORPORATION
                        1987 EMPLOYEE STOCK PURCHASE PLAN
                             SUBSCRIPTION AGREEMENT

                        OFFERING DATE: _________________

[ ] ORIGINAL APPLICATION
[ ] CHANGE IN PAYROLL DEDUCTION RATE
[ ] CHANGE OF BENEFICIARY(ies)

All capitalized terms not defined herein shall have the meanings ascribed to
them in the "Altera Corporation 1987 Employee Stock Purchase Plan".

1.   I, ______________________________________, employee # __________ hereby
     elect to participate in the Altera Corporation 1987 Employee Stock Purchase
     Plan, as amended (the "Stock Purchase Plan"), and subscribe to purchase
     shares of the Company's Common Stock, par value $0.001 per share, in
     accordance with this Subscription Agreement and the Stock Purchase Plan.

2.   Employee Location (please check one): Corporate __ Domestic Field __
     International __ For domestic field and international employees, please
     list the state or country your office is located in. Office Location
     _______________________

3.   I hereby authorize payroll deductions from each paycheck in an amount equal
     to __________% (not to exceed 10%) of my Compensation on each payday during
     the Offering Period in accordance with the Stock Purchase Plan.

4.   I understand that said payroll deductions shall be accumulated for the
     purchase of shares of Common Stock, par value $0.001 per share, at the
     applicable purchase price determined in accordance with the Stock Purchase
     Plan. I further understand that, except as otherwise set forth in the Stock
     Purchase Plan, shares will be purchased for me automatically on the
     Exercise Date of the Offering Period unless I otherwise withdraw from the
     Stock Purchase Plan by giving written notice to the Company for such
     purpose.

5.   I have received a copy of the Company's most recent prospectus, which
     describes the Stock Purchase Plan, and a copy of the complete "Altera
     Corporation 1987 Employee Stock Purchase Plan". I understand that my
     participation in the Stock Purchase Plan is in all respects subject to the
     terms of the Plan.

6.   I HAVE NOT elected the DIRECT DEPOSIT PROGRAM. Please issue my shares under
     the following name(s)_____________________________________________________.

7.   I HAVE elected the DIRECT DEPOSIT PROGRAM.  My broker of choice is:

                  [ ] Smith Barney     [ ] Charles Schwab

     My account number is ______________________________
(If selection of the Direct Deposit Program is indicated, account number must be
included)

8.   I hereby agree to be bound by the terms of the Stock Purchase Plan. The
     effectiveness of this Subscription Agreement is dependent upon my
     eligibility to participate in the Stock Purchase Plan.


--------------------------------------------------        ----------------------
Employee Signature                                        Date

<PAGE>   11
              ALTERA CORPORATION 1987 EMPLOYEE STOCK PURCHASE PLAN
                             BENEFICIARY DESIGNATION

In the event of my death, I hereby designate the following as my
beneficiary(ies) to receive all payments and shares due me under the Stock
Purchase Plan:

PRIMARY (PLEASE PRINT)

NAME: (PLEASE PRINT)


         -----------------------------------------------------------------------
         (FIRST)           (MIDDLE)         (LAST)               (RELATIONSHIP)

         -----------------------------------------------------------------------
         (SOCIAL SECURITY NUMBER, IF APPLICABLE)

         -----------------------------------------------------------------------
         (STREET ADDRESS)

         -----------------------------------------------------------------------
         (CITY)                          (STATE)                  (ZIP)


SECONDARY (PLEASE PRINT)


         -----------------------------------------------------------------------
         (FIRST)           (MIDDLE)         (LAST)               (RELATIONSHIP)

         -----------------------------------------------------------------------
         (SOCIAL SECURITY NUMBER, IF APPLICABLE)

         -----------------------------------------------------------------------
         (STREET ADDRESS)

         -----------------------------------------------------------------------
         (CITY)                          (STATE)                  (ZIP)



         -----------------------------------------------------------------------
         (FIRST)           (MIDDLE)         (LAST)               (RELATIONSHIP)

         -----------------------------------------------------------------------
         (SOCIAL SECURITY NUMBER, IF APPLICABLE)

         -----------------------------------------------------------------------
         (STREET ADDRESS)

         -----------------------------------------------------------------------
         (CITY)                          (STATE)                  (ZIP)


--------------------------------------------------        ----------------------
Employee Signature                                        Date