.include
* Parameter Declarations
.PARAM supply=1.2
.PARAM Lmin=45nm
.PARAM Wmin=45nm
.PARAM Wp={2*Wmin}
.global vdd gnd
* Defining the inverter subcircuit
.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
* Defining the pass transistor subcircuit
.subckt pass_transistor control in out
Xinv control not inverter
MP1 out not in vdd pmos w={Wp} L={Lmin}
MN1 out control in 0 nmos W={Wmin} L={Lmin}
.ends
* Defining the 2:1 MUX subcircuit
.subckt mux a b s out
Xinvs s s_ inverter
Xpt1 s_ a out pass_transistor
Xpt2 s b out pass_transistor
.ends
* Defining the D-Latch subcircuit
.subckt d_latch in clk out
Xinv1 out neg inverter
Xmux neg in clk temp mux
Xinv2 temp out inverter
.ends
.subckt
inverter
d_latch
d_latch
.ends