Hi, I tried to run basic common source amplifier ...
# sky130
Hi, I tried to run basic common source amplifier simulation in xscheme. when I run ac sim, i get gain around 33dB which is around 50mv. When I try to provide 2m p-p sinusoid, I dont get 100mv p-p (get around 80mv - i get same gain irrespective of input ), can you find what would be the possible reason for the same. I am attaching the schematic and simulation result along with schematic setup for trans.
What Frequency is the frequency bandwidth of your amplifier? Is the 2mVp-p sine wave frequency above the frequency bandwidth of your amplifier?
Also check the dc bias of the input transistor, Is the dc input voltage of the input transistor very close to the same voltage of the Vth of the input transistor?
I have done the simulation on your circuit. I get 24dB gain (~16) and transient sim shows vout with 32mV pp, so it seems consistent.
transient sim
You can get higher gain if you tune the operating point such that Vout is close to 0.9V instead of 1.44V.
like this . I0=0.095mA, vout=0.99, gain=36dB
its little bit confusing because , ac sim in the post shows 35 and you get around 28, really strange.
@Larry Harris bandwidth is greater than 10 MHz. I used 1 KHz, frequency is not an issue. In ac analysis gain is 33dB but in tranisient it comes to only 24dB. Even though stefen has used same circuit to simulate. he has taken a bit more current than the reference which I used. But still something is strange, I guess the design is very current sensitive. For variation of 10uA we see loss of gain around 10dB.
@Stefan Schippers I made an error in transient analysis. I kept reference in ac sim as 100uA and in transient as 110uA.
But for variation of 1uA of current, the output resistance of pmos load M2 transistor changes by 5 times is quite surprising
@ALOK PRATAP SINGH You may try using the following netlist
Copy code
* c:\users\vikash\esim-workspace\cmos_opamp\cmos_opamp.cir
.lib "sky130_fd_pr/models/sky130.lib.spice" tt
* Gate bias
Rg 1 2 680
X1 3 2 5 5 sky130_fd_pr__pfet_01v8 
Rd 3 4 100

* DC source for current measure
Vid 4 0 DC 0V
Vgb 5 1 DC 0V
Vdd 5 0 DC 3.3V

* Sweep Vds from 0 to 1.8V
dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
let vgs = V(5) - V(1)
let vds = V(5) - V(3)
* Sweep Vgs from 0 to 1.2V
dc Vgb 0 1.2 0.01
# Find threshold
let ih=Vid#branch[98]
let il=Vid#branch[85]
let vh=V(5)[98] - V(2)[98]
let vl=V(5)[98] - V(2)[85]
let vth=((vl - vh) / (ih - il)) * ih + vh
echo threshold voltage
print vth