README FILE:
Objective: To design a Cascode Current Mirror and plot its characteristics.
1. Designing the schematic: 
   Tool Used: esim by FOSSEE
   I designed the cascode current mirror in esim. For this purpose, I took four N-channel MOSFETs and connected them in such a way that they should work in the "Saturation Region" and along    with that for the reference current,i.e., I(input) I've connected 1 DC current source and then completed the circuit by providing the supply and ground voltage to the circuit.
   Though, the circuit was not very complex, but still I faced some minor 1-2 errors and it is as mentioned below:
#  Item not annotated: M?
   Annotation required!
   Reason: This error pops-up when you forgot to annotate any component in your design.(I missed that by mistake, and hence got the error!)

2. Generating the Netlist:
   So, after designing and debugging the schematic, once it is done, the next step I performed was generating the netlist so that I can make the changes according to the SKY130 Technology    and hence, run the netlist code on NGSpice.

3. Amending the Netlist according to the SKY130 Technology:
   So, here, I have done certain changes in the netlist for adding the SKY130 Technology into my design. So the changes I made are as descripted below:
-- Firstly, I added the path to the sky130 technology files:   
   .lib "skywater-pdk-libs-sky130_fd_pr/models/sky130lib.spice" tt
-- After that, I changed the representation names of NMOSFETs according to the sky130 technology file:
   mos_n -----> sky130_fd_pr__nfet_01v8
   M1, M2,M3, M4----> XM1, XM2, XM3,XM4

4. Adding the .control commands :
-- For Transfer Characteristics: Transfer characteristics is to be plotted between output and input current, hence, I've given the commands to sweep the reference current source, I(1) and      then plotted the characteristics.
   .dc I1 0 10uA 0.1uA
    plot -i(vdd) ylabel 'Output Current (in uA)' xlabel 'I(1)' title 'Transfer Characteristics'

    NOTE: IN THE MAIN NETLIST FILE, IN ORDER TO PLOT THE TRANSFER CHARACTERISTICS REMOVE THE ASTERISK(*) FROM THE ABOVE TWO COMMANDS PRESENT AND THEN RUN THE SIMULATION BY COMMENTING THE     BELOW COMMANDS THAT IS FOR OUTPUT CHARACTERISTICS. IN THIS WAY, YOU WILL HAVE 1 WAVEFORM AT A TIME!
    

-- For Output Characteristics: Output characteristics is to be plotted between output current and Vdd, hence, I've given the commands to sweep the Vdd and then plotted the characteristics.
    .dc vdd 0 3V 0.1
    plot -i(vdd) ylabel 'Current (in uA)' xlabel 'M2(Vd)' title 'Output Characteristics' 
   
     

5. Simulation problems:
    Majorly, I've faced 1 issue while simulating the netlist file in NGSpice:
#   could not find a valid modelname
    Simulation interrupted due to error!
    Reason: This was due to the wrong value selection of Width and Length.
    I finally took the values of W and L as:
    W=2 L=0.65 M=1 (For M1 &M2)
    W=1 L=0.65 M=1 (For M3 &M4)
    Then I was able to run the netlist file & study the results.

6. Further Scope Of Improvements:
   We know that practically we do not use a current source for the reference current generation, instead we use a resistor. So, in the designed circuit, one can use the current source to       calculate the node voltages and by using those node voltages and current values, one can estimate the value of resistor.

    



    
   









