Self-aligned top-gate