Instructions
  • This activity helps you build a SPICE code for a CMOS inverter step by step.
  • Each colored code block below is a part of the final code. Fill in the blanks in each block.
  • Arrange the blocks in the correct order (see steps below).
  • Click Validate to check your code. If correct, you will see a report and graphs.
  • Click Reset to start over. Click View PTM_45nm.txt to see the MOSFET model file.
Steps to Build Your Code:
  1. Model File: Add the MOSFET model file and set parameters.
  2. Voltage Source: Define the voltage source for your circuit.
  3. Subcircuit: Describe the inverter subcircuit and its connections.
  4. Instantiate Subcircuit: Use the inverter subcircuit in your main code.
  5. Input Waveform: Set up the input signal for simulation.
  6. Control Statements: Add commands to run and plot the simulation.
  7. End: Finish your SPICE code.
Spice Code
  • * inverter *

    .include


    * Parameter Declarations

    .PARAM supply=1.1
    .PARAM Lmin=45nm
    .PARAM Wmin=45nm
    .PARAM Wp={2*Wmin}
    .global vdd gnd

  • * Netlist statement to define voltage source

     

  • * Define sub-circuit

    .subckt     
              pmos w={Wmin} L={Lmin}
              nmos w={Wmin} L={Lmin}
    .ends

  • *netlist statement to call the inverter sub circuit

         

  • *Declaring Input Waveform
    .PARAM trfin=10p
    .PARAM t1 = 10n
    .PARAM t2 = 20n
    .PARAM t3 = 30n
    .PARAM t4 = 40n
    .PARAM t5 = 1*8000p+1200p
    .PARAM t6 = 1*8000p+1210p
    .PARAM t7 = 1*8000p+5200p
    .PARAM t8 = 1*8000p+5210p

    *Transient Analysis
    .tran 6p 50n

    *Use below line for input (declaring input pwl Waveform)
    *'V1' is the PWL source name, 'a' is the input name

    V1 a 0 PWL (0 0 't1' 0 't1+trfin' 'supply' 't2' 'supply' 't3' 'supply' 't3+trfin' 0 't4' 0)
  • *Control Statements
    .control
    run

    *sets background color of plot
    set color0=white

    *plots input
    plot v(a)

    *plots output
    plot v(out)

    .endc
  • *End of the code
    .end
Observations