# SPICE simulation of MOSFET switch

Trying to understand the SPICE output for this basic MOSFET circuit:

The input (left) is a crude square wave:

A simple spice simulation shows the output voltage (right) as follows:

Why does the capacitor level off at 7V? My thinking was that as it charges up, the current through the transistor would decrease until VDS = 0, and at that point the voltage across the capacitor would be 9V, but SPICE thinks differently.

• nmos cuts off when $V_{GS} \lt V_{th}$, so the maximum voltage the capacitor charges to is $V_{DD}-V_{th}$. replace it with pmos to get full output Feb 28 at 5:46
• ohhhh, right. can you please make this an answer? i will accept it now. Feb 28 at 5:51
• @broken.eggshell Put another way, you accidentally built an NMOS source follower instead of a PMOS high-side switch, which is what it looks like you wanted. Feb 28 at 6:08
• Yeah I saw that immediately following the first comment, but it took someone to point it out to me. Still trying to internalize this stuff! Feb 28 at 6:15

nmos cuts off when $$\V_{GS} \lt V_{th}\$$, so the maximum voltage an nmos can "pass" is $$\V_{DD}-V_{th}\$$.
pmos cuts off when $$\V_{GS} \gt -V_{th}\$$, so the minimum voltage an pmos can "pass" is $$\V_{SS}+V_{th}\$$.