I'm trying to create a subcircuit in SPICE (currently using LTspice but want a pretty agnostic model) for an AND gate that delays an input by some amount TPD.
I'm currently just inputting 2 offest clock signals to the following subcircuit:
.SUBCKT AND_GATE_TEST A B OUT VCC VEE
XOUTLOGIC A B OUT_LOGIC VCC VEE LOGIC_FUNCTION
XOUTPD OUT_LOGIC OUT VCC VEE PD_FUNCTION
.ENDS
************************************************************
.SUBCKT LOGIC_FUNCTION A B OUT VCC VEE
GAND VEE N1 VALUE = {V(A,VEE)*V(B,VEE)}
RN1 N1 VEE 1
EOUT1 OUT VEE N1 VEE 1
.ENDS
************************************************************
.SUBCKT PD_FUNCTION IN OUT VCC VEE
GDEL VEE N1 VALUE = {V(IN,VEE)}
RN1 N1 VEE 1
EDEL = OUT VEE DELAY N1 VEE TD=10ns
.ENDS
The first logic function works fine and outputs the expected AND logic given the inputs A
and B
but I get tripped up with the propagation delay function.
The error that LTspice outputs says Missing gain value
but no matter how I use the E element (or any behavioral elements for that matter) as a delay function I can't get it to work properly.
I think I'm missing something fundamental on the syntax of the behavioral elements
Any help on how to best approach this would be greatly appreciated.