Design of D-Latch using SPICE Code
Schematic Diagram
Below is the schematic diagram for the D-Latch circuit. The diagram shows the connections for the bulk terminals of both PMOS and NMOS transistors, as well as the sizes (W/L ratios) of the transistors:

- PMOS: Connect bulk to VDD, W/L ratio as specified in the code (e.g., Wp={2*Wmin}, L={Lmin})
- NMOS: Connect bulk to GND, W/L ratio as specified in the code (e.g., Wn={Wmin}, L={Lmin})
Note: Always ensure the bulk terminals are properly connected: PMOS bulk to VDD, NMOS bulk to GND. The sizes (W/L) should match the parameters used in your SPICE code.
Steps to Perform the Simulation
The simulation page uses colored code blocks to help you visually identify each step in building the SPICE code for a D-Latch. Each block represents a key part of the code and is color-coded for clarity. Follow the instructions below for a smooth experience:
- Arrange the Colored Code Blocks:
- Start with the blue block for the MOSFET model file (
PTM_45nm.txt
) and parameter declarations. - Next, use the green block to define the voltage source (
vdd
as positive,gnd
or0
as negative). - The yellow block is for the inverter, pass transistor, and 2:1 mux subcircuit definitions, including input/output names and PMOS/NMOS connections. Use the format:
INSTANCE_NAME DRAIN GATE SOURCE BODY MODEL_FILE w=WIDTH l=LENGTH
- The red block is for defining the D-Latch subcircuit using the above subcircuits.
- The teal block is for instantiating the D-Latch subcircuit in your main code.
- The orange block is for declaring the input waveforms ('a', 'clk').
- The purple block is for control statements to run and plot the simulation.
- The gray block marks the end of your SPICE code.
- Complete Each Block:
- Fill in the blanks in each colored block with the required values and names.
- Arrange the blocks in the order listed above for a valid simulation.
- Naming Conventions:
- Start names with an alphabet,
%
,$
, or_
. - Names can include alphanumeric characters,
%
,$
, and_
. - SPICE code is case-insensitive; do not use duplicate names (even with different cases).
Observations
- After completing and arranging the colored blocks, click "Validate." If everything is correct, you will see a "Success" message, a report, and input/output graphs in the Observations section.
- Use the "Expand Waveform" button to view larger graphs for better analysis.
- Observe how the input signals ('a', 'clk') and output waveform relate to the D-Latch operation.
Summary:
This improved procedure matches the simulation interface, making it easier for beginners to follow each step and understand the role of every code block. The color coding and clear instructions help ensure a successful SPICE simulation.