Skip to content

Instantly share code, notes, and snippets.

@pepijndevos
Created January 13, 2021 16:35
Show Gist options
  • Save pepijndevos/2f41507b821b9a3db65beb68d3330b3b to your computer and use it in GitHub Desktop.
Save pepijndevos/2f41507b821b9a3db65beb68d3330b3b to your computer and use it in GitHub Desktop.
.global Vss Vdd
.model digital_pulldown d_pulldown
.model digital_pullup d_pullup
Ad_pulldown Vss digital_pulldown
Ad_pullup Vdd digital_pullup
.SUBCKT __BUF_ A Y
.model buffer1 d_buffer
Abuf A Y buffer1
.ENDS __BUF_
.SUBCKT __NOT_ A Y
.model not1 d_inverter
Anot A Y not1
.ENDS __NOT_
.SUBCKT __AND_ A B Y
.model and1 d_and
Aand [A B] Y and1
.ENDS __AND_
.SUBCKT __ANDNOT_ A B Y
.model and1 d_and
.model not1 d_inverter
Anot B C not1
Aand [A C] Y and1
.ENDS __ANDNOT_
.SUBCKT __NAND_ A B Y
.model nand1 d_nand
Anand [A B] Y nand1
.ENDS __NAND_
.SUBCKT __OR_ A B Y
.model or1 d_or
Anor [A B] Y or1
.ENDS __OR_
.SUBCKT __ORNOT_ A B Y
.model or1 d_or
.model not1 d_inverter
Anot B C not1
Aor [A C] Y or1
.ENDS __ORNOT_
.SUBCKT __NOR_ A B Y
.model nor1 d_nor
Anor [A B] Y nor1
.ENDS __NOR_
.SUBCKT __XOR_ A B Y
.model xor1 d_xor
Axor [A B] Y xor1
.ENDS __XOR_
.SUBCKT __XNOR_ A B Y
.model xnor1 d_xnor
Axnor [A B] Y xnor1
.ENDS __XNOR_
.SUBCKT __MUX_ A B S Y
.model mux1 d_lut(table_values = "01010011")
Axnor [A B S] Y mux1
.ENDS __MUX_
.SUBCKT __DFF_P_ D C Q
.model dff1 d_dff
Adff D C null null Q nQ dff1
.ENDS __DFF_P_
.SUBCKT __DFFSR_PPP_ C S R D Q
.model dff1 d_dff
Adff D C S R Q nQ dff1
.ENDS __DFF_P_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment