* Z:\home\khalils\Downloads\files\data\raw_asc\169524a5c93e_UpDn.asc
* Generated by LTspice 26.0.1 for Windows.
* Behavioral Digital Up Down Counter
* nonretriggerable one-shots
* level\nenforcement
* digital\nintegrator
A1 up N001 0 0 0 0 1 0 SRFLOP tripdt={tdt}
A2 1 0 0 0 0 0 N001 0 BUF td={tp} tripdt={tdt}
A3 dn N002 0 0 0 0 2 0 SRFLOP tripdt={tdt}
A4 2 0 0 0 0 0 N002 0 BUF td={tp} tripdt={tdt}
B2 o 0 V=sdt(V(3)/tp)
V1 up 0 PULSE(0 1 1u 10n 10n 10n 13u)
V2 dn 0 PULSE(0 1 1u 10n 10n 10n 11u)
B1 0 3 I=if (abs(V(1,2)), 0, limit(1,-1,10*(round(V(o))-V(o)))) Rpar=1
G1 0 3 1 2 1
.tran 0 10m 0 1u uic
.param tp=100n tdt=10n
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 880 720
WIRE -288 16 -336 16
WIRE -144 16 -192 16
WIRE -64 16 -144 16
WIRE -48 16 -64 16
WIRE -144 48 -144 16
WIRE 96 48 16 48
WIRE 112 48 96 48
WIRE 352 48 256 48
WIRE -288 64 -304 64
WIRE 16 64 16 48
WIRE 112 64 112 48
WIRE 256 64 256 48
WIRE -48 80 -48 16
WIRE -32 80 -48 80
WIRE -304 112 -304 64
WIRE -144 112 -304 112
WIRE -32 128 -48 128
WIRE 16 160 16 144
WIRE 112 160 112 144
WIRE 256 160 256 144
WIRE -288 176 -336 176
WIRE -144 176 -192 176
WIRE -64 176 -144 176
WIRE -48 176 -48 128
WIRE -48 176 -64 176
WIRE -144 208 -144 176
WIRE -288 224 -304 224
WIRE -304 272 -304 224
WIRE -144 272 -304 272
WIRE -336 368 -352 368
WIRE -320 368 -336 368
WIRE 128 368 112 368
WIRE 144 368 128 368
WIRE -352 384 -352 368
WIRE 112 384 112 368
WIRE -352 480 -352 464
WIRE 112 480 112 464
IOPIN -336 176 In
IOPIN -336 16 In
IOPIN 352 48 Out
LINE Normal 480 320 -400 320 1
RECTANGLE Normal 296 -80 -152 -128
SYMBOL bv 256 48 R0
WINDOW 0 24 24 Left 0
WINDOW 3 24 88 Left 0
SYMATTR InstName B2
SYMATTR Value V=sdt(V(3)/tp)
SYMBOL Digital\\buf1 -80 48 R90
WINDOW 0 8 40 VLeft 0
WINDOW 3 32 48 VLeft 0
SYMATTR InstName A2
SYMATTR Value td={tp}
SYMATTR Value2 tripdt={tdt}
SYMBOL Digital\\buf1 -80 208 R90
WINDOW 0 8 40 VLeft 0
WINDOW 3 32 48 VLeft 0
SYMATTR InstName A4
SYMATTR Value td={tp}
SYMATTR Value2 tripdt={tdt}
SYMBOL Digital\\srflop -240 -32 R0
WINDOW 0 0 72 Center 0
SYMATTR InstName A1
SYMATTR Value2 tripdt={tdt}
SYMBOL voltage 112 368 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
WINDOW 0 24 24 Left 0
WINDOW 3 24 88 Left 0
SYMATTR InstName V2
SYMATTR Value PULSE(0 1 1u 10n 10n 10n 11u)
SYMBOL bi 112 144 M180
WINDOW 0 24 72 Left 0
WINDOW 3 96 -48 Center 0
WINDOW 123 24 8 Left 0
SYMATTR InstName B1
SYMATTR Value I=if (abs(V(1,2)), 0, limit(1,-1,10*(round(V(o))-V(o))))
SYMATTR Value2 Rpar=1
SYMBOL g 16 48 R0
WINDOW 0 24 24 Left 0
WINDOW 3 24 88 Left 0
SYMATTR InstName G1
SYMATTR Value 1
SYMBOL voltage -352 368 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
WINDOW 0 24 24 Left 0
WINDOW 3 24 88 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 1 1u 10n 10n 10n 13u)
SYMBOL Digital\\srflop -240 128 R0
WINDOW 0 0 72 Center 0
SYMATTR InstName A3
SYMATTR Value2 tripdt={tdt}
FLAG -352 480 0
FLAG 112 480 0
FLAG -64 16 1
FLAG -64 176 2
FLAG 16 160 0
FLAG 112 160 0
FLAG 96 48 3
FLAG -336 368 up
FLAG 128 368 dn
FLAG -336 176 dn
FLAG -336 16 up
FLAG 256 160 0
FLAG 352 48 o
TEXT -264 360 Left 0 !.tran 0 10m 0 1u uic
TEXT 16 240 Left 0 !.param tp=100n tdt=10n
TEXT 72 -104 Center 0 ;Behavioral Digital Up Down Counter
TEXT -224 -24 Bottom 0 ;nonretriggerable one-shots
TEXT 112 -24 Center 0 ;level\nenforcement
TEXT 256 -24 Left 0 ;digital\nintegrator