The compensation capacitor includes: a charge accumulating element having
a diffusion layer, a dielectric layer, and a gate electrode layer,
wherein the gate electrode layer, the dielectric layer, and the diffusion
layer are stacked in this order, and at least partially overlap with each
other when viewed from a direction of stacking; a metal layer for
applying a voltage to the diffusion layer, the metal layer being formed
above the charge accumulating element; and a contact for electrically
connecting the diffusion layer and the metal layer, the contact extending
between the diffusion layer and the metal layer in the direction of
stacking. The gate electrode layer has a form of a mesh which extends in
a direction which is perpendicular to the direction of stacking. The
contact extends through an aperture of the mesh of the gate electrode
layer.