Instructions
  • This activity helps you build a SPICE code for a pass transistor circuit 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. Pass Transistor Subcircuit: Build the pass transistor subcircuit using NMOS and PMOS connections.
  5. Instantiate Subcircuit: Use the pass transistor subcircuit in your main code.
  6. Input Waveform: Set up the input signals for simulation.
  7. Control Statements: Add commands to run and plot the simulation.
  8. End: Finish your SPICE code.
Spice Code
  • .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

     

  • * Inverter sub circuit (introduced in previous experiments)

    .subckt inverter in out
        MP1 out in vdd vdd pmos w={Wmin} L={Lmin}
        Mn1 out in 0 0 NMOS W={Wmin} L={Lmin}
    .ends inverter

  • * Define sub-circuit

    .subckt       
    * Calling inverter subcircuit
           

    * NMOS and PMOS connections
              nmos w={Wmin} L={Lmin}
              pmos w={Wmin} L={Lmin}
    .ends

  • *netlist statement to call the pass transistor sub circuit
    *pass transistor inputs are 'control', 'in' and the output is 'out'

           

  • *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, 'control', 'in' are the input names

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

    *plots inputs
    plot v(control) v(in)

    *plots output
    plot v(out)

    .endc
  • *End of the code
    .end
Observations