A semiconductor device includes an element isolation insulating film
adjacent to an active area, a gate insulating film formed on a
semiconductor substrate in the active area, paired gate electrodes
located on the gate insulating film, a contact plug located on the active
area between the gate electrodes, a pair of first upper lines located on
the gate electrodes, a second upper line located on the gate electrodes,
and a stopper film above upper surfaces of the gate electrodes and side
surfaces of the gate electrodes. The element isolation insulating film
has a first height of an upper surface thereof with reference to an upper
surface of the semiconductor substrate and a second height of another
upper surface thereof with reference to another upper surface of the
semiconductor substrate. The first height is smaller than the second
height.