UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

A layout generator for stray insensitive switched capacitor filters 1986

You don't seem to have a PDF reader installed, try download the pdf

Item Metadata

Download

Media
UBC_1986_A7 L56.pdf [ 10.93MB ]
Metadata
JSON: 1.0096921.json
JSON-LD: 1.0096921+ld.json
RDF/XML (Pretty): 1.0096921.xml
RDF/JSON: 1.0096921+rdf.json
Turtle: 1.0096921+rdf-turtle.txt
N-Triples: 1.0096921+rdf-ntriples.txt
Citation
1.0096921.ris

Full Text

c. A L A Y O U T G E N E R A T O R F O R S T R A Y I N S E N S I T I V E S W I T C H E D C A P A C I T O R F I L T E R S b y J O H N E R I K L I N D H O L M A T H E S I S S U B M I T T E D I N P A R T I A L F U L F I L M E N T O F T H E R E Q U I R E M E N T S F O R T H E D E G R E E O F M A S T E R O F A P P L I E D S C I E N C E i n T H E F A C U L T Y O F G R A D U A T E S T U D I E S D E P A R T M E N T O F E L E C T R I C A L E N G I N E E R I N G We a c c e p t t h i s t h e s i s a s c o n f o r m i n g t o t h e r e q u i r e d s t a n d a r d T H E U N I V E R S I T Y O F B R I T I S H C O L U M B I A F E B R U A R Y , 1 9 8 6 © J O H N E R I K L I N D H O L M , 1 9 8 6 7 8 I n p r e s e n t i n g t h i s t h e s i s i n p a r t i a l f u l f i l m e n t o f t h e r e q u i r e m e n t s f o r a n a d v a n c e d d e g r e e a t t h e U n i v e r s i t y o f B r i t i s h C o l u m b i a , I a g r e e t h a t t h e L i b r a r y s h a l l m a k e i t f r e e l y a v a i l a b l e f o r r e f e r e n c e a n d s t u d y . I f u r t h e r a g r e e t h a t p e r m i s s i o n f o r e x t e n s i v e c o p y i n g o f t h i s t h e s i s f o r s c h o l a r l y p u r p o s e s m a y b e g r a n t e d b y t h e h e a d o f my d e p a r t m e n t o r b y h i s o r h e r r e p r e s e n t a t i v e s . I t i s u n d e r s t o o d t h a t c o p y i n g o r p u b l i c a t i o n o f t h i s t h e s i s f o r f i n a n c i a l g a i n s h a l l n o t b e a l l o w e d w i t h o u t my w r i t t e n p e r m i s s i o n . D e p a r t m e n t o f T h e U n i v e r s i t y o f B r i t i s h C o l u m b i a 1956 M a i n M a l l V a n c o u v e r , C a n a d a V6T 1Y3 D a t e Mf t£OH QO}^(o A b s t r a c t T w o s o f t w a r e p r o g r a m s h a v e b e e n d e v e l o p e d t o a u t o m a t i c a l l y g e n e r a t e t h e l a y o u t o f s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r f i l t e r s . T h e f i r s t p r o g r a m , C I R C E , u s e s a S W I T C A P f i l t e r d e s c r i p t i o n t o g e n e r a t e a n i n t e r m e d i a t e f o r m a t f i l t e r d e s c r i p t i o n t h a t i s s u i t a b l e f o r d i r e c t l a y o u t . I t g r o u p s t h e f i l t e r e l e m e n t s i n t o i n t e g r a t o r s a n d t h e n s o r t s t h e s e i n t e g r a t o r s a n d t h e i r e l e m e n t s . T h e S W I T C A P d e s c r i p t i o n c a n b e w i t h o r w i t h o u t s w i t c h - s h a r i n g . T h e s e c o n d p r o g r a m , S I S C L , l a y s o u t t h e f i l t e r i n C I F f o r m a t u s i n g a d o u b l e - p o l y s i l i c o n I S O C M O S p r o c e s s . T h e l a y o u t i s d o n e w i t h a c a p a c i t o r a r r a y p l a c e d o v e r t h e s w i t c h e s a n d t h e s t a n d a r d - c e l l o p e r a t i o n a l a m p l i f i e r s p l a c e d b e n e a t h t h e s w i t c h e s . T h e l a y o u t i s d o n e w i t h f u l l s w i t c h - s h a r i n g . C a p a c i t o r s m a y b e r e a r r a n g e d i n t h e i n t e r m e d i a t e f i l e t o p r o d u c e b e t t e r l a y o u t s . T h e s o f t w a r e ' i s w r i t t e n i n t h e C l a n g u a g e . i i T a b l e o f C o n t e n t s A b s t r a c t . . i i T a b l e o f c o n t e n t s i i i L i s t o f t a b l e s v i L i s t o f f i g u r e s v i i A c k n o w l e d g e m e n t , 1 . I n t r o d u c t i o n 1 2 . I S O C M O S p r o c e s s t e c h n o l o g y 2 2 . 1 T h e f a b r i c a t i o n p r o c e s s 2 2 . 2 CMOS s w i t c h e s 2 2 . 3 CMOS r e s i s t o r s 4 2 . 4 CMOS c a p a c i t o r s 4 3 . T h e s w i t c h e d c a p a c i t o r 9 3 . 1 T h e p a r a l l e l s w i t c h e d c a p a c i t o r 9 3 . 2 T h e s w i t c h e d c a p a c i t o r i n t e g r a t o r 13 3 . 3 P a r a s i t i c c a p a c i t a n c e c o n s i d e r a t i o n s 16 3 . 4 M o n o l i t h i c f i l t e r a c c u r a c y 20 3 . 5 F i l t e r d e s i g n 22 4 . T h e c i r c u i t e x t r a c t o r ( C I R C E ) 23 4 . 1 I n t r o d u c t i o n 2 3 4 . 2 B r e a k i n g d o w n t h e i n p u t f i l e 2 6 4 . 2 . 1 S i m p l i f y i n g t h e f i l t e r f i l e ( R E D U C E ) 26 4 . 2 . 2 I n s e r t i n g t h e s u b c i r c u i t s ( R E P L A C E ) 2 9 4 . 3 G a t h e r i n g t h e i n t e g r a t o r s 32 4 . 3 . 1 R e m o v i n g t h e i n p u t s t a g e ( I S O L A T E ) 32 4 . 3 . 2 F o r m i n g t h e i n t e g r a t o r s ( S T A G E S ) 3 5 4 . 4 S o r t i n g t h e f i l t e r 4 3 4 . 4 . 1 P r o c e s s i n g t h e i n p u t s t a g e s ( I N P U T ) 4 3 i i i 4 . 4 . 1 . 1 I N P U T 1 ( L e e ) 44 4 . 4 . 1 . 2 I N P U T 2 ( M a r t i n ) 44 4 . 4 . 1 . 3 I N P U T 3 ( D a t a r a n d S e d r a ) 45 4 . 4 . 1 . 4 I N P U T 4 ( A R O M A ) 45 4 . 4 . 2 S o r t i n g t h e i n t e g r a t o r s ( O R D E R 1 ) 4 5 4 . 4 . 3 S o r t i n g t h e e l e m e n t s a n d n o d e s ( 0 R D E R 2 ) . . . 5 0 5 . T h e l a y o u t g e n e r a t o r ( S I S C L ) . 5 4 5 . 1 I n t r o d u c t i o n 54 5 . 2 T h e o p e r a t i o n a l a m p l i f i e r 54 5 . 3 R e a d i n g t h e i n p u t d a t a ( I N I T ) 57 5 . 4 T h e c a p a c i t o r s 60 5 . 4 . 1 T h e c a p a c i t o r a r r a y 60 5 . 4 . 2 L a y o u t m e t h o d 62 5 . 4 . 3 C a p a c i t o r a c c u r a c y a n a l y s i s 67 5 . 4 . 4 G e n e r a t i n g t h e a r r a y ( C A P A R R A Y ) 72 5 . 5 S e l e c t i n g t h e s w i t c h e s t o b e p l a c e d ( P R E O P ) 77 5 . 6 T h e c a p a c i t o r w i r i n g 7 9 5 . 6 . 1 I n t r o d u c t i o n 7 9 5 . 6 . 2 T h e i n p u t n o d e s ( W I R E 1 ) 80 5 . 6 . 3 T h e o u t p u t n o d e s ( W I R E 2 ) 82 5 . 6 . 4 T h e s h a r e d n o d e a t t h e i n p u t ( W I R E 3 ) 82 5 . 6 . 5 T h e s h a r e d n o d e s a t t h e o u t p u t ( W I R E 4 ) . . . . 8 5 5 . 6 . 6 T h e s w i t c h p l a c e m e n t a n d c o n n e c t i o n s ( S T R E A K ) 8 5 5 . 7 P l a c i n g a n d c o n n e c t i n g t h e o p e r a t i o n a l a m p l i f i e r s 88 5 . 7 . 1 C o n n e c t i n g t h e i n p u t a n d o u t p u t n o d e s ( W I R E 5 ) 88 5 . 7 . 2 C o n n e c t i n g t h e g r o u n d n o d e s ( W I R E 6 ) 8 9 i v 5 . 7 . 3 P l a c i n g t h e o p e r a t i o n a l a m p l i f i e r s ( A M P S O N ) 8 9 5 . 8 P l a c i n g t h e g l o b a l f e a t u r e s ( W R A P U P ) 92 5 . 9 L a y o u t o f t h e i n p u t s t a g e 96 6 . R e s u l t s a n d d i s c u s s i o n 99 6 . 1 A 3 8 2 5 H z b a n d p a s s e l l i p t i c f i l t e r ( L e e ) 99 6 . 2 A 5 0 0 H z l o w p a s s e l l i p t i c f i l t e r ( M a r t i n ) 109 6 . 3 A 3 k H z ^ 5 k H z b a n d - e l i m i n a t i o n e l l i p t i c f i l t e r ( A R O M A ) 117 6 . 4 D i s c u s s i o n 125 7 . C o n c l u s i o n 128 7 . 1 F u t u r e w o r k . . . . 1 2 8 R E F E R E N C E S 131 A P P E N D I X A 133 A P P E N D I X B 135 A P P E N D I X C 138 A P P E N D I X D 173 v L i s t o f T a b l e s T a b l e P a g e 2 . 1 . L a y e r r e s i s t a n c e s 5 2 . 2 . L a y e r c a p a c i t a n c e s 8 4 . 1 . P a r a m e t e r s u b s t i t u t i o n s 32 v i L i s t o f f i g u r e s F i g u r e P a g e 2 . 1 . CMOS s w i t c h s c h e m a t i c 3 2 . 2 . CMOS s w i t c h m o d e l 4 2 . 3 . L a y o u t o f a s w i t c h - p a i r 5 2 . 4 . P o l y s i l i c o n 1 - p o l y s i l i c o n 2 c a p a c i t o r . . ' 7 2 . 5 . P a r a s i t i c c a p a c i t a n c e s 7 3 . 1 . P a r a l l e l s w i t c h e d c a p a c i t o r 10 3 . 2 . C l o c k w a v e f o r m s 10 3 . 3 . R e s i s t o r e q u i v a l e n t 11 3 . 4 . S e r i e s s w i t c h e d c a p a c i t o r 11 3 . 5 . R C i n t e g r a t o r 13 3 . 6 . P a r a l l e l S C i n v e r t i n g i n t e g r a t o r . 1 4 3 . 7 . S e r i e s S C i n v e r t i n g i n t e g r a t o r 14 3 . 8 . S t r a y i n s e n s i t i v e S C n o n i n v e r t i n g i n t e g r a t o r 17 3 . 9 . S t r a y i n s e n s i t i v e S C i n v e r t i n g i n t e g r a t o r 17 3 . 1 0 . S t r a y c a p a c i t a n c e s 18 3 . 1 1 . P a r a l l e l s w i t c h i n g d u r i n g 0 , 19 3 . 1 2 . P a r a l l e l s w i t c h i n g d u r i n g <j>2 20 4 . 1 . I n p u t s t a g e ( L e e ) 24 4 . 2 . I n p u t s t a g e ( D a t a r & S e d r a ) 24 4 . 3 . I n t e g r a t o r m o d e l 2 5 4 . 4 . C I R C E f l o w c h a r t 27 4 . 5 . R E D U C E f u n c t i o n f l o w c h a r t 28 v i i L i s t o f f i g u r e s F i g u r e P a g e 4 . 6 . S W I T C A P f i l t e r d e s c r i p t i o n ( f i l t e r ) 30 4 . 7 . O u t p u t f r o m R E D U C E f u n c t i o n 31 4 . 8 . R E P L A C E f u n c t i o n f l o w c h a r t 33 4 . 9 . O u t p u t f r o m R E P L A C E f u n c t i o n 34 4 . 1 0 . I S O L A T E f u n c t i o n f l o w c h a r t 36 4 . 1 1 . I n p u t s e c t i o n ( f i l t e r . i n ) 37 4 . 1 2 . I s o l a t e d i n p u t s e c t i o n . 37 4 . 1 3 . R e m a i n d e r o f f i l t e r d e s c r i p t i o n 38 4 . 1 4 . S T A G E S f u n c t i o n f l o w c h a r t 39 4 . 1 5 . S I S C f u n c t i o n f l o w c h a r t 40 4 . 1 6 . I n t e g r a t o r w i t h s w i t c h - s h a r i n g 42 4 . 1 7 . S t r a y i n s e n s i t i v e S C e l e m e n t 42 4 . 1 8 . O u t p u t f r o m S T A G E S f u n c t i o n 43 4 . 1 9 . F i n a l i n p u t s t a g e d e s c r i p t i o n 44 4 . 2 0 . L i n e a r t o p o l o g y 46 4 . 2 1 . B a n d - p a s s f i l t e r t o p o l o g y 47 4 . 2 2 . AROMA f i l t e r t o p o l o g y 47 4 . 2 3 . O R D E R 1 f u n c t i o n f l o w c h a r t 48 4 . 2 4 . O u t p u t f r o m O R D E R 1 f u n c t i o n 4 9 4 . 2 5 . C I R C E o u t p u t f i l e ( f i l t e r . n d ) 50 4 . 2 6 . O R D E R 2 f u n c t i o n f l o w c h a r t " 51 4 . 2 7 . C I R C E o u t p u t f i l e ( f i l t e r . c t ) 52 v i i i L i s t o f f i g u r e s F i g u r e • P a g e 5 . 1 . S I S C L f l o w c h a r t 55 5 . 2 . O p e r a t i o n a l a m p l i f i e r p a r a m e t e r s 56 5 . 3 . F i l t e r . c o m f i l e f o r m a t 56 5 . 4 . O p e r a t i o n a l a m p l i f i e r l a y o u t 58 5 . 5 . I N I T f u n c t i o n f l o w c h a r t 59 5 . 6 . F i r s t c a p a c i t o r p l a t e 63 5 . 7 . A d d i t i o n a l c a p a c i t o r p l a t e s . . 6 3 5 . 8 . S m a l l f r a c t i o n a l a d d - o n c a p a c i t a n c e 64 5 . 9 . L a r g e f r a c t i o n a l a d d - o n c a p a c i t a n c e 66 5 . 1 0 . P o l y s i l i c o n l s y s t e m a t i c e r r o r 68 5 . 1 1 . P o l y s i l i c o n 2 s y s t e m a t i c e r r o r 70 5 . 1 2 . A r r a y l a y o u t f l o w c h a r t ( L A Y A R R A Y ) 74 5 . 1 3 . H o r i z o n t a l c a p a c i t o r s p r e a d 7 5 5 . 1 4 . V e r t i c a l c a p a c i t o r s p r e a d 75 5 . 1 5 . O p t i m a l c a p a c i t o r a r r a y 76 5 . 1 6 . P R E O P f u n c t i o n f l o w c h a r t 78 5 . 1 7 . W i r i n g m o d e l 80 5 . 1 8 . W I R E 1 f u n c t i o n f l o w c h a r t 81 5 . 1 9 . O u t p u t f r o m W I R E 1 83 5 . 2 0 . O u t p u t f r o m W I R E 2 83 5 . 2 1 . O u t p u t f r o m W I R E 3 84 5 . 2 2 . O u t p u t f r o m W I R E 4 84 i x L i s t o f f i g u r e s F i g u r e , P a g e 5 . 2 3 . S T R E A K f u n c t i o n f l o w c h a r t 86 5 . 2 4 . O u t p u t f r o m S T R E A K f u n c t i o n 87 5 . 2 5 . W I R E 5 f u n c t i o n f l o w c h a r t 90 5 . 2 6 . O u t p u t f r o m W l R E 5 f u n c t i o n 91 5 . 2 7 . O u t p u t f r o m t h e W I R E 6 f u n c t i o n 91 5 . 2 8 . O u t p u t f r o m t h e A M P S O N f u n c t i o n 93 5 . 2 9 . A M P S O N o u t p u t f o r r e v e r s e d i n p u t s 94 5 . 3 0 . O u t p u t f r o m t h e W R A P U P f u n c t i o n 95 5 . 3 1 . F i n a l l a y o u t 97 6 . 1 . L C p r o t o t y p e o f f i l t e r l 100 6 . 2 . S C i m p l e m e n t a t i o n o f f i l t e r l 101 6 . 3 . S W I T C A P f i l t e r l f i l e 102 6 . 4 . F i l t e r l . i n f i l e 104 6 . 5 . F i l t e r l . n d f i l e 104 6 . 6 . F i l t e r l . c t f i l e 105 6 . 7 . F i l t e r 1 . c o m f i l e 1 0 5 6 . 8 . F i l t e r l l a y o u t 1 0 6 6 . 9 . R e v i s e d f i l t e r l . c t f i l e 107 6 . 1 0 . R e v i s e d f i l t e r l l a y o u t 108 6 . 1 1 . L C p r o t o t y p e o f f i l t e r 2 110 6 . 1 2 . S C i m p l e m e n t a t i o n o f f i l t e r 2 111 6 . 1 3 . S W I T C A P f i l t e r 2 f i l e ' 112 x L i s t o f f i g u r e s F i g u r e P a g e 6 . 1 4 . F i l t e r 2 . n d f i l e 114 6 . 1 5 . F i l t e r 2 . c t f i l e 115 6 . 1 6 . F i l t e r 2 . c o m f i l e 115 6 . 1 7 . F i l t e r 2 l a y o u t 116 6 . 1 8 . S C i m p l e m e n t a t i o n o f f i l t e r 3 118 6 . 1 9 . S W I T C A P f i l t e r 3 f i l e 119 6 . 2 0 . F i l t e r 3 . n d f i l e 121 6 . 2 1 . F i l t e r 3 . c t f i l e 1 22 6 . 2 2 . F i l t e r 3 . c o m f i l e 123 6 . 2 3 . F i l t e r 3 l a y o u t 124 7 . 1 . S w i t c h c e l l , 1 2 9 B . 1 . S a m p l e S W I T C A P f i l e 137 x i A c k n o w l e d g e m e n t I w o u l d l i k e t o t h a n k my s u p e r v i s o r s , D r . L . Y o u n g , a n d D r . D . M o o r e f o r t h e i r g u i d a n c e a n d s u p p o r t d u r i n g t h e c o u r s e o f t h i s w o r k . I w o u l d a l s o l i k e t o a c k n o w l e d g e t h e f i n a n c i a l a n d t e c h n i c a l h e l p g i v e n b y t h e p e o p l e a t M i c r o t e l P a c i f i c R e s e a r c h L t d . ( M P R ) , e s p e c i a l l y M r . P . T h i e l , a n d M r . H . S c h w e i k l e . T h a n k s a r e e x t e n d e d t o M r . C . H u n t l e y , M r . K . W e i , a n d M r s . E . W i l l o n e r , o f MPR f o r t h e i r t e c h n i c a l g u i d a n c e . I a l s o w i s h t o t h a n k my p a r e n t s f o r t h e i r c o n t i n u a l s u p p o r t o f my e d u c a t i o n . x i i 1. I N T R O D U C T I O N M o n o l i t h i c s w i t c h e d c a p a c i t o r f i l t e r s w e r e i n t r o d u c e d i n 1 9 7 7 [ 1 ] [ 2 ] , a n d t h e t e c h n o l o g y h a s a d v a n c e d r a p i d l y s i n c e t h e n . S t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r f i l t e r s b a s e d o n p a s s i v e L C l a d d e r p r o t o t y p e s a r e c o m m o n l y u s e d t o d a y i n c o m m e r c i a l p r o d u c t s , a s a v a r i e t y o f m e t h o d s e x i s t f o r t r a n s f o r m i n g t h e p r o t o t y p e s i n t o s w i t c h e d c a p a c i t o r f i l t e r s [ 3 ] - [ 9 ] . P r o g r a m s s u c h a s S W I T C A P ( s e e A p p e n d i x B ) , p r o v i d e a c c u r a t e p e r f o r m a n c e a n a l y s i s o f t h e s e f i l t e r s a n d t h e t e c h n o l o g y m a y b e c o n s i d e r e d m a t u r e [ 1 0 ] , T h e l a y o u t o f s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r f i l t e r s i s s t i l l m a i n l y d o n e b y h a n d ; h o w e v e r , t h e m a t u r i t y o f t h e d e s i g n t e c h n i q u e s p r o v i d e s i n c e n t i v e t o d e v e l o p a p r o g r a m t h a t c a n a u t o m a t i c a l l y g e n e r a t e t h e l a y o u t f r o m a f i l t e r d e s c r i p t i o n . S u c h a p r o g r a m h a s b e e n d e v e l o p e d i n t h i s t h e s i s . I t u s e s a S W I T C A P f i l t e r d e s c r i p t i o n t o g e n e r a t e t h e l a y o u t i n C a l t e c h I n t e r m e d i a t e F o r m ( C I F ) [11 ] . T h e s o f t w a r e i s w r i t t e n i n t h e C l a n g u a g e a n d w a s d e v e l o p e d o n t h e M e t h e u s X 7 5 0 s y s t e m a t t h e U n i v e r s i t y o f B r i t i s h C o l u m b i a . 1 2 . I S O C M O S P R O C E S S T E C H N O L O G Y 2 . 1 T H E F A B R I C A T I O N P R O C E S S T h e I S O C M O S ( i s o l a t i o n O x i d e C M O S ) p r o c e s s u s e s a s i n g l e p - w e l l i n a n n - s u b s t r a t e . T h e p r o c e s s i s c h a r a c t e r i z e d b y t h e s t e p s t a b u l a t e d b e l o w w i t h t h e C I F c o d e f o r e a c h l a y e r g i v e n a f t e r t h e l a y e r . 1 . A c t i v e ( A C ) 2 . P - w e l l i m p l a n t (PW) 3 . P o l y s i l i c o n l ( P 1 ) 4 . P o l y s i l i c o n 2 ( P 2 ) 5 . N+ I m p l a n t ( N P ) 6 . P+ I m p l a n t ( P P ) 7 . C o n t a c t c u t s ( C 1 ) 8 . M e t a l l i z a t i o n (M1) 9 . P a s s i v a t i o n ( G L ) A t h i n o x i d e l a y e r s e p a r a t e s t h e p o l y s i l i c o n l - p o l y s i l i o n 2 l a y e r s p r o d u c i n g a h i g h c a p a c i t a n c e . A 5um p r o c e s s w a s u s e d . 2 . 2 CMOS S W I T C H E S I t i s p o s s i b l e t o i m p l e m e n t a n e x c e l l e n t s w i t c h i n CMOS t e c h n o l o g y ( F i g . 2 . 1 ) . T h e c l o c k c o n t r o l s t h e s w i t c h . A s i m p l e n o n - i d e a l m o d e l o f a CMOS s w i t c h i s s h o w n i n F i g . 2 . 2 . T h e o n r e s i s t a n c e i s t y p i c a l l y 1k$2, a n d t h e o f f r e s i s t a n c e i s i n t h e 1Tf l r a n g e , p r o d u c i n g a c o n d u c t a n c e r a t i o o f a b i l l i o n t o o n e . 2 3 C a p a c i t o r s C G S a n d C G D r e p r e s e n t p a r a s i t i c c a p a c i t a n c e s b e t w e e n t h e g a t e a n d t h e s w i t c h t e r m i n a l s . T h e s e p a r a s i t i c s a r e i n t h e 1 f F r a n g e a n d c o n t r i b u t e t o a f e e d t h r o u g h e f f e c t w h e r e a p o r t i o n o f t h e c o n t r o l v o l t a g e a p p e a r s a t t h e s w i t c h t e r m i n a l s . T h e s e p a r a s i t i c s a r e c a u s e d b y l a t e r a l d i f f u s i o n u n d e r t h e g a t e c a u s i n g a g a t e - s o u r c e a n d g a t e - d r a i n o v e r l a p . C a p a c i t o r s C S S a n d C D S r e p r e s e n t p a r a s i t i c c a p a c i t a n c e s f r o m t h e s w i t c h t e r m i n a l s t o t h e s u b s t r a t e a n d t h e i r v a l u e s d e p e n d o n t h e d r a i n a n d s o u r c e a r e a s , b u t t h e y a r e i n t h e 1 p F r a n g e . T h e s w i t c h e s a r e l a i d o u t i n p a i r s s i n c e t h e s w i t c h e d c a p a c i t o r s a r e a l t e r n a t e l y s w i t c h e d f r o m g r o u n d t o t h e c i r c u i t . T h e s w i t c h e s a r e o v e r l a p p e d t o r e d u c e t h e o v e r a l l a r e a , r e s u l t i n g i n a s h a r e d s o u r c e a n d d r a i n f o r t w o o f t h e D. I n Out F i g . 2 . 1 : CMOS s w i t c h s c h e m a t i c 4 Gate C 5 GS C GD Source • W v Dra In C SS C DS F i g . 2.2: CMOS s w i t c h m o d e l t r a n s i s t o r s ( F i g . 2 . 3 ) . T h e s w i t c h e s a r e o f m i n i m u m g e o m e t r y t o m i n i m i z e t h e s w i t c h - i n d u c e d e r r o r v o l t a g e [ 1 2 ] . 2 . 3 CMOS R E S I S T O R S R e s i s t o r s c a n b e f a b r i c a t e d i n a n u m b e r o f w a y s u s i n g t h e p - w e l l , p o l y s i l i c o n , o r a c t i v e r e g i o n s . T h e a b s o l u t e a c c u r a c y o f t h e s e r e s i s t o r s i s t y p i c a l l y 5 0 % , m a k i n g p r e c i s i o n r e s i s t o r s i m p o s s i b l e . T a b l e 2 . 1 s u m m a r i z e s t h e e f f e c t i v e r e s i s t a n c e s a c h i e v e d b y t h e s e m e t h o d s . 2 . 4 CMOS C A P A C I T O R S T h r e e t y p e s o f c a p a c i t o r s s u i t a b l e f o r a n a l o g s a m p l e d d a t a a p p l i c a t i o n s c a n b e f a b r i c a t e d . O n e i s b e t w e e n t h e g a t e a n d t h e c h a n n e l , a n o t h e r i s b e t w e e n t h e m e t a l a n d t h e 5 F i g . 2 . 3 ; L a y o u t o f a s w i t c h - p a i r T a b l e 2 . 1 ; L a y e r r e s i s t a n c e s L a y e r R e s i s t a n c e (ohms/n ) p _ w e l i 1000 p+ act i v e 90 n+ 3 c t I v e 10 p o l y s iI i c o n l 40 p o l y s i i icon2 55 metal 0.023 6 s u b s t r a t e , a n d t h e t h i r d i s b e t w e e n t h e p o l y s i l i c o n l a y e r s . T h e g a t e - o x i d e - c h a n n e l c a p a c i t o r h a s a v a l u e i n t h e 0 . 4 p F / u 2 r a n g e . I t s m a i n d i s a d v a n t a g e i s t h a t a v o l t a g e - d e p e n d e n t p a r a s i t i c c a p a c i t a n c e e x i s t s f r o m t h e c h a n n e l t o t h e s u b s t r a t e . T h i s p a r a s i t i c c a p a c i t a n c e h a s a v a l u e f r o m 5% - 20% o f t h e d e s i r e d c a p a c i t a n c e , a n d t h i s r e n d e r s t h e g a t e - o x i d e - c h a n n e l c a p a c i t o r u s e l e s s f o r s w i t c h e d c a p a c i t o r f i l t e r s . T h e m e t a l - s u b s t r a t e c a p a c i t o r a n d t h e p o l y s i l i c o n 1 - p o l y s i l i c o n 2 c a p a c i t o r s d o n o t h a v e a n y v o l t a g e d e p e n d e n t p a r a s i t i c c a p a c i t a n c e s . T h e p o l y s i l i c o n 1 - p o l y s i l i c o n 2 c a p a c i t o r ( F i g . 2 . 4 ) h a s a s l i g h t l y t h i c k e r o x i d e l a y e r t h a n t h e g a t e - o x i d e - c h a n n e l c a p a c i t o r a n d h e n c e i t s c a p a c i t a n c e i s s l i g h t l y l e s s . T h e m e t a l - s u b s t r a t e c a p a c i t o r o x i d e i s s o m e t w e n t y t i m e s t h i c k e r r e s u l t i n g i n a m u c h s m a l l e r c a p a c i t a n c e . F o r t h e s e r e a s o n s , t h e p o l y s i l i c o n l - p o l y s i l i c o n 2 c a p a c i t o r i s t h e p r e f e r r e d c h o i c e i n s w i t c h e d c a p a c i t o r f i l t e r s . T h e c a p a c i t a n c e s a r e s u m m a r i z e d i n T a b l e 2 . 2 . A l l c a p a c i t o r s h a v e p a r a s i t i c c a p a c i t a n c e s a s s o c i a t e d w i t h t h e m . F o r t h e p o l y s i l i c o n l - p o l y s i l i c o n 2 c a p a c i t o r , t h e t o p p l a t e p a r a s i t i c s a r e m a i n l y d u e t o c i r c u i t c o n n e c t i o n s , a n d t h e o v e r l a p c a p a c i t o r s o f t h e d r a i n o r s o u r c e t o t h e b u l k o f s w i t c h e s a t t a c h e d t o t h e m . T h e s e p a r a s i t i c s a r e m o d e l l e d a s c a p a c i t o r s t o g r o u n d ( F i g . 2 . 5 ) . T h e t o p p l a t e p a r a s i t i c c a p a c i t a n c e i s t y p i c a l l y 0 . 1 % - 1 .0% o f t h e d e s i r e d c a p a c i t a n c e , a n d t h e b o t t o m p l a t e p a r a s i t i c 7 polys11lcon2 oxide polys 11Iconl oxide substrate F i g . 2 . 4 : P o l y s i l i c o n 1 - p o l y s i l i c o n 2 c a p a c i t o r c v 2 Cpt Cpb F i g . 2 . 5 : P a r a s i t i c c a p a c i t a n c e s T a b l e 2 . 2 : L a y e r c a p a c i t a n c e s L a y e r s C a p a c i t a n c e (FF/um 2) gate ~ channel 0.42 p o l y l - p o l y 2 0.40 - p o l y l - s u b s t r a t e 0,024 metal - s u b s t r a t e 0,019 c a p a c i t a n c e i s t y p i c a l l y 10% o f t h e d e s i r e d c a p a c i t a n c e . T h e s e p a r a s i t i c s a r e u n a v o i d a b l e , a n d t h e i r s i z e d e p e n d s o n t h e l a y o u t , t h e t e c h n o l o g y , a n d t h e c a p a c i t o r s i z e . T h e a b s o l u t e a c c u r a c y o f a c a p a c i t o r i s a f e w p e r c e n t a n d i s e d g e d e p e n d e n t . T h i s e r r o r i s d u e t o o x i d e u n d e r c u t t i n g i n t h e p h o t o l i t h o g r a p h y p r o c e s s , a n d t o m a s k r e s o l u t i o n . T h e s e e r r o r s a r e a s s o c i a t e d w i t h t h e p e r i p h e r y o f t h e c a p a c i t o r s . 3 . T H E S W I T C H E D C A P A C I T O R 3 . 1 T H E P A R A L L E L S W I T C H E D C A P A C I T O R C o n s i d e r t h e s w i t c h e d c a p a c i t o r ( S C ) n e t w o r k o f F i g . 3 . 1 , c l o c k e d b y t h e <t>, a n d <j>2 w a v e f o r m s o f F i g . 3 . 2 . I t w i l l b e s h o w n t h a t t h i s c i r c u i t i s e q u i v a l e n t t o t h e c i r c u i t o f F i g . 3 . 3 . A s s u m e t h a t V , a n d V 2 a r e t w o i n d e p e n d e n t D C v o l t a g e s o u r c e s t h a t a r e c o n s t a n t d u r i n g m o s t o f t h e p h a s e p e r i o d . A s s u m e i n i t i a l l y t h a t b o t h s w i t c h e s a r e o p e n a n d t h a t t h e c a p a c i t o r C i s u n c h a r g e d . D u r i n g <t>}, t h e c a p a c i t o r w i l l c h a r g e t o V , , a n d t h e c h a r g e t r a n s f e r r e d i n t o t h e c a p a c i t o r C i s D u r i n g <p2, t h e c h a r g e t r a n s f e r r e d i n t o t h e c a p a c i t o r i s a n d d u r i n g 0 , a g a i n , t h e c h a r g e t r a n s f e r r e d i n t o t h e c a p a c i t o r i s Q ( T / 2 ) = C V , ( 3 . 1 ) Q ( T ) = C ( V 2 - V 1 ) ( 3 . 2 ) Q ( 3 T / 2 ) = C ( V , - V 2 ) ( 3 . 3 ) a n d s t e a d y - s t a t e h a s b e e n r e a c h e d . L e t V i - V 2 = v2-v ( 3 . 4 ) T h e c u r r e n t a t a p o i n t i n t h e c i r c u i t i s 9 10 1 1>1 ^2 v 2 : B c F i g . 3 . 1 ; P a r a l l e l s w i t c h e d c a p a c i t o r 0 T/2 T 3T/2 2T 5T/2 t F i g . 3 . 2 ; C l o c k w a v e f o r m s 11 R A / W -Q F i g . 3 . 3 ; R e s i s t o r e q u i v a l e n t 1 : • C F i g . 3 . 4 : S e r i e s s w i t c h e d c a p a c i t o r 12 i - f ( 3 . 5 ) C o n s i d e r t h e f l o w o f c h a r g e i n t h e s e n s e o f i , i n F i g . 3 . 1 . T h e t o t a l c h a r g e f l o w i s Q , 3 T / 2 3 T / 2 Qi = J m i i d t = J . i , d t ( 3 . 6 ) T T / 2 s i n c e n o c h a r g e f l o w s d u r i n g t h e p r e v i o u s p h a s e p e r i o d . E q u a t i n g 3 . 3 t o 3 . 6 a n d d i v i d i n g b y T r e s u l t s i n Q ( 3 T / 2 ) 1 3 T / 2 . I i = T = T ' T / 2 1 , < 3 T ( 3 ' 7 ) o r : = c(v,-va) 1 = \ ' ( 3 . 8 ) Now s u b s t i t u t i n g 3 . 4 i n t o 3 . 8 g i v e s R = ^ ( 3 . 9 ) T h i s s w i t c h e d c a p a c i t o r i m p l e m e n t a t i o n i s c a l l e d a p a r a l l e l s w i t c h e d c a p a c i t o r . I t i s a l s o p o s s i b l e t o i m p l e m e n t a s e r i e s s w i t c h e d c a p a c i t o r a s s h o w n i n F i g . 3 . 4 . A s i m i l a r a n a l y s i s t o t h e o n e g i v e n a b o v e f o r t h e p a r a l l e l c a s e y i e l d s t h e s a m e r e l a t i o n s h i p . 1 3 3 . 2 T H E S W I T C H E D C A P A C I T O R I N T E G R A T O R I t i s n e c c e s s a r y t o i n t r o d u c e t h e o p e r a t i o n a l a m p l i f i e r t o c o m p l e t e l y t r a n s f e r t h e c h a r g e o f o n e c a p a c i t o r t o a n o t h e r c a p a c i t o r . A l l o p e r a t i o n a l a m p l i f i e r s a r e c o n s i d e r e d i d e a l f o r t h e f o l l o w i n g a n a l y s i s . T h e R C i n t e g r a t o r o f F i g . 3 . 5 i s t h e b a s i c b u i l d i n g b l o c k o f a c t i v e f i l t e r s . T h e t r a n s f e r f u n c t i o n o f t h i s i n t e g r a t o r i s \Ml>" - SET R e p l a c i n g t h e r e s i s t o r R b y t h e p a r a l l e l s w i t c h e d c a p a c i t o r o f F i g . 3 . 1 r e s u l t s i n t h e c i r c u i t o f F i g . 3 . 6 . T h i s c i r c u i t c a n b e a n a l y z e d b y z - t r a n s f o r m t e c h n i q u e s . D u r i n g t h e c h a r g e s o n t h e c a p a c i t o r s a r e F i g . 3 . 5 ; R C i n t e g r a t o r F i g . 3 . 7 : S e r i e s S C i n v e r t i n g i n t e g r a t o r 15 Q i = C , V 2 ( n - . 5 ) ( 3 . 1 1 ) Q 2 = C 2 V ] ( n - . 5 ) ( 3 . 1 2 ) w h e r e t h e s u p e r s c r i p t e d n u m b e r r e f e r s t o t h e c l o c k p h a s e . D u r i n g <p2, c h a r g e c o n s e r v a t i o n y i e l d s C , V | ( n ) = C , V 2 ( n - . 5 ) - C 2 V ] ( n - . 5 ) ( 3 . 1 3 ) o r V l ( z ) = Z ~ 1 / 2 V 2 ( Z ) - ( ^ ) z " 1 / 2 V ] ( z ) ( 3 . 1 4 ) On t h e t r a n s f o r m a t i o n <f>2 t o 0 t V | ( n - 1 ) = V 2 ( n - . 5 ) ( 3 . 1 5 ) o r V | ( z ) = Z 1 / 2 V 2 ( Z ) ( 3 . 1 6 ) S u b s t i t u t i n g 3 . 1 6 i n t o 3 . 1 4 g i v e s z V 2 ( z ) = V 2 ( z ) - ( ) V } ( z ) ( 3 . 1 7 ) c 1 o r fflfy • ' >' > ( 3 . 1 8 ) Now s u b s t i t u t i n g 3 . 9 i n t o 3 . 1 0 g i v e s 1 6 - ( 3 19 ) V , ( s ) S T C , U . i y > a n d c o m p a r i n g 3 . 1 9 w i t h 3 . 1 8 r e s u l t s i n s = ( 3 . 2 0 ) w h i c h i s t h e f o r w a r d t r a n s f o r m a t i o n . R e p e a t i n g t h i s a n a l y s i s f o r t h e s e r i e s s w i t c h e d c a p a c i t o r o f F i g . 3 . 7 g i v e s t h e t r a n s f e r f u n c t i o n v ? ( z ) 1 c, M 1 - z - 1 ; i 3 . ^ i ; a n d c o m p a r i n g 3 . 2 1 w i t h 3 . 1 9 g i v e s 1 - z - 1 s = J - | — ( 3 . 2 2 ) w h i c h i s t h e b a c k w a r d t r a n s f o r m a t i o n . 3 . 3 P A R A S I T I C C A P A C I T A N C E C O N S I D E R A T I O N S T h e b o t t o m p l a t e o f t h e p a r a l l e l s w i t c h e d c a p a c i t o r i s g r o u n d e d , h e n c e t h e b o t t o m p l a t e p a r a s i t i c s a r e s h o r t e d a c r o s s g r o u n d a n d h a v e n o e f f e c t . T h e t o p p l a t e p a r a s i t i c w h i c h i s s o m e 0 . 1 % - 1 .0% o f t h e c a p a c i t o r v a l u e d e g r a d e s t h e c a p a c i t o r a c c u r a c y w h e n i t c h a r g e s a n d d i s c h a r g e s . T o n e g a t e a n y p a r a s i t i c c a p a c i t a n c e s , t h e s w i t c h i n g s c h e m e s o f t h e p a r a l l e l a n d s e r i e s s w i t c h e d c a p a c i t o r i n v e r t i n g i n t e g r a t o r s a r e c h a n g e d i n t o t h o s e o f F i g . 3 . 8 a n d F i g . 3 . 9 . N o t i c e t h a t t h e t o p a n d b o t t o m p l a t e s o f t h e 17 F i g . 3 . 9 : S t r a y i n s e n s i t i v e S C i n v e r t i n g i n t e g r a t o r 18 p a r a l l e l s w i t c h e d c a p a c i t o r a r e now a l t e r n a t i n g t o g r o u n d , a n d t h a t t h e i n t e g r a t o r i s now n o n i n v e r t i n g . T h e t r a n s f e r f u n c t i o n o f t h e i n t e g r a t o r i s V , ( z ) 1 C , M 1 - z - 1 ; K*-**) w h i l e t h e t r a n s f e r f u n c t i o n o f t h e s e r i e s i n t e g r a t o r r e m a i n s u n c h a n g e d . T h e p a r a s i t i c c a p a c i t a n c e s o f t h e p a r a l l e l i n t e g r a t o r a r e s h o w n i n F i g . 3 . 1 0 . I n t h i s i m p l e m e n t a t i o n , t h e s t r a y c a p a c i t a n c e s h a v e n o e f f e c t o n t h e t r a n s f e r f u n c t i o n o f e i t h e r i n t e g r a t o r . D u r i n g , t h e s w i t c h e d c a p a c i t o r o f F i g . 3 . 8 l o o k s l i k e F i g . 3 . 1 1 . T h e b o t t o m p l a t e p a r a s i t i c C B P i s s h o r t e d F i g . 3 . 1 0 ; S t r a y c a p a c i t a n c e s 19 a c r o s s g r o u n d a n d t h e t o p p l a t e p a r a s i t i c C T P i s c h a r g e d t o V , w i t h t h e c a p a c i t o r C . D u r i n g <j>2 ( F i g . 3 . 1 2 ) , C T P i s s h o r t e d a c r o s s g r o u n d a n d h a s n o e f f e c t o n t h e c h a r g e t r a n s f e r . C a p a c i t o r C B P i s now v i r t u a l l y s h o r t e d a c r o s s g r o u n d a n d h e n c e h a s n o e f f e c t e i t h e r . T h e c h a r g e o n C i s t r a n s f e r r e d t h r o u g h t h e o p e r a t i o n a l a m p l i f i e r a n d t o t h e i n t e g r a t i n g c a p a c i t o r C , . O n e p l a t e o f C , i s a l w a y s c o n n e c t e d t o t h e v i r t u a l g r o u n d , h e n c e i t s p a r a s i t i c c a p a c i t a n c e h a s n o e f f e c t w h i l e t h e o t h e r p l a t e i s a l w a y s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r o u t p u t . I f t h e o p e r a t i o n a l a m p l i f i e r h a s a h i g h g a i n , a g o o d v i r t u a l g r o u n d i s a s s u r e d , a n d i f i t h a s a h i g h g a i n a n d d r i v e c a p a b i l i t y , t h e o t h e r p a r a s i t i c h a s n o e f f e c t . F i g . 3 . 1 1 : P a r a l l e l s w i t c h i n g d u r i n g <f> 20 F i g . 3 . 1 2 : P a r a l l e l s w i t c h i n g d u r i n g <t>2 I t i s i m p o r t a n t t o n o t e t h a t a l l s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s m u s t b e c o n n e c t e d f r o m a v o l t a g e s o u r c e i t o a v i r t u a l g r o u n d . T h e s a m e a p p l i e s t o t h e i n t e g r a t i n g a n d c o u p l i n g c a p a c i t o r s . 3 . 4 M O N O L I T H I C F I L T E R A C C U R A C Y T h e t i m e c o n s t a n t T o f t h e R C i n t e g r a t o r o f F i g . 3 . 5 i s T = R C , ( 3 . 2 4 ) w i t h d i f f e r e n t i a l d r = R d C , + C , d R ( 3 . 2 5 ) I n t e r p r e t i n g d r / r a s t h e r e l a t i v e e r r o r i n T g i v e s 21 dT d R d C , . . - = ~ + ( 3 . 2 6 ) I n a t y p i c a l MOS t e c h n o l o g y , d C ^ C , i s a c c u r a t e t o a f e w p e r c e n t a n d d R / R i s a c c u r a t e t o ± 5 0 % . T h i s i s n o t a d e q u a t e f o r f i l t e r i m p l e m e n t a t i o n . T h e s w i t c h e d c a p a c i t o r i n t e g r a t o r s o f F i g . 3 . 8 a n d F i g . 3 . 9 h a v e a t i m e c o n s t a n t T o f T C , r = ^ ( 3 . 2 7 ) C 2 giving d r d T d C , d C , , „ "7 = + ~ c t " ~ c t { 3 - 2 8 ) A n a c c u r a t e c l o c k i s a s s u m e d , g i v i n g d T / T = 0 . T h e n d r dC_L _ d C ^ T C , C 2 K 6 ' Z * } F o r t w o a d j a c e n t c a p a c i t o r s w i t h t h e s a m e t e c h n o l o g y , t h i s r e l a t i v e e r r o r h a s a v a l u e l e s s t h a n 0 . 1 % . A b s o l u t e v a l u e s a r e v e r y h a r d t o a c h i e v e , b u t e r r o r s a f f e c t b o t h c a p a c i t o r s t h e s a m e w a y m a i n t a i n i n g t h e r a t i o . T h e l i n e a r i t y a n d t e m p e r a t u r e c o e f f i c i e n t s a r e a l s o w e l l b e h a v e d i n t h i s r a t i o . 22 3 . 5 F I L T E R D E S I G N A b e t t e r w a y o f t r a n s f o r m i n g t h e f i l t e r r e s p o n s e f r o m t h e s t o z p l a n e i s t h r o u g h t h e b i l i n e a r t r a n s f o r m . M u c h w o r k w a s s p e n t i n t h e e a r l y e i g h t i e s o n t e c h n i q u e s t o t r a n s f o r m a p a s s i v e L C p r o t o t y p e f i l t e r t o a s u i t a b l e s w i t c h e d c a p a c i t o r i m p l e m e n t a t i o n [ 3 ] - [ 9 ] . T h e d e s i r e d f i l t e r m u s t u s e s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s a n d s h o u l d b e d e r i v e d t h r o u g h t h e b i l i n e a r t r a n s f o r m . S u c h t e c h n i q u e s w e r e d e v e l o p e d b y L e e [ 7 ] , a n d D a t a r a n d S e d r a [ 8 ] . T h e s e t e c h n i q u e s r e p l a c e t h e s e r i e s a n d s h u n t b r a n c h e s o f t h e L C p r o t o t y p e w i t h i n t e g r a t o r s . T h e s o f t w a r e d e v e l o p e d i n t h i s t h e s i s w a s b a s e d o n t h e s e t e c h n i q u e s a s w e l l a s t h o s e o f M a r t i n [ 6 ] , a n d o f t h e AROMA p r o g r a m [ 9 ] , w h i c h u s e s b i q u a d r a t i c s e c t i o n s c o n s i s t i n g o f t w o i n t e g r a t o r s . 4 . T H E C I R C U I T E X T R A C T O R ( C I R C E ) 4 . 1 I N T R O D U C T I O N T h e c i r c u i t e x t r a c t o r p r o g r a m ( C I R C E ) , c o n v e r t s a S W I T C A P f i l t e r f i l e ( h e r e c a l l e d f i l t e r ) , i n t o a f i l t e r d e s c r i p t i o n m o r e s u i t a b l e f o r d i r e c t l a y o u t . I t g r o u p s t h e f i l t e r e l e m e n t s i n t o i n t e g r a t o r s , e a c h c o n s i s t i n g o f s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s , c o u p l i n g c a p a c i t o r s , a n i n t e g r a t i n g c a p a c i t o r , a n d a n o p e r a t i o n a l a m p l i f i e r . T h e i n t e g r a t o r s a s w e l l a s t h e i n t e g r a t o r e l e m e n t s a r e t h e n s o r t e d f r o m t h e f i l t e r i n p u t t o i t s o u t p u t t o s i m p l i f y t h e l a y o u t . I n a d d i t i o n t o t h e S W I T C A P f i l e , C I R C E r e q u i r e s a f i l e c o n t a i n i n g t h e f i l t e r i n p u t s t a g e e l e m e n t s ( f i l t e r . i n ) . T h e s o f t w a r e g e n e r a t e s t w o o u t p u t f i l e s : o n e c o n t a i n s t h e n o d e o r d e r i n g i n f o r m a t i o n ( f i l t e r . n d ) , a n d t h e o t h e r c o n t a i n s t h e f i n a l f i l t e r d e s c r i p t i o n ( f i l t e r . c t ) . T h e s o f t w a r e c a n c u r r e n t l y p r o c e s s t h e i n p u t s t a g e s o f L e e , a n d D a t a r a n d S e d r a . T h e s e a r e s h o w n i n F i g . 4 . 1 a n d F i g . 4 . 2 . T h e r e i s n o i n p u t s t a g e f o r f i l t e r s d e s i g n e d b y A R O M A , o r b y t h e t e c h n i q u e s o f M a r t i n . T h e i n p u t s t a g e o f t h e f i l t e r i s t h e s e t o f c i r c u i t e l e m e n t s f e e d i n g t h e i n p u t v o l t a g e t o t h e f i r s t i n t e g r a t o r ' s o p e r a t i o n a l a m p l i f i e r . T h e r e s t o f t h e f i l t e r m u s t b e c o m p r i s e d o f i n t e g r a t o r s ( F i g . 4 . 3 ) p o s s e s s i n g a n y n u m b e r o f c o u p l i n g a n d s w i t c h e d c a p a c i t o r s , t h a t o b e y t h e f o l l o w i n g r u l e s : 2 3 24 V, F i g . 4 . 1 : I n p u t s t a g e ( L e e ) F i g . 4 . 2 : I n p u t s t a g e ( D a t a r & S e d r a ) 2 5 1 . O n l y s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s , c o u p l i n g c a p a c i t o r s , a n d o p e r a t i o n a l a m p l i f i e r e l e m e n t s a r e a l l o w e d . 2 . T h e n o n i n v e r t i n g i n p u t o f e a c h o p e r a t i o n a l a m p l i f i e r i s a l w a y s g r o u n d e d . 3 . E a c h o p e r a t i o n a l a m p l i f i e r m u s t h a v e o n e i n t e g r a t i n g c a p a c i t o r . 4 . E a c h o p e r a t i o n a l a m p l i f i e r f e e d s a t l e a s t o n e s w i t c h e d c a p a c i t o r . 5 . T h e o n l y d i s t i n c t n o d e s i n t h e f i l t e r a r e t h e o p e r a t i o n a l a m p l i f i e r n o n i n v e r t i n g i n p u t a n d o u t p u t n o d e s . 6 . E a c h o p e r a t i o n a l a m p l i f i e r i s f e d c h a r g e o n o n l y o n e o f t h e t w o c l o c k s . V5 F i g . 4 . 3 : I n t e g r a t o r m o d e l 26 7 . T h e i n p u t s t a g e c o n n e c t s t o o n e o p e r a t i o n a l a m p l i f i e r n o n i n v e r t i n g i n p u t . T h e d e s i g n t e c h n i q u e s o f R e f s . [ 6 ] , [ 7 ] , [ 8 ] , a n d [ 9 ] , o b e y t h e s e r e s t r i c t i o n s . T h e C I R C E p r o g r a m c o n s i s t s o f s e v e n m a i n f u n c t i o n c a l l s , a n d t w e n t y - n i n e f u n c t i o n s i n a l l . A f l o w c h a r t o f C I R C E i s s h o w n i n F i g . 4 . 4 , a n d t h e m a i n f u n c t i o n c a l l s a r e f u r t h e r d e s c r i b e d i n t h i s c h a p t e r . A l i s t i n g i s p r o v i d e d i n A p p e n d i x C . 4 . 2 B R E A K I N G DOWN T H E I N P U T F I L E 4 . 2 . 1 S I M P L I F Y I N G T H E F I L T E R F I L E ( R E D U C E ) T h e S W I T C A P f i l t e r f i l e i s f i r s t s i m p l i f i e d b y r e m o v i n g a l l n o n - e s s e n t i a l d a t a i n t h e f i l e . T h e f i l t e r i n p u t a n d o u t p u t n o d e s a r e n o t e d h e r e . ' T h e f i l t e r e l e m e n t s a r e a l l i n t h e S U B C K T a n d C I R C U I T s e c t i o n s o f t h e f i l e , s o e v e r y t h i n g e l s e i s r e m o v e d . T h e f i l t e r i n p u t n o d e i s t a k e n a s t h e f i r s t n o d e o f t h e v o l t a g e s o u r c e s t a t e m e n t , a n d t h e f i l t e r o u t p u t n o d e i s t a k e n a s t h e f i r s t n o d e o f t h e P R I N T o r P L O T s t a t e m e n t ( s ) i n t h e A N A L Y Z E b l o c k . T h e C I R C U I T a n d S U B C K T b l o c k s a r e c o p i e d f r o m t h e i n p u t f i l e a s f o l l o w s : 1 . C a p i t a l i z e a l l l e t t e r s . 2 . R e m o v e c o m m e n t s a n d b l a n k l i n e s . 3 . O n e s t a t e m e n t p e r l i n e . 4 . L e f t - a d j u s t a l l l i n e s . 27 START REDUCE - c l e a n up t h e l npu t F i l e REPLACE - i n s e r t any s u b c i r c u i t c a l I s ISOLATE - i s o l a t e t h e i n p u t s t a g e STAGES _ g r o u p e l e m e n t s i n t o i n t e g r a t o r s INPUT ~ p r o c e s s t h e a p p r o p r i a t e i n p u t s t a g e 0RDER1 _ s o r t t h e i n t e g r a t o r s t a g e s DRDER2 - s o r t t h e e l e m e n t s a n d n o d e s END F i g . 4 . 4 : C I R C E f l o w c h a r t 28 S T R R T 4 : O p e n S U I T C R P F i l e i DO r e a d c l e 9 n ( l i n e , i n F i I e ) U H I L E no s u . b c i r - c u . i t o r c i r c u i t U H I L E n o t 8 n 9 I y z e b l o c k I F l i n e i s n o t e m p t y I F v o l t a g e s o u n c e n o t e i n p u t n o d e E L S E u n i t e C l i n e ^ o u t F i l e ) r e 9 d c l e 9 n ( I i n e j i n F i I e ) i U H I L E n o t e n d o F F i l e I F p r i . n t / p l c t I i n e n o t e o u t p u t n o d e r e a d c I e 9 n ( I i n e } i n F i l e ) 1 C l o s e S U I T C R P F i l e > END F i g . 4 . 5 : R E D U C E f u n c t i o n f l o w c h a r t 2 9 A f l o w c h a r t o f t h e R E D U C E f u n c t i o n i s s h o w n i n F i g . 4 . 5 . A s a m p l e S W I T C A P f i l t e r f i l e ( f i l t e r ) i s s h o w n i n F i g . 4 . 6 , a n d t h e c o r r e s p o n d i n g f i l e a f t e r p r o c e s s i n g i s s h o w n i n F i g . 4 . 7 . T h e f i l t e r f i l e c o n t a i n s a s w i t c h e d c a p a c i t o r f i l t e r d e s i g n b y D a t a r a n d S e d r a , w i t h r a n d o m c a p a c i t o r v a l u e s . 4 . 2 . 2 I N S E R T I N G T H E S U B C I R C U I T S ( R E P L A C E ) T h e s u b c i r c u i t b l o c k s a r e now i n s e r t e d i n t o t h e c i r c u i t . T h e f i l e i s s c a n n e d a n d i f a S U B C K T b l o c k i s f o u n d , i t i s r e m o v e d f r o m t h e f i l e . T h e r e s t o f t h e f i l e i s t h e n s c a n n e d f o r a n y c a l l s o f t h a t s u b c i r c u i t . I f a n y a r e f o u n d , t h e c a l l i s r e p l a c e d b y t h e s u b c i r c u i t e l e m e n t s w i t h t h e a p p r o p r i a t e p a r a m e t e r s i n s e r t e d . A l l s u b c i r c u i t c a l l s s t a r t w i t h a c a p i t a l X i n S W I T C A P f i l e s . T h i s p r o c e s s i s r e p e a t e d u n t i l t h e r e a r e n o m o r e S U B C K T b l o c k s i n t h e f i l e . T h e p a r a m e t e r r e p l a c e m e n t p r o c e s s w o r k s a s f o l l o w s . T h e p a r a m e t e r s o f t h e S U B C K T b l o c k h e a d e r , a s w e l l a s a n y o t h e r n o d e s e x i s t i n g i n t h e S U B C K T b l o c k a r e t a b u l a t e d . T h e p a r a m e t e r s o f t h e c a l l a r e t h e n t a b u l a t e d n e x t t o t h e f i r s t s e t a n d a n y e x t r a n o d e s a r e i n s e r t e d t o c o m p l e t e t h e s e c o n d l i s t . N o d e 0 i s a l w a y s g r o u n d . T h e s u b c i r c u i t e l e m e n t s a r e t h e n w r i t t e n t o t h e f i l e w i t h t h e p a r a m e t e r s u b s t i t u t i o n s m a d e b e t w e e n t h e t w o l i s t s . A s a m p l e t a b l e i s s h o w n i n T a b l e 4 . 1 f o r t h e f i r s t s u b c i r c u i t c a l l o f F i g . 4 . 7 . A n e n t r y i s m a d e o n l y o n c e i n t h e f i r s t c o l u m n o f t h e t a b l e , a n d a n y e x t r a n o d e s a r e o f t h e f o r m a t ! A A w h i c h a r e 30 O P T I O N S ; G R I D ; E N D ; T I T L E : S w i t c h e d - C a p a c i t o r F i l t e r ( D a t a r & S e d r a ) ; T I M I N G ; / * T i m i n g S e c t i o n * / P E R I O D l e - 6 ; C L O C K C 1 (0 3 / 8 ) ; E N D ; / * s w i t c h e d - c a p a c i t o r s u b - c i r c u i t * / S U B C K T (1 4) s w c ( K : p h i l K : p h i 2 K : p h i 3 K : p h i 4 P : c a p l ) ; 5 1 (1 2 ) p h i l ; 5 2 (2 0) p h i 2 ; S 4 (3 0) p h i 4 ; C I (2 3) c a p l ; S 3 (3 4 ) p h i 3 ; E N D ; C I R C U I T ; / * n e t w o r k s e c t i o n * / /* s w i t c h e d - c a p a c i t o r s * / X c (12 10) s w c (#c C #C C 3 . 0 0 ) X d (12 20) s w c (#C C C #c 4 . 0 0 ) X e (22 10) s w c (#C C #c c 6 . 0 0 ) X f (42 10) s w c (#C C #c c 12 . 0 0 ) X g (30 32) s w c (#C C #c C 8 . 0 0 ) X h (40 32) s w c ( C #C : #c c 9 . 0 0 ) X i (42 30) SWC (#C C #c c 11 . 0 0 ) X j (22 30) SWC (#C C #c c 13 . 0 0 ) /* c a p a c i t o r s * / C2 (10 12) 2 . 0 0 ; C5 (22 20) 5 . 0 0 C 1 4 ( 1 0 3 2 ) 1 4 . 0 0 ; C 1 0 ( 4 0 4 2 ) 1 0 . 0 0 ; C 1 5 ( 1 2 3 0 ) 1 5 . 0 0 ; C 7 ( 3 0 3 2 ) 7 . 0 0 ; / * i n p u t s e c t i o n * / CO (2 0) 1 . 0 0 ; C I ( 5 2 5 3 ) 1 . 0 0 ; C I ( 5 4 5 5 ) 1 . 0 0 ; S (1 2) #C ; S ( 3 5 2 ) C ; S ( 5 2 0) #C ; S ( 5 3 1 0 ) C ; S ( 5 3 0) #C ; S ( 3 5 4 ) #C ; S ( 5 4 0) C ; S ( 5 5 1 0 ) #C ; S ( 5 5 0) C ; / * o p - a m p s * / E 5 ( 4 2 0 0 4 0 ) 5 0 0 0 ; E l (3 0 2 3) 5 0 0 0 ; E 3 ( 2 2 0 0 2 0 ) 5 0 0 0 ; E 4 ( 3 2 0 0 3 0 ) 5 0 0 0 ; E 2 ( 1 2 0 0 1 0 ) 5 0 0 0 ; V I ( 1 0 ) ; / * i n p u t v o l t a g e n o d e * / E N D ; A N A L Y Z E S S S ; / * A n a l y s i s S e c t i o n * / I N F R E Q 0 . 0 1 1 0 0 0 0 0 L O G 1 5 ; S E T V I A C 1 . 0 0 . 0 ; / * a m p l i t u d e a n d p h a s e * / P R I N T V R ( 3 2 ) V I ( 3 2 ) ; / * r e a l a n d i m a g i n a r y p a r t s * / E N D ; E N D ; F i g . 4 . 6 : S W I T C A P f i l t e r d e s c r i p t i o n ( f i l t e r ) SUBCKT (1 4) SWC (K:PHI1 K:PHI2 K:PHI3 K:PHI4 P:CAP1) ; 51 (1 2) PHI1 ; 52 (2 0) PHI2 ; S4 (3 0) PHI4 ; C l (2 3) CAP1 ; 53 (3 4) PHI3 ; E N D ; CIRCUIT ; XC (12 10) SWC (#c C #c c 3. 00) XD (12 20) SWC (#c c c #c 4 . 00) XE (22 10) SWC (#c c #c c 6 . 00) XF (42 10) SWC (#c c #c c 12. 00) XG (30 32) SWC (#c c #c c 8. 00) XH (40 32) SWC ( c #c #c c 9. 00) XI (42 30) SWC (#c c #c c 11. 00) XJ (22 30) SWC (#c c #c c 13 . 00) C2 (10 12) 2.00 7 C5 (22 20) 5. 00 . C14 (10 32) 14. 00 • 9 CIO (40 42) 10. 00 • C15 (12 30) 15. 00 • C7 (30 32) 7.00 • CO (2 0) 1. 00 ; C l (52 53) 1. 00 • 9 C l (54 55) 1.00 • 9 S (1 2) #C • 9 S ( 3 5 2 ) C ; S ( 5 2 0) #C ; S ( 5 3 1 0 ) C ; S ( 5 3 0) #C ; S ( 3 5 4 ) #C ; S ( 5 4 0) C ; S ( 5 5 1 0 ) #C ; S ( 5 5 0) C ; E 5 ( 4 2 0 0 4 0 ) 5 0 0 0 ; E l (3 0 2 3) 5 0 0 0 ; E 3 ( 2 2 0 0 2 0 ) 5 0 0 0 ; E 4 ( 3 2 0 0 3 0 ) 5 0 0 0 ; E 2 ( 1 2 0 0 1 0 ) 5 0 0 0 ; E N D ; F i g . 4.7: O u t p u t f r o m REDUCE f u n c t i o n 32 T a b l e 4 . 1 : P a r a m e t e r s u b s t i t u t i o n s SUBCKT Parameters C a l l Parameters I 12 4 10 PHI1 #C PHI2 c PHI3 ftC PHI4 C CRP1 3,00 2 !RR 0 0 z J !RB n o t a l l o w e d i n S W I T C A P f i l e s . T h e f l o w c h a r t o f t h e R E P L A C E f u n c t i o n i s s h o w n i n F i g . 4 . 8 , a n d t h e r e s u l t i n g o u t p u t f i l e i s s h o w n i n F i g . 4 . 9 . 4 . 3 G A T H E R I N G T H E I N T E G R A T O R S 4 . 3 . 1 R E M O V I N G T H E I N P U T S T A G E ( I S O L A T E ) T h e I S O L A T E f u n c t i o n r e m o v e s a l l i n p u t s t a g e e l e m e n t s f r o m t h e f i l t e r d e s c r i p t i o n f i l e . A l l e l e m e n t s i n t h e f i l t e r . i n f i l e a r e r e m o v e d f r o m t h e f i l t e r f i l e . T h e f l o w c h a r t o f t h e I S O L A T E f u n c t i o n i s s h o w n i n F i g . 4 . 1 0 . T h e d a t a i n t h e f i l t e r . i n f i l e ( F i g . 4 . 1 1 ) i s f i r s t p r o c e s s e d i n t h e s a m e w a y a s t h e f i l t e r f i l e w a s . A n y l i n e s START r e a d d i n e j i n F i l e ) i UHILE more s u b c i r c u i t c a l l s n o t e s u b c i r c u i t name c o p y s u b c i r c u i t t o s p a r e F i l e t a b u l a t e s u b c i r c u i t p a r a m e t e r s DO read(I Lne ) i n F LIe ) IF same s u b c i r c u i t c a l l e d tabuI a t e c a l I p3r8me t e r s F i l l p a r a m e t e r t a b l e c o p y s u b c i r c u i t b l o c k w i t h s u b s t i t u t i o n s t o o u t p u t F i l e ELSE u r i t e ( I i ne j ou t F i l e ) UHILE not e n d - o F - F i l e r e u e r s e i n p u t and o u t p u t F i l e r e a d ( I i n e , i n F i l e ) END F i g . 4 . 8 : R E P L A C E f u n c t i o n f l o w c h a r t 34 C I R C U I T ; S I ( 1 2 I A A ) #C • r S 2 ( ! A A 0) C ; S 4 ( ! A B 0) C ; C l ( ! A A ! A B ) 3 . 0 0 S 3 ( ! A B 1 0 ) #C • 9 S I ( 1 2 ! A C ) #C m 9 S 2 ( ! A C 0) C ; S 4 ( ! A D 0) #C ; C l ( ! A C ! A D ) 4 . 0 0 S 3 ( ! A D 2 0 ) C ; S I ( 2 2 ! A E ) #C • 9 S 2 (! A E 0) C ; S 4 ( ! A F 0) C ; C l ( ! A E J A F ) 6 . 0 0 S 3 ( ! A F 1 0 ) #C • S I ( 4 2 1AG) #C • S 2 ( ! A G 0) C ; S 4 ( ! A H 0) C ; C l ( ! A G ! A H ) 12 . 0 0 S 3 ( ! A H 1 0 ) #C • 9 S I ( 3 0 ! A I ) #C • S 2 ( ! A I 0 ) C ; S 4 ( ! A J 0) C ; C l ( ! A I ! A J ) 8 . 0 0 S 3 ( ! A J 3 2 ) #C • 9 S I ( 4 0 ! A K ) C ; S 2 ( ! A K 0) #C ; S 4 ( ! A L 0) C ; C l ( ! A K ! A L ) 9 . 0 0 S 3 ( ! A L 3 2 ) #C • S I ( 4 2 ! A M ) #C • S 2 ( ! A M 0) C ; S 4 ( ! A N 0) C ; C l ( ! A M ! A N ) 1 1 . 0 0 S 3 ( ! A N 3 0 ) #C • S I ( 2 2 ! A O ) #C • 9 S 2 ( ! A O 0) C ; S 4 ( ! A P 0) C ; C l ( ! A O ! A P ) 13 . 0 0 S 3 ( ! A P 3 0 ) #C • 9 C 2 ( 1 0 1 2 ) 2 . 0 0 • C 5 ( 2 2 2 0 ) 5 . 0 0 • 9 C 1 4 ( 1 0 3 2 ) 1 4 . 0 0 C I O ( 4 0 4 2 ) 1 0 . 0 0 C 1 5 ( 1 2 3 0 ) 1 5 . 0 0 C 7 ( 3 0 3 2 ) 7 . 0 0 • C O (2 0) 1 . 0 0 ; C l ( 5 2 5 3 ) 1 . 0 0 • 9 C l ( 5 4 5 5 ) 1 . 0 0 • F i g . 4 . 9 : O u t p u t f r o m R E P L A C E f u n c t i o n 35 S ( 1 2 ) #C ; S ( 3 5 2 ) C ; S ( 5 2 0) #C ; S ( 5 3 1 0 ) C ; S ( 5 3 0 ) #C ; S ( 3 5 4 ) #C ; S ( 5 4 0) C ; S ( 5 5 1 0 ) #C ; S ( 5 5 0) C ; E 5 ( 4 2 0 0 4 0 ) 5 0 0 0 ; E l (3 0 2 3 ) 5 0 0 0 ; E 3 ( 2 2 0 0 2 0 ) 5 0 0 0 ; E 4 ( 3 2 0 0 3 0 ) 5 0 0 0 ; E 2 ( 1 2 0 0 1 0 ) 5 0 0 0 ; E N D ; F i g . 4 . 9 : O u t p u t f r o m R E P L A C E f u n c t i o n ( c o n t ' d ) i n t h e f i l t e r f i l e t h a t a r e i n t h e f i l t e r . i n f i l e a r e p u t i n t o o n e o u t p u t f i l e ( F i g . 4 . 1 2 ) w h i l e t h e r e m a i n i n g l i n e s a r e p u t i n t o a n o t h e r o u t p u t f i l e ( F i g . 4 . 1 3 ) . T h i s i s o l a t e s t h e i n p u t s t a g e e l e m e n t s f r o m t h e i n t e g r a t o r s t a g e s o f t h e f i l t e r . 4 . 3 . 2 F O R M I N G T H E I N T E G R A T O R S ( S T A G E S ) T h e c i r c u i t e l e m e n t s a r e now g a t h e r e d i n t o i n t e g r a t o r s w i t h t h e e l e m e n t s s h a r i n g a c o m m o n i n v e r t i n g o p e r a t i o n a l a m p l i f i e r n o d e ( F i g . 4 . 4 ) . E a c h i n t e g r a t o r c o n s i s t s o f o n e o p e r a t i o n a l a m p l i f i e r , o n e i n t e g r a t i n g c a p a c i t o r , a t l e a s t o n e s w i t c h e d c a p a c i t o r , a n d a n y c o u p l i n g c a p a c i t o r s . T h i s g r o u p i n g i s d o n e f o r e a c h o p e r a t i o n a l a m p l i f i e r a s i t i s f o u n d i n t h e f i l t e r f i l e . T h e f l o w c h a r t o f t h e S T A G E S f u n c t i o n i s s h o w n i n F i g . 4 . 1 4 . E a c h e l e m e n t i s a l s o r e c o d e d h e r e f o r c o n v e n i e n c e . T h e o p e r a t i o n a l a m p l i f i e r s a r e c a l l e d O A , t h e s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s a r e c a l l e d S C , t h e i n t e g r a t i n g 5TRRT Open File, in readc i e 3 n ( I i n e , F 11 e . i n ) UHILE not end~oF_F tie IF i ine not empty ur L t e(i i ne,1 : 1 el ) resdci e 9 n C i ine,F 1 i e . in) Ci ose File. Ln readiI Inej inF[i e ) UHILE not end-oF-File set Flag readiI ine2;F LI el ) UHILE Flag and not end-oF-File IF I Inel equals. I ine2 reset Fi 3g read(i lne2,F 11 el ) IF Rag ur11 e(I i ne (on tFlie) new i n d(Fllel) readi i ine, inF i1e ) END F i g . 4 . 1 0 ; I S O L A T E f u n c t i o n f l o w c h a r t /* input section */ CO (2 0) 1.00 ; C l (52 53) 1.00 ; C l (54 55) 1.00 ; S (1 2) #C ; S ( 3 52) C ; S (52 0) #C ; S (53 10) C ; S (53 0) #C ; S ( 3 54) #C ; S (54 0) C ; S (55 10) #C ; S (55 0) C ; E l (3 0 2 3) 5000 ; F i g . 4 . 1 1 : I n p u t s e c t i o n ( f i l t e r . i n ) CO (2 0) 1.00 ; C l (52 53) 1.00 ; C l (54 55) 1.00 ; S (1 2) #C ; S ( 3 52) C ; S (52 0) #C ; S (53 10) C ; S (53 0) #C ; S ( 3 54) #C ; S (54 0) C ; S (55 10) #C ; S (55 0) C ; E l (3 0 2 3) 5000 ; F i g . 4 . 1 2 : I s o l a t e d i n p u t s e c t i o n SI < '12 !AA) #C • 9 S2 < '!AA 0) C ; S4 | [!AB 0) C ; C l | [!AA !AB) 3. 00 S3 { [!AB 10) #C • 9 SI [12 !AC) #C • 9 S2 !AC 0) C ; S4 '!AD 0) #C ; C l !AC !AD) 4. 00 S3 [!AD 20) C ; SI [22 !AE) #C • 9 S2 [!AE 0) C ; S4 [!AF 0) C ; C l [!AE !AF) 6. 00 S3 [!AF 10) #C • SI [42 !AG) #C • S2 '!AG 0) C 7 S4 [!AH 0) C ; C l •AG !AH) 12 .00 S3 !AH 10) #C • 9 SI 30 !AI) #C • 9 S2 [!AI 0) C ; S4 [!AJ 0) C ; C l [!AI !AJ) 8. 00 S3 [!AJ 32) #C • SI [40 !AK) C ; S2 [IAK 0) #C ; S4 [! AL 0) C ; C l [! AK ! AL) 9. 00 S3 [!AL 32) #C • 9 SI 42 !AM) #C • S2 '!AM 0) C ; S4 ' 1AN 0) C ; C l ;!AM !AN) 11 .00 S3 ;!AN 30) #C • SI |22 !AO) #C • S2 (!AO 0) C ; S4 (!AP 0) C ; C l (!AO !AP) 13 .00 S3 [!AP 30) #C • 9 C2 [10 12) 2.00 ; C5 [22 20) 5.00 ; C14 (10 32) 14. 00 CIO (40 42) 10. 00 C15 (12 30) 15. 00 C7 (30 32) 7.00 ; E5 (42 0 0 40) 5000 E3 (22 0 0 20) 5000 E4 (32 0 0 30) 5000 E2 (12 0 0 10) 5000 F i g . 4 . 1 3 : R e m a i n d e r o f f i l t e r d e s c r i p t i o n START UHILE nor end_o F-Flle IF op _amp ur I ieC I Ine,oui File) s a v e Input and output nodes save File oFFsei reu Ind File readCI Ine, InF11e ) UHILE noi end-oF-Flle IF capac I l o r save nodes IF s h a r e s b o i h op~amp nodes encode as IC ELSE encode as CC IF s u I t c h s a ve nodes IF s h a r e node w I t h op _amp SISC readCIIne, I n F l l e ) w r i t e b l a n k IIne to ou t F l l e restore File location r e a d C I I n e , I n F l i e ) END F i g . 4 . 1 4 ; S T A G E S f u n c t i o n f l o w c h a r t START sBt>e c lockl save F i l e oFFset rewind F i l e resdC I Ine, I n F l l e ) UHILE not e n d J o F - F l l e IF c3pBcI tor S 8 c e nodes IF shared node with switch sBi/e cBpScltor value seue neu node sSwe F i l e oFFset reuInd F i l e resd( I Inej inF 11, e) UHILE not end-oF-Ftle IF su Itch sB^e nodes IF F i r s t ground switch sBwe c l o c k 2 IF second ground switch sSt>e cl. ock4 IF output switch save c l o c k 3 resdC I Ine, InF l i e ) w r i t e SISC element r e s t o r e F i l e l o c a t i o n resdCIIne, InF11e) r e s t o r e F i l e l o c a t i o n END F i g . 4 . 1 5 : S I S C f u n c t i o n f l o w c h a r t 41 c a p a c i t o r s a r e c a l l e d I C , a n d t h e c o u p l i n g c a p a c i t o r s a r e c a l l e d C C . A l l c a p a c i t o r s h a v e a ' C a s t h e s e c o n d l e t t e r o f t h e i r l a b e l s . T h e i n v e r t i n g i n p u t n o d e o f e a c h o p e r a t i o n a l a m p l i f i e r i s u s e d t o g a t h e r u p t h e i n t e g r a t o r e l e m e n t s . A c a p a c i t o r s h a r i n g b o t h i n p u t a n d o u t p u t n o d e w i t h t h e o p e r a t i o n a l a m p l i f i e r i s a n i n t e g r a t i n g c a p a c i t o r , w h i l e a c a p a c i t o r t h a t o n l y s h a r e s t h e i n p u t n o d e i s a c o u p l i n g c a p a c i t o r . I f a s w i t c h i s f o u n d c o n n e c t e d t o t h e i n p u t n o d e , i t m u s t b e l o n g t o a s w i t c h e d c a p a c i t o r e l e m e n t . T h e S I S C f u n c t i o n ( F i g . 4 . 1 5 ) g a t h e r s u p t h e r e m a i n i n g e l e m e n t s o f t h e s w i t c h e d c a p a c i t o r . S i n c e s w i t c h - s h a r i n g m a y b e u s e d , i t i s n e c c e s s a r y t o c h e c k f o r m o r e t h a n o n e s w i t c h e d c a p a c i t o r f o r e a c h s w i t c h ( F i g . 4 . 1 6 ) . T h e s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r e l e m e n t ( F i g . 4 . 1 7 ) i s t h e n r e c o d e d a s f o l l o w s : S C ( n o d e A n o d e B ) C <j>2 $3 <i>n ; w h e r e n o d e A c o n n e c t s t o t h e o p e r a t i o n a l a m p l i f i e r i n v e r t i n g i n p u t n o d e . T h i s n o d e i s t h e r e f e r e n c e p o i n t f o r t h e c l o c k i n g s c h e m e . T h e c o m p l e m e n t a r y c l o c k m u s t b e d e s i g n a t e d b y t h e ' # ' c h a r a c t e r . T h e o u t p u t f r o m t h e S T A G E S f u n c t i o n i s s h o w n i n F i g . 4 . 1 8 . F i g . 4 . 1 7 : S t r a y i n s e n s i t i v e S C e l e m e n t 43 4 . 4 S O R T I N G T H E F I L T E R 4 . 4 . 1 P R O C E S S I N G T H E I N P U T S T A G E ( I N P U T ) T h e i n p u t s t a g e o f t h e f i l t e r i s now r e c o d e d a n d t h e e l e m e n t s s o r t e d i n t o a s u i t a b l e o r d e r . T h e n o d e b y w h i c h t h e i n p u t s t a g e c o n n e c t s t o t h e f i l t e r i s s a v e d h e r e . T h e r e i s o n e I N P U T f u n c t i o n f o r e a c h o f t h e d e s i g n t e c h n i q u e s . T h e e l e m e n t s o f t h e i n p u t s t a g e s a r e s w i t c h e s ( B S ) , c a p a c i t o r s ( B C ) , s t r a y i n s e n s i t i v e s w i t c h e d c a p a c i t o r s ( S C ) , a n d o p e r a t i o n a l a m p l i f i e r s ( O A ) . A n y o p e r a t i o n a l a m p l i f i e r i s l i s t e d f i r s t , f o l l o w e d b y a n y s w i t c h e s . A n y c a p a c i t o r s a r e l i s t e d n e x t , f o l l o w e d b y a n y s w i t c h e d c a p a c i t o r s . T h e OA (42 0 0 40) 5000 ; SC (40 32) 9.00 C #C #C C IC (40 42) 10.00 ; OA (22 0 0 20) 5000 ; SC (20 12) 4.00 C #C #C C IC (22 20) 5.00 ; OA (32 0 0 30) 5000 ; SC (30 32) 8.00 #C C #C C SC (30 42) 11.00 #C C #C C SC (30 22) 13.00 #C C #C C CC (12 30) 15.00 ; IC (30 32) 7.00 ; OA (12 0 0 10) 5000 ; SC (10 12) 3.00 #C C #C C SC (10 22) 6.00 #C C #C C SC (10 42) 12.00 #C C #C C IC (10 12) 2.00 ; CC ( i o 32) 14.00 ; F i g . 4 . 1 8 : O u t p u t f r o m S T A G E S f u n c t i o n 44 r e c o d e d a n d s o r t e d o u t p u t i s w r i t t e n t o t h e f i l t e r . c t f i l e ( F i g . 4 . 1 9 ) . T h e d i f f e r e n t i n p u t f u n c t i o n s a r e d e s c r i b e d f u r t h e r b e l o w . 4 . 4 . 1 . 1 I N P U T 1 ( L e e ) T h i s i n p u t s t a g e ( F i g . 4 . 1 ) c o n s i s t s o f f o u r e l e m e n t s : t w o c a p a c i t o r s , a n d t w o s w i t c h e s . T h e s w i t c h e s a r e w r i t t e n f i r s t , f o l l o w e d b y t h e c a p a c i t o r c o n n e c t e d t o t h e i n p u t n o d e , f o l l o w e d b y t h e g r o u n d e d c a p a c i t o r . T h e i n p u t n o d e i s l i s t e d f i r s t f o r t h e f i r s t c a p a c i t o r , a n d t h e f i l t e r c o n n e c t i o n n o d e i s t h e o t h e r n o d e o f t h i s e l e m e n t . 4 . 4 . 1 . 2 I N P U T 2 ( M a r t i n ) T h e S T A G E S f u n c t i o n c a n p r o c e s s a l l e l e m e n t s o f t h i s d e s i g n t e c h n i q u e , h e n c e t h e f i l t e r . i n f i l e i s e m p t y . T h e f i l t e r c o n n e c t i o n n o d e i s t h e f i r s t n o d e o f t h e S C e l e m e n t c o n n e c t e d t o t h e f i l t e r i n p u t n o d e . OA (3 0 2 3) 5000 ; B C (2 0) 1.00 ; B S (1 2) #C ; S C (3 10) 1.00 C #C C #C ; S C (10 3) 1.00 #C C #C C ; F i g . 4 . 1 9 : F i n a l i n p u t s t a g e d e s c r i p t i o n 4 5 4 . 4 . 1 . 3 I N P U T 3 ( D a t a r a n d S e d r a ) T h i s i n p u t s t a g e c o n s i s t s o f o n e o p e r a t i o n a l a m p l i f i e r , o n e s w i t c h , o n e c a p a c i t o r , a n d t w o s w i t c h e d c a p a c i t o r s ( F i g . 4 . 2 ) . T h e o p e r a t i o n a l a m p l i f i e r i s w r i t t e n f i r s t , f o l l o w e d b y t h e s w i t c h a n d t h e g r o u n d e d c a p a c i t o r . O n e o f t h e S C e l e m e n t s c a n b e s w i t c h - s h a r e d w i t h t h e f i r s t i n t e g r a t o r , a n d i t i s w r i t t e n l a s t . T h e o t h e r S C e l e m e n t i s w r i t t e n n e x t , f o l l o w e d b y t h e a b o v e S C e l e m e n t . T h e S C e l e m e n t s a r e g a t h e r e d u p b y t h e S I S C f u n c t i o n . T h e f i l t e r c o n n e c t i o n n o d e i s t h e s e c o n d n o d e o f e i t h e r S C e l e m e n t . 4 . 4 . 1 . 4 I N P U T 4 ( A R O M A ) T h e b i q u a d s t a g e s u s e d b y t h e AROMA p r o g r a m a r e s i m i l a r t o t h e d e s i g n t e c h n i q u e o f M a r t i n . T h e f i l t e r . i n f i l e i s a g a i n e m p t y , a s t h e S T A G E S f u n c t i o n c a n h a n d l e a l l t h e e l e m e n t s . T h e f i l t e r c o n n e c t i o n n o d e i s o b t a i n e d f r o m S C e l e m e n t ( s ) c o n n e c t e d t o t h e f i l t e r i n p u t n o d e . I f o n l y o n e S C e x i s t s c o n n e c t e d t o t h e f i l t e r i n p u t n o d e , t h e c o n n e c t i o n n o d e i s i t s s e c o n d n o d e . I f t h e r e i s a c h o i c e o f p o s s i b l e c o n n e c t i o n n o d e s , t h e n o d e o c c u r r i n g o n l y o n c e i s c h o s e n . 4 . 4 . 2 S O R T I N G T H E I N T E G R A T O R S ( O R D E R 1 ) T h e i n t e g r a t o r s t a g e s a r e s o r t e d i n t o a n o r d e r s u i t a b l e f o r d i r e c t l a y o u t b y t h e O R D E R 1 f u n c t i o n . T h i s s o r t i n g s t a r t s w i t h t h e n o d e p r o v i d e d b y t h e a p p r o p r i a t e I N P U T f u n c t i o n . 46 M a n y b i q u a d f i l t e r s a s w e l l a s b i l i n e a r l o w - p a s s f i l t e r s h a v e a f i l t e r t o p o l o g y s i m i l a r t o t h a t o f F i g . 4 . 2 0 . B a n d p a s s f i l t e r s a r e m o r e c o m p l e x a s s h o w n i n F i g . 4 . 2 1 a n d t h e AROMA p r o g r a m g e n e r a t e s b i q u a d s e c t i o n s a s s h o w n i n F i g . 4 . 2 2 . E a c h i n t e g r a t o r i s r e p r e s e n t e d b y o n e b o x . O n l y S C e l e m e n t s a r e u s e d a s l i n k s i n t h e s o r t i n g p r o c e s s . T h e s o r t p r o c e e d s b y t h e S C e l e m e n t s f e d b y e a c h o p e r a t i o n a l a m p l i f i e r , a n d o n c e c o u n t e d , a n o p e r a t i o n a l a m p l i f e r m a y n o t b e c o u n t e d a g a i n . I n a l l c a s e s , t h e f i l t e r c o n n e c t i o n n o d e p r o v i d e s t h e f i r s t i n t e g r a t o r s t a g e , a n d i t s o u p u t n o d e i s u s e d t o s t a r t t h e s e a r c h p a t h . I t i s a s s u m e d t h a t n o i n t e g r a t o r c a n f e e d m o r e t h a n t w o u n s o r t e d i n t e g r a t o r s . I f o n l y o n e i s f o u n d , t h e s o r t i s s i m p l e a n d l i n e a r . I f t w o new i n t e g r a t o r s a r e V, F i g . 4 . 2 0 ; L i n e a r t o p o l o g y 47 F i g . 4 . 2 1 : B a n d - p a s s f i l t e r t o p o l o g y 4 * 3 F i g . 4 . 2 2 : AROMA f i l t e r t o p o l o g y STRRT r e B d C I i n e . InF i I e ) UHILE not end~oF~F Ie IF op -8mp s8ve nodes IF s h a r e c o n n e c t ion node note op _Bmp output node I r e B d C I i n e j inF i 1 e ) r e u ind F i l e DD get s t a g e oFFset 9nd Feeds w r i t e s t a g e to output F i l e IF s i n g l e Feed update s e S r c h p a t h ELSE UHILE more d o u b l e Feeds get s t a g e 2 oFFset 3nd Feeds get s t a g e 3 oFFset and Feeds IF s t S g e 2 has no Feeds ur i t e s t a g e 2 to output F i l e w r i t e s t s g e 3 to out p u t F i l e update s e B r c h p a t h ELSE IF s t e g e 3 has no Feeds w r i t e s t a g e 3 to output F i l e w r i t e s t 8 g e 2 to output F i l e update s e B r c h p a t h UHILE more Feeds u r i t e node t a b l e to F i l e . n d END F i g . 4 . 2 3 : O R D E R 1 f u n c t i o n f l o w c h a r t 49 f o u n d , t h e y a r e i n t u r n p r o c e s s e d , a n d t h e o n e y i e l d i n g n o new p a t h s i s w r i t t e n f i r s t , f o l l o w e d b y t h e o t h e r . T h e s o r t i n g c o n t i n u e s u n t i l n o new i n t e g r a t o r s a r e f o u n d . T h i s s o r t i n g a l w a y s p u t s t h e f i l t e r o u t p u t s t a g e l a s t o r n e x t - t o - l a s t . T h e f l o w c h a r t o f t h e O R D E R1 f u n c t i o n i s s h o w n i n F i g . 4 . 2 3 , a n d t h e o u t p u t f r o m t h e f u n c t i o n i s s h o w n i n F i g . 4 . 2 4 . A s e a c h n o d e p a i r i s f o u n d b y t h e s o f t w a r e , i t i s s a v e d f o r u s e b y t h e 0 R D E R 2 f u n c t i o n , a n d i s a l s o w r i t t e n t o t h e f i l t e r . n d f i l e . T h e f i l t e r i n p u t a n d o u t p u t n o d e s a r e w r i t t e n f i r s t , f o l l o w e d b y a n y n o d e s e x i s t i n g i n t h e i n p u t s t a g e , t h e n t h e n o d e s o f t h e o p e r a t i o n a l a m p l i f i e r s . T h e O A ( 1 2 0 0 1 0 ) 5 0 0 0 ; S C ( 1 0 1 2 ) 3 . 0 0 #C C #C C ; S C ( 1 0 2 2 ) 6 . 0 0 #C C #C C ; S C ( 1 0 4 2 ) 1 2 . 0 0 #C C #C C ; I C ( 1 0 1 2 ) 2 . 0 0 ; C C ( 1 0 3 2 ) 1 4 . 0 0 ; O A ( 2 2 0 0 2 0 ) 5 0 0 0 ; S C ( 2 0 1 2 ) 4 . 0 0 C #C #C C ; I C ( 2 2 2 0 ) 5 . 0 0 ; O A ( 3 2 0 0 3 0 ) 5 0 0 0 ; S C ( 3 0 3 2 ) 8 . 0 0 #C C #C C ; S C ( 3 0 4 2 ) 1 1 . 0 0 #C C #C C ; S C ( 3 0 2 2 ) 1 3 . 0 0 #C C #C C ; C C ( 1 2 3 0 ) 1 5 . 0 0 ; I C ( 3 0 3 2 ) 7 . 0 0 ; O A ( 4 2 0 0 4 0 ) 5 0 0 0 ; S C ( 4 0 3 2 ) 9 . 0 0 C #C #C C ; I C ( 4 0 4 2 ) 1 0 . 0 0 ; F i g . 4 . 2 4 : O u t p u t f r o m O R D E R 1 f u n c t i o n 50 i n v e r t i n g i n p u t n o d e i s w r i t t e n b e f o r e t h e o u t p u t n o d e f o r e a c h o p e r a t i o n a l a m p l i f i e r . T h e f i l t e r . n d f i l e i s s h o w n i n F i g . 4 . 2 5 . 4 . 4 . 3 S O R T I N G T H E E L E M E N T S A N D N O D E S ( O R D E R 2 ) T h e e l e m e n t s a n d t h e i r n o d e s a r e now s o r t e d f o r e a c h i n t e g r a t o r b y t h e O R D E R 2 f u n c t i o n . I t u s e s t h e n o d a l o r d e r i n g i n f o r m a t i o n s a v e d b y t h e O R D E R 1 f u n c t i o n t o d o t h i s . T h e O R D E R 2 f l o w c h a r t i s s h o w n i n F i g . 4 . 2 6 . E a c h e l e m e n t o f a n i n t e g r a t o r i s s t o r e d i n a n a r r a y a n d i s w r i t t e n t o t h e f i l t e r . c t f i l e w h e n t h e n o d e n o t c o n n e c t e d t o t h e i n v e r t i n g i n p u t o f t h e o p e r a t i n g a m p l i f i e r i s f o u n d i n t h e n o d a l o r d e r i n g t a b l e . T h e n o d a l t a b l e i s s c a n n e d f r o m b e g i n n i n g t o e n d c a u s i n g e l e m e n t s f e e d i n g t o w a r d s t h e f i l t e r 1 3 2 2 3 1 0 1 2 2 0 2 2 3 0 3 2 4 0 4 2 F i g . 4 . 2 5 : C I R C E o u t p u t f i l e ( f i l t e r . n d ) START readC I Ine, InF l ie ) UHILE not end-oF-Flle sBL>e pp~Bmp nodes w r l t e C l I n e ; F i l e , c t ) sace r e s t oF stage tn a r r a y r e s e t Flag FDR each node In F i l t e r FDR each element tn Br ray SBwe element nodes IF node Is op~3mp output IF IC element IF IC across op~3mp set Flag s o r t nodes wrlteCl l n e , F l l e , c t ) ELSE IF npde Is op~3mp tnput IF SC element IF SC across op~3mp sort nodes [ | w r l t e C l lne,Fl. l e . c t ) i ELSE IF F i r s t node s3me IF CC element s o r t nodes w i t h Flag iteCl I n e , F i l e , c O ELSE IF second node same IF CC element s o r t nodes u t t h Flag [ LirlteCl l n e ; F l l e , c t ) 1 write blank l ine to Ftte.ct readC I Ine, InF l ie ) END F i g . 4 . 2 6 : O R D E R 2 f u n c t i o n f l o w c h a r t 52 OA (3 0 2 3) 5000 ; B C (2 0) 1.00 ; B S (1 2) #C ; S C (3 10) 1.00 C #C C #C ; S C (10 3) 1 .00 #c c #c c ; OA (12 0 0 10) 5000 ; I C (10 12) 2.00 ; S C (10 12) 3.00 #C C #C C ; S C (10 22) 6.00 #C C #C C ; C C (10 32) 14.00 ; S C (10 42) 12.00 #C C #C C ; OA (22 0 0 20) 5000 ; S C (20 12) 4.00 C #C #C C ; I C (20 22) 5.00 ; OA (32 0 0 30) 5000 ; C C (12 30) 15.00 ; S C (30 22) 13.00 #C C #C C ; I C (30 32) 7.00 ; S C (30 32) 8.00 #C C #C C ; S C (30 42) 11.00 #C C #C C ; OA (42 0 0 40) 5000 ; S C (40 32) 9.00 C #C #C C ; I C (40 42) 10.00 ; F i g . 4.27: C I R C E o u t p u t f i l e ( f i l t e r . c t ) i n p u t t o b e w r i t t e n b e f o r e e l e m e n t s f e e d i n g t o w a r d s t h e f i l t e r o u t p u t f o r e a c h i n t e g r a t o r . T h e o p e r a t i o n a l a m p l i f i e r i n p u t n o d e i s p l a c e d f i r s t f o r t h e I C a n d t h e S C e l e m e n t s , w h i l e t h e n o d e s f o r t h e C C e l e m e n t s a r e s o r t e d s o t h a t t h e f i r s t n o d e f e e d s t o w a r d s t h e f i l t e r i n p u t . A S C e l e m e n t c o n n e c t e d f r o m t h e o p e r a t i o n a l a m p l i f i e r i n p u t t o i t s o u t p u t i s p l a c e d a f t e r t h e I C e l e m e n t . 53 T h e f i l t e r . c t f i l e i s c o m p l e t e d b y t h e O R D E R 2 f u n c t i o n ( F i g . 4 . 2 7 ) , w i t h t h e f i r s t p a r t w r i t t e n b y t h e I N P U T f u n c t i o n . T h e f i l t e r . c t a n d t h e f i l t e r . n d f i l e s a r e t h e o u t p u t f r o m t h e C I R C E p r o g r a m . T h e s e f i l e s a r e u s e d b y t h e l a y o u t g e n e r a t o r p r o g r a m i n g e n e r a t i n g t h e f i l t e r l a y o u t . 5 . T H E L A Y O U T G E N E R A T O R ( S I S C L ) 5 . 1 I N T R O D U C T I O N T h e l a y o u t g e n e r a t o r p r o g r a m ( c a l l e d S I S C L , f o r S t r a y I n s e n s i t i v e S w i t c h e d C a p a c i t o r L a y o u t ) g e n e r a t e s a n I S O C M O S l a y o u t o f t h e s w i t c h e d c a p a c i t o r f i l t e r i n C a l t e c h I n t e r m e d i a t e F o r m ( C I F ) . I t u s e s t h e i n f o r m a t i o n i n t h e f i l t e r . n d a n d t h e f i l t e r . c t f i l e s a s w e l l a s a l a y o u t p a r a m e t e r f i l e c a l l e d f i l t e r . c o m . T h e o p e r a t i o n a l a m p l i f i e r C I F c o d e i s s t o r e d i n a f i l e c a l l e d o p a m p . c i f . T h e p r o g r a m c a n g e n e r a t e f i l t e r l a y o u t s f r o m t h e f o u r d e s i g n t e c h n i q u e s d e s c r i b e d i n t h e p r e v i o u s c h a p t e r . T h e r e a r e t h i r t e e n m a i n f u n c t i o n s t o t h e l a y o u t g e n e r a t o r p r o g r a m a n d f o r t y - o n e f u n c t i o n s i n t o t a l . T h e o u t p u t f i l e ( c a l l e d f i l t e r . c i f ) i s w r i t t e n b y t h r e e f u n c t i o n s . O n e w r i t e s B O X c o m m a n d s , o n e w r i t e s W I R E c o m m a n d s a n d t h e l a s t o n e w r i t e s c e l l c a l l s . T h i s m a k e s i t e a s i e r t o c o n v e r t t h e s o f t w a r e i n t o d o i n g l a y o u t s i n a n o t h e r f o r m a t . T h e f l o w c h a r t o f t h e l a y o u t g e n e r a t o r p r o g r a m i s s h o w n i n F i g . 5 . 1 . A l i s t i n g o f t h e s o f t w a r e i s p r o v i d e d i n A p p e n d i x D . 5 . 2 T H E O P E R A T I O N A L A M P L I F I E R A s t a n d a r d c e l l o p e r a t i o n a l a m p l i f i e r i s u s e d , w h i c h m u s t h a v e c e r t a i n g e n e r a l f e a t u r e s ( F i g . 5 . 2 ) . T h e o p e r a t i o n a l a m p l i f i e r d a t a i s p u t i n t o t h e f i l t e r . c o m f i l e a s s h o w n i n F i g . 5 . 3 . T h e p o w e r l i n e s m u s t b e i n m e t a l , a n d V D D m u s t b e o n t o p . T h e i n p u t s a n d o u t p u t m u s t e m e r g e o n t o p 54 55 START I N I T - Read t h e i n p u t p a r a m e t e r s From t h e F i i e s CRPRRRRY - G e n e r a t e t h e c a p a c i t o r a r r a y PREDP - S e l e c t t h e s w i t c h - p a i r a n d o p _ a m p l o c a t i o n s UI RE _ U i r e t h e c a p a c i t o r s t o t h e p l a c e d s u i t c h _ p a i r s PLACE - C o n n e c t t o o p e r a t i o n a s u i t c h ~ p a i r s 1 amp 1 i F i e r s URAPUP - L a y o u t g l o b a l F e a t u r e s INPUT - U i r e t h e a p p r o p r i a t e i n p u t s t a g e END F i g . 5 . 1 : S I S C L f l o w c h a r t 56 • c e n t 2 ] c o n C 1 1 -con [0] — VDD uid[0] i d [ ] ] f i n + i n • x o r g 1 CD L n m w i d [ 2 3 T~ i d t h F i g . 5 . 2 : O p e r a t i o n a l a m p l i f i e r p a r a m e t e r s X ( urn) x o r g ( X) h e i g h t ( X) cor,[ 0 ] ( X) ^ o s [ 0 ] ( X) w i d [ 0 ] ( X) a r r a y h e i g h t y o r g ( X) w i d t h ( X) conf 1 ] ( X) w s [ 1 ] ( X) u l d t l ] ( X ) 9 r r 3 y s u ) i t c h I e v e I C X) c o n [ 2 J ( X) u o s [ 2 ] ( X) wld[2] ( X) F i g . 5 . 3 : F i l t e r . c o m f i l e f o r m a t 57 i n p o l y s i l i c o n l o f w i d t h 2 X . T h e i n p u t s s h o u l d b e g r o u p e d t o g e t h e r b u t i t d o e s n o t m a t t e r w h i c h o n e i s t o t h e l e f t o r r i g h t . T h e o r i g i n o f t h e o p e r a t i o n a l a m p l i f i e r ( x o r g , y o r g ) , c a n b e u s e d t o a d j u s t t h e v e r t i c a l p l a c e m e n t o f t h e c e l l , a s w e l l a s t h e g a p s o n t h e l e f t a n d r i g h t s i d e s o f t h e o p e r a t i o n a l a m p l i f i e r . A l l t h e o p e r a t i o n a l a m p l i f i e r p a r a m e t e r s s h o u l d b e i n u n i t s o f X . T h e o p e r a t i o n a l a m p l i f i e r u s e d i n t h i s t h e s i s i s p l o t t e d i n F i g . 5 . 4 . T h e o p e r a t i o n a l a m p l i f i e r C I F c o d e m u s t b e s y m b o l # 2 . T h e f i l t e r l a y o u t i t s e l f i s s y m b o l # 1 . T h e f i r s t l i n e o f t h e f i l t e r . c o m f i l e c o n s i s t s o f t h e s c a l i n g f a c t o r X o f t h e f a b r i c a t i o n p r o c e s s . T h i s i s f o l l o w e d b y t h e h e i g h t o f t h e c a p a c i t o r a r r a y a n d t h e c a p a c i t o r s i z e a t w h i c h t h e c a p a c i t o r l a y o u t s t r a t e g y c h a n g e s . T h e r e m a i n i n g p a r a m e t e r s d e s c r i b e t h e p h y s i c a l s h a p e o f t h e o p e r a t i o n a l a m p l i f i e r s t a n d a r d c e l l . 5 . 3 R E A D I N G T H E I N P U T D A T A ( I N I T ) T h e d a t a s t o r e d i n t h e f i l t e r . n d , f i l t e r . c t , a n d f i l t e r . c o m f i l e s i s r e a d b y t h e I N I T f u n c t i o n . T h e n o d e d a t a i s p u t i n t o a c h a r a c t e r a r r a y c a l l e d T A B L E , w h i c h i s s c a n n e d w h e n e v e r c o n n e c t i o n s h a v e t o b e m a d e t o t h e n o d e s . T h e o p e r a t i o n a l a m p l i f i e r p a r a m e t e r s a r e p u t i n t o a d a t a s t r u c t u r e c a l l e d O P A M P w h i c h i s u s e d f o r t h e o p e r a t i o n a l a m p l i f i e r p l a c e m e n t a n d w i r i n g . T h e c a p a c i t o r a n d s w i t c h d a t a i s p u t i n t o a d a t a s t r u c t u r e c a l l e d C A P A C , w h i c h i s 58 F i g . 5 . 4 : O p e r a t i o n a l a m p l i f i e r l a y o u t u s e d t o g e n e r a t e t h e c a p a c i t o r a r r a y , i t s w i r i n g , a n d t h e s w i t c h e s . E a c h c a p a c i t o r h a s i t s v a l u e a n d n o d e s s a v e d . T h e I C e l e m e n t s a r e g i v e n t h e c l o c k i n g s c h e m e o f t h e f i r s t s w i t c h - p a i r o f t h e S C e l e m e n t s t o w h i c h i n t e g r a t o r i t b e l o n g s . T h e S C e l e m e n t s a r e g i v e n t h e c l o c k i n g s c h e m e o f t h e s e c o n d s w i t c h - p a i r o f i t s d e s c r i p t i o n . T h e t o t a l n u m b e r o f c a p a c i t o r s a n d o p e r a t i o n a l a m p l i f i e r s i s a l s o c o u n t e d h e r e . T h e f l o w c h a r t o f t h e I N I T f u n c t i o n i s s h o w n i n F i g . 5 . 5 . START Read F11ier.com data Read Filter.nd data readlIInej F 11ter, cO UHILE not end-oF-Flle IF suItch save c I ock IF capacitor s8ue capacitor lvalue sewe nodes set layout style IF su I tched~capac I tor set capacitor type s e t c a p a c i t o r c l o c k save additional clock IF Integrating capacitor set capacitor type IF coup I I. no capacitor set capacitor type Increment capacitor count IF op~Bmp Increment stage count readCI Ine,F11ter.ct ) FOR e ach capBcI tor IF In tegratlng capacitor FOR each capacitor IF same Input node save c l o c k For IC END F i g . 5 . 5 ; I N I T f u n c t i o n f l o w c h a r t 60 5 . 4 T H E C A P A C I T O R S 5 . 4 . 1 T H E C A P A C I T O R A R R A Y T h e c a p a c i t o r a r r a y l a y o u t i s d o n e b y t h e C A P A R R A Y f u n c t i o n . I t i s i m p o r t a n t t o a c h i e v e a h i g h a c c u r a c y ( t y p i c a l l y 0 . 1 % ) i n t h e c a p a c i t o r a r e a r a t i o s t o e n s u r e a h i g h q u a l i t y f i l t e r r e s p o n s e . T h e t i m e c o n s t a n t r o f t h e i n t e g r a t o r i s g i v e n b y r = ^ ( 5 . 1 ) w h e r e T i s t h e c l o c k r a t e . A s s u m i n g a n a c c u r a t e c l o c k , t h e p r o b l e m i s t o m i n i m i z e t h e c a p a c i t o r r a t i o e r r o r i n t h e c a p a c i t o r p l a c e m e n t [ 1 3 ] [ 1 4 ] . L e t t h e e r r o r i n c a p a c i t o r C , b e A C 1 f a n d l e t t h e e r r o r i n c a p a c i t o r C 2 b e A C 2 . T h e c a p a c i t o r r a t i o i s LL . C , ± A C , C 2 C 2 ± A C 2 K t > ' Z } w h e r e a n d C 2 a r e t h e r e a l i z e d c a p a c i t a n c e s . T h i s c a n b e r e a r r a n g e d a s c t ( c t ) ( 1 ± A C 2 / C 2 * ( 5 * 3 ) T h e c a p a c i t a n c e C , i s e q u a l t o ( 5 . 4 ) 61 w h e r e e i s t h e S i 0 2 p e r m i t t i v i t y , A , i s t h e c a p a c i t o r a r e a , a n d d i s t h e c a p a c i t o r p l a t e s e p a r a t i o n . A s s u m i n g t h a t d a n d e a r e c o n s t a n t f o r a l l c a p a c i t o r s , e q u a t i o n 5 . 3 c a n b e r e w r i t t e n a s LL _ ( C_L 1 ± AA i / A i . C 2 C 2 1 ± A A 2 / A 2 ( 5 . 5 ) T o s a t i s f y t h e c o n d i t i o n C 2 C 2 i t i s r e q u i r e d t h a t (5.6) ^ - ^ ( 5 . 7 ) A , A 2 A s s u m i n g a s y s t e m a t i c e r r o r i n t h e c a p a c i t o r a r e a s , t h e a r e a e r r o r i s a p p r o x i m a t e l y e q u a l t o A A = P d x ( 5 . 8 ) w h e r e P i s t h e c a p a c i t o r p e r i m e t e r . E q u a t i o n 5 . 7 i s t h e n e q u i v a l e n t t o A , A 2 t h a t i s , t h e p e r i m e t e r - t o - a r e a r a t i o o f t h e c a p a c i t o r s s h o u l d b e a c o n s t a n t . T h i s c a n b e a c c o m p l i s h e d b y m a k i n g t h e s m a l l e r c a p a c i t o r a s q u a r e , a n d t h e l a r g e r c a p a c i t o r a n i n t e g r a l n u m b e r o f t h e s e s q u a r e s p l u s a f r a c t i o n a l a m o u n t i f 62 n e c e s s a r y . T h i s i s a l s o c o n v e n i e n t f r o m t h e v i e w p o i n t o f l a y o u t s t r a t e g y b e c a u s e t h e c a p a c i t o r s c a n b e p l a c e d o n e s q u a r e a t a t i m e . T y p i c a l l y o n e c a p a c i t o r s q u a r e e q u a l s o n e u n i t o f c a p a c i t a n c e . T h e l a y o u t s t r a t e g y m u s t y i e l d a c c u r a t e a r e a r a t i o s , g o o d p e r i m e t e r - t o - a r e a r a t i o s , a n d i m m u n i t y f r o m t h e e f f e c t s o f p o l y s i l i c o n 1 - p o l y s i l i c o n 2 m a s k m i s a l i g n m e n t . 5 . 4 . 2 L A Y O U T M E T H O D T h e u n i t c a p a c i t o r p l a t e i s s h o w n i n F i g . 5 . 6 . T h e e d g e s o f t h e p o l y s i l i c o n 2 s q u a r e a r e e a c h o f l e n g t h E , a n d t h e p o l y s i l i c o n l s q u a r e o v e r l a p s i t b y 1 X . E a c h u n i t p l a t e i s j o i n e d t o t h e p r e v i o u s u n i t p l a t e b y a 2X b y 2X p o l y s i l i c o n l l i n k . T h e f i r s t u n i t p l a t e w i l l h a v e ' a p o l y s i l i c o n 2 w i r e j o i n e d t o i t l a t e r , w h e n t h e c a p a c i t o r s a r e w i r e d t o g e t h e r . T o p r o v i d e p o l y s i l i c o n 1 - p o l y s i l i c o n 2 m a s k m i s a l i g n m e n t i m m u n i t y , a s i m i l a r p o l y s i l i c o n 2 l i n k i s l a t e r p u t o n t o p o f o n e o f t h e c a p a c i t o r p l a t e s . T h e s e e x t r a p o l y s i l i c o n 2 l i n k s m a k e i t i m p o s s i b l e t o a c h i e v e a p e r f e c t p e r i m e t e r - t o - a r e a r a t i o , b u t i t i s s t i l l p o s s i b l e t o m a i n t a i n a c c u r a c y t o 0 . 1 % . T h e p e r i m e t e r - t o - a r e a r a t i o o f a u n i t s i z e c a p a c i t o r i s t h e n P r = A~ = 4 E + 4 E 2 + 4 ( 5 . 1 0 ) 63 H = E 2 + 4 P = 4E + 4 F i g . 5.6: F i r s t c a p a c i t o r p l a t e E E + 2 R + = E 2 + 4 P+ - 4E F i g . 5.7: A d d i t i o n a l c a p a c i t o r p l a t e s 64 a n d t h e r a t i o o f a n a d d i t i o n a l p l a t e ( F i g . 5 . 7 ) i s 4E (5.11) r = E 2 + 4 w h e r e P + i s t h e a d d i t i o n a l p e r i m e t e r a n d A + i s t h e a d d i t i o n a l a r e a o f t h e a d d e d s q u a r e . T h e p l a t e s j o i n t o g e t h e r p r o v i d i n g a c o n t i n u o u s p o l y s i l i c o n l l a y e r . A f r a c t i o n a l c a p a c i t a n c e i s l a i d o u t i n o n e o f t w o p o s s i b l e w a y s . I f t h e f r a c t i o n i s s m a l l , t h e f o l l o w i n g m e t h o d i s u s e d . L e t t h e f r a c t i o n a l v a l u e b e f , a n d t h e p a r a m e t e r s a a n d b a s s h o w n i n F i g . 5 . 8 . T h e p e r i m e t e r - t o - a r e a r a t i o i s b F i g . 5 . 8 : S m a l l f r a c t i o n a l a d d - o n c a p a c i t o r h e n c e a n d 6 5 r = . ( 5 . 1 2 ) a n d i t i s r e q u i r e d t h a t f A + = a b ( 5 . 1 3 ) T h i s g i v e s P . 2 a r = i t = a b ( 5 ' U ) b = f ( 5 . 1 5 ) a = ^ ( 5 . 1 6 ) Now s u b s t i t u t i n g i n t h e v a l u e s o f A a n d P A = E 2 + 4 ( 5 . 1 7 ) P = 4 E ( 5 . 1 8 ) g i v e s a = 2 f E ( 5 . 1 9 ) a n d 66 b = § + | ( 5 . 2 0 ) A l a r g e r f r a c t i o n a l c a p a c i t a n c e i s l a i d o u t a s s h o w n i n F i g . 5 . 9 , w h e r e t h e p a r a m e t e r s a a n d b a r e d e f i n e d . T h e d e s i r e d r a t i o i s a g a i n ( 5 . 2 1 ) a n d f A + = a E + 2 b ( 5 . 2 2 ) T h e a d d i t i o n a l p e r i m e t e r i s P + = 2 E + 2 a - 2 b + 4 ( 5 . 2 3 ) — b — 2\ P+ = 2E+2a-2b+4 F i g . 5 . 9 : L a r g e f r a c t i o n a l a d d - o n c a p a c i t o r 67 g i v i n g t h e f o l l o w i n g r e l a t i o n s ( 5 . 2 4 ) b = E - f ( E P + - 2 A . ) 2 E + 4 ( 5 . 2 5 ) Now s u b s t i t u t i n g i n 5 . 1 7 a n d 5 . 1 8 g i v e s a = f ( E + 2) - 2 ( 5 . 2 6 ) b = E - f ( E - 2 ) ( 5 . 2 7 ) T h e f i r s t s t y l e i s g o o d f o r s m a l l e r f r a c t i o n s a s a w i l l b e l a r g e r t h a n E i f t h e f r a c t i o n i s l a r g e r t h a n . 5 , a n d t h i s w i l l n o t f i t i n t h e a r r a y . T h e s e c o n d s t y l e i s u s e f u l f o r l a r g e r f r a c t i o n s a s a m u s t b e l a r g e r t h a n 2 X . T h i s m e a n s t h a t t h e f r a c t i o n m u s t b e l a r g e r t h a n 4 / ( E + 2 ) . 5 . 4 . 3 C A P A C I T O R A C C U R A C Y A N A L Y S I S T h i s l a y o u t m e t h o d r e s u l t s i n t o t a l i m m u n i t y t o p o l y s i l i c o n 1 - p o l y s i l i c o n 2 m a s k m i s a l i g n m e n t s o f l e s s t h a n 1 X . A s s u m e now t h a t a l l p o l y s i l i c o n l e d g e s a r e s l i g h t l y o f f b y a n a m o u n t x ( F i g . 5 . 1 0 ) . L e t c a p a c i t o r o n e h a v e a v a l u e o f m , a n d c a p a c i t o r t w o h a v e a v a l u e o f n + m , w h e r e m a n d n a r e p o s i t i v e i n t e g e r s . T h e a c h i e v e d v a l u e s o f t h e s e c a p a c i t o r s a r e Ci = m ( E 2 + 4 ) - 4x ( 5 . 2 8 ) 68 F i g . 5 . 1 0 : P o l y s i l i c o n l s y s t e m a t i c e r r o r XL, = ( n + m ) ( E 2 + 4 ) - 4 x g i v i n g t h e r a t i o ( 5 . 2 9 ) C_i = ( n + m ) ( E 2 + 4 ) ~ 4x C , m ( E 2 + 4 ) - 4 x ( 5 . 3 0 ) o r C_i _ + n ( E 2 + 4 ) C , " m ( E 2 + 4 ) - 4x ( 5 . 3 1 ) t h e n 69 C Z / C - T C Z / C T _ _ n _ - 4 x C z / C , " 1 m+n M m ( E 2 + 4 ) - 4x ' ^ ' * z > o r t o m a x i m i z e t h i s e r r o r , l e t m = 1 , a n d n = ° ° , t h e n 4x \MC2/C,)\ = zrj^ ( 5 . 3 4 ) Now i t i s r e q u i r e d t h a t 4x < 0 . 0 0 1 ( 5 . 3 5 ) E 2 + 4 s o E 2 + 4 x * looo ( 5' 3 6 ) F o r 0 . 1 % a c c u r a c y a n d E = 18X x < T | ( 5 . 3 7 ) T h i s v a l u e o f E i s p i c k e d a s i t i s t h e m i n i m u m w i d t h o f a s w i t c h - p a i r , a n d k e e p i n g t h e c a p a c i t o r p l a t e t h e s a m e s i z e s i m p l i f i e s t h e l a y o u t . Now a s s u m e t h a t a l l p o l y s i l i c o n 2 e d g e s a r e s l i g h t l y o f f b y a n a m o u n t x ( F i g . 5 . 1 1 ) . U s i n g t h e s a m e c a p a c i t o r s a s i n t h e p r e v i o u s a n a l y s i s g i v e s 70 X F i g . 5 . 1 1 : P o l y s i 1 i c o n 2 s y s t e m a t i c e r r o r C, [ ( E - 2 x ) 2 + 2 ( 2 - 2 x ) ] + ( m + n - 2 ) [ ( E - 2 x ) 2 + ( 2 - 2 x ) ( 2 + 2 x ) ] [ ( E - 2 x ) 2 + 2 ( 2 - 2 x ) ] + ( m - 1 ) [ ( E - 2 x ) 2 + ( 2 - 2 x ) ( 2 + 2 x ) ] ( 5 . 3 8 ) o r C, = 1 + ( n - 1 ) [ ( E - 2 x ) 2 + ( 2 - 2 x ) ( 2 + 2 x ) 3 [ ( E - 2 x ) 2 + 2 ( 2 - 2 x ) ] + ( m - 1 ) [ ( E - 2 x ) 2 + ( 2 - 2 x ) ( 2 + 2 x ) ] ( 5 . 3 9 ) s o C2 , ^ / , \ r i 4 x 2 - 4 x = 1 + ( n - l ) [ m + ( _ A C, E 2 - 4 x E + 4 s i n c e x « E , t h i s c a n b e s i m p l i f i e d t o C , 4x o r C i = 1 + (n-D(m " p )"1 C, m - 4(x / E 2 ) t h e n A(C 2/C,) = ( , " \ . )( -If ) m ( m + n - 1 ) E 2 t o m a x i m i z e t h i s e r r o r , l e t m = 1 , a n d n = e |A(C 2/C,)| = fr Now i t i s r e q u i r e d t h a t 4x •^7 <: 0 . 0 0 1 E 2 SO 72 F o r 0 . 1 % a c c u r a c y a n d E = 1 8 X x < j | ( 5 . 4 7 ) T h i s m e t h o d i s e q u a l l y t o l e r a n t o f p o l y s i l i c o n l a n d p o l y s i l i c o n 2 s y s t e m a t i c e r r o r s . F o r a 5nm t e c h n o l o g y , t h i s r e q u i r e s a m a x i m u m e r r o r o f 0 . 2 l y m o n 45/txm e d g e s . 5 . 4 . 4 G E N E R A T I N G T H E A R R A Y ( C A P A R R A Y ) T h e c a p a c i t o r s a r e a r r a n g e d i n a n a r r a y , t h e i r b a s e s o n t h e b o t t o m f o r l a t e r c o n n e c t i o n s . T h e a r r a y h e i g h t i s s e t b y t h e a r r a y h e i g h t v a r i a b l e i n t h e f i l t e r . c o m f i l e . A n i n i t i a l g u e s s f o r t h i s v a r i a b l e i s t h e a v e r a g e c a p a c i t o r v a l u e . E a c h c a p a c i t o r • c a n b e l a i d o u t i n t w o s t y l e s : o n e e m p h a s i z e s u p - d o w n p l a c e m e n t o f t h e c a p a c i t o r p l a t e s a n d t h e o t h e r e m p h a s i z e s l e f t - r i g h t p l a c e m e n t . T h e c a p a c i t o r s i z e a t w h i c h t h e s t y l e c h a n g e s i s s e t b y t h e a r r a y s w i t c h v a r i a b l e . I f a c a p a c i t o r i s l a r g e r t h a n t h i s v a l u e i t i s p l a c e d w i t h a n u p - d o w n e m p h a s i s . T h e u p - d o w n s p r e a d i s b e t t e r f o r l a r g e r c a p a c i t o r s a s i t k e e p s t h e m m o r e c o m p a c t , w h i l e t h e l e f t - r i g h t s p r e a d i s b e t t e r f o r t h e s m a l l e r o n e s , l e t t i n g t h e m u s e t h e s p a c e b e t w e e n t h e l a r g e r o n e s . A n i n i t i a l g u e s s f o r t h i s v a l u e i s o n e - a n d - a - h a l f t i m e s t h e a r r a y h e i g h t . E a c h c a p a c i t o r h a s i t s b a s e p l a t e p l a c e d a l o n g t h e b a s e o f t h e a r r a y . A d d i t i o n a l p l a t e s a r e a d d e d o n e a t a t i m e f o r e a c h c a p a c i t o r u n t i l t h e c a p a c i t o r i s f i n i s h e d o r t h e r e i s 73 n o m o r e r o o m . A c h e c k i s d o n e a t t h e e n d , a n d i f a c a p a c i t o r w a s n o t f i n i s h e d , a n a d d i t i o n a l s p a c e i s a l l o c a t e d a l o n g t h e b a s e f o r t h e n e x t a t t e m p t . T h i s p r o c e s s i s r e p e a t e d u n t i l a l l t h e c a p a c i t o r s a r e p l a c e d s u c c e s s f u l l y . W h e n a l l t h e c a p a c i t o r s a r e f i n i s h e d , a c h e c k i s m a d e o n t h e w i d t h o f t h e a r r a y . I f t h e o p e r a t i o n a l a m p l i f i e r s w i l l t a k e u p m o r e r o o m t h a n t h e a r r a y , t h e e x t r a s p a c e i s i n s e r t e d i n t o t h e a r r a y o n o n e m o r e a r r a y g e n e r a t i o n . T h e e x t r a p o l y s i l i c o n 2 t i p o n e a c h c a p a c i t o r i s a d d e d w i t h a f r a c t i o n a l c a p a c i t o r p l a t e p l a c e m e n t i f p o s s i b l e , o t h e r w i s e i t i s p l a c e d a f t e r t h e a r r a y g e n e r a t i o n . I f a c a p a c i t o r o f v a l u e l e s s t h a n o n e i s g i v e n , i t w i l l b e l a i d o u t a s a r e c t a n g l e , c a u s i n g a m o r e s e r i o u s p e r i m e t e r - t o - a r e a v i o l a t i o n . A s i x t h o r d e r b a n d - p a s s f i l t e r d e s i g n e d b y MPR i s u s e d i n t h i s c h a p t e r t o d e m o n s t r a t e how t h e S I S C L p r o g r a m w o r k s . T h e d a t a f o r t h e f i l t e r i s i n C h a p t e r 6 . T h e f l o w c h a r t o f t h e a r r a y g e n e r a t i o n f u n c t i o n i s s h o w n i n F i g . 5 . 1 2 . A l a y o u t w i t h t h e a r r a y s w i t c h v a r i a b l e s e t l a r g e r t h a n a l l t h e c a p a c i t o r s i s s h o w n i n F i g . 5 . 1 3 . T h e w i d t h o f t h i s a r r a y i s 7 0 6 X . A l a y o u t w i t h t h e a r r a y s w i t c h v a r i a b l e s e t t o 0 i s s h o w n i n F i g . 5 . 1 4 g i v i n g a n a r r a y w i d t h o f 7 4 6 X . A l a y o u t w i t h t h e a r r a y s w i t c h v a r i a b l e s e t t o o n e - a n d - a - h a l f t i m e s t h e a r r a y h e i g t h i s s h o w n i n F i g . 5 . 1 5 , g i v i n g a w i d t h o f 6 7 0 X . A c o m b i n a t i o n o f t h e t w o s t r a t e g i e s u s u a l l y y i e l d s t h e s m a l l e s t l a y o u t . 74 START I n i t i a l i z e plate directions. In 11 i a l i z e GIF F i l e empty c a p a c i t o r g r i d FOR each c a p a c i t o r p l a c e F i r s t p l a t e on base r e d u c e c a p a c i t a n c e v a l u e increment h o r i z o n t a l l y s e t bounds on c a p a c i t o r 3 r p 3 y UHILE not F i n i s h e d FDR each c a p a c i t o r FDR e a c h d i r e c t Ion FDR each p r e v i o u s p l a t e r e s t o r e p l a t e p o s i t i o n IF neu p l a t e F i t s get p l a t e s i z e - i l l a r r a y IF neccessSr y update p a r a m e t e r s p l a c e the p l a t e IF more t o do not. yet F i n i s h e d UHILE more c a p a c i t o r s IF not F i n i s h e d a l l o c a t e one e x t r a space IF Srr-Sy not c o m p l e t e c a l l a r r a y l a y o u t F u n c t i o n a g a i n END F i g . 5 . 1 2 : A r r a y l a y o u t f l o w c h a r t ( L A Y A R R A Y ) 75 F i g . 5 . 1 4 : V e r t i c a l c a p a c i t o r s p r e a d  77 5 . 5 S E L E C T I N G T H E S W I T C H E S T O B E P L A C E D ( P R E O P ) T h e d e c i s i o n o f w h e r e t o p l a c e t h e o p e r a t i o n a l a m p l i f i e r s a n d w h e r e t o p l a c e t h e s w i t c h e s i s m a d e b y t h e P R E O P f u n c t i o n . T h e w i d t h o f t h e c a p a c i t o r a r r a y i s a g a i n c h e c k e d a g a i n s t t h e m i n i m u m w i d t h o f t h e o p e r a t i o n a l a m p l i f i e r s a n d a n y e x t r a s p a c e i s i n s e r t e d b e t w e e n t h e o p e r a t i o n a l a m p l i f i e r s . T h e p l a c e m e n t p o i n t o f t h e o p e r a t i o n a l a m p l i f i e r , w i t h t h e c o - o r d i n a t e s o f t h e t h r e e i n p u t s / o u t p u t , i s s t o r e d i n t h e O P A M P d a t a s t r u c t u r e . T h e i n t e g r a t i n g c a p a c i t o r f o r e a c h o p e r a t i o n a l a m p l i f i e r g i v e s t h e c o n n e c t i o n p o i n t f o r t h e i n v e r t i n g i n p u t . T h e s w i t c h e d c a p a c i t o r s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r o u t p u t g i v e s t h e p o s s i b l e c o n n e c t i o n p o i n t s f o r t h e o u t p u t . T h e c l o s e s t s w i t c h e d c a p a c i t o r t o t h e o u t p u t i s s e l e c t e d . T h e c l o c k i n g s c h e m e o f t h i s s w i t c h e d c a p a c i t o r i s s a v e d s o t h a t a n y s w i t c h e d c a p a c i t o r s w i t h t h e c o m p l e m e n t i n g c l o c k i n g s c h e m e c a n b e n o t e d . T h e s e l e c t e d s w i t c h e d c a p a c i t o r a n d o n e s w i t c h e d c a p a c i t o r w i t h t h e c o m p l e m e n t i n g c l o c k i n g s c h e m e a r e t h e n m a r k e d f o r l a t e r s w i t c h - p a i r p l a c e m e n t . A l l i n t e g r a t i n g c a p a c i t o r s h a v e o n e s w i t c h - p a i r p l a c e d b e l o w t h e m . T h e o p e r a t i o n a l a m p l i f i e r i s m i r r o r i m a g e d i f t h e c o n n e c t i o n s a r e s i m p l i f i e d t h a t w a y . T h e i n p u t s / o u t p u t a r e t h e n m o v e d a n d t h i s w i l l o f t e n g r e a t l y s i m p l i f y t h e w i r i n g f r o m t h e s w i t c h - p a i r s t o t h e o p e r a t i o n a l a m p l i f i e r i n p u t s / o u t p u t . A f l o w c h a r t o f t h e P R E O P f u n c t i o n i s s h o w n i n F i g . 5 . 1 6 . 78 START i c a l c u l a t e e x t r a o per61 t o n a l s p a c e b e t w e e n amp I I F I e r s FUR e3ch c o n n e c t i o n IF Input c o n n e c t i o n FOR e a c h c a p a c i t o r IF IC s h a r i ng c o n n e c I i on sdwB c o n n e c t i o n p o i n t s LLSE o u t p u t c o n n e c t i o n FDR e a c h c a p a c i t o r IF SC sh i 3 r l n g c o n n e c t i o n IF c l o s e r t o c o n n e c t i o n s 8 u e c o n n e c t i o n p o i n t s s 9 u e c l o c k I no scheme 1 1 , J i FUR e a c h c a p a c i t o r and n o t F l a g IF SC s h a r i n g c o n n e c t I D n IF r e u e r s e c l o c k i n g scheme s e t sw 11ch F I a g IF op _3mp Is t o be r e v e r s e d FI Ip c o n n e c t i o n p o i n t s I n c r e m e n t p o s i t i o n END F i g . 5 . 1 6 ; P R E O P f u n c t i o n f l o w c h a r t 7 9 5 . 6 T H E C A P A C I T O R W I R I N G 5 . 6 . 1 I N T R O D U C T I O N A l l w i r i n g c o n n e c t i o n s a r e m a d e t o t h e f i r s t c a p a c i t o r p l a t e p l a c e d f o r e a c h c a p a c i t o r . T h e b a s e o f t h i s p l a t e i s w i d e e n o u g h f o r t h r e e c o n n e c t i o n s , o f w h i c h t w o c o n n e c t t o t h e p l a t e . A l l t h e w i r i n g i s d o n e i n a n a r r a y . T h e w i r e s a r e a l l 2 X w i d e a n d a r e s e p a r a t e d b y 3 X . T h e h o r i z o n t a l w i r i n g i s d o n e i n m e t a l a s t h e y t e n d t o b e l o n g e r , a n d t h e v e r t i c a l w i r i n g i s d o n e i n p o l y s i l i c o n . T h e r e a r e f i v e t y p e s o f c o n n e c t i o n s t o b e m a d e : t h e o p e r a t i o n a l a m p l i f i e r i n p u t n o d e , i t s o u t p u t n o d e , t h e s h a r e d n o d e a t t h e i n p u t , a n d t h e t w o s h a r e d n o d e s a t t h e o u t p u t . E a c h t y p e o f c o n n e c t i o n i s d o n e b y o n e f u n c t i o n , h o w e v e r a l l t h e w i r i n g f u n c t i o n s a r e s i m i l a r . T h e l e n g t h o f t h e w i r e j o i n i n g t h e c a p a c i t o r s i s f o u n d , a n d a s l o t i s f o u n d i n t h e w i r i n g a r r a y f o r i t . T h e w i r e i s t h e n p l a c e d i n m e t a l . E a c h c a p a c i t o r i s t h e n c h e c k e d t o s e e i f i t s h o u l d b e c o n n e c t e d t o t h e w i r e . T h e p o l y s i l i c o n w i r e s a r e t h e n p l a c e d a n d c o n n e c t e d t o t h e m e t a l w i r e . A l l i n t e g r a t i n g a n d s w i t c h e d c a p a c i t o r s h a v e t h r e e v e r t i c a l c o n n e c t i o n s t o t h e w i r i n g , w h i l e t h e c o u p l i n g c a p a c i t o r s o n l y h a v e t w o . T h e i n t e g r a t i n g a n d s w i t c h e d c a p a c i t o r s t e n d t o h a v e s w i t c h e s a s s o c i a t e d w i t h t h e m , c a u s i n g t h e n e e d f o r a t h i r d c o n n e c t i o n . T h e n o d e s s t o r e d f r o m t h e f i l t e r . n d f i l e a r e s c a n n e d f o r e a c h c o n n e c t i o n . I f a c a p a c i t o r s h o u l d b e c o n n e c t e d t o 80 t h e w i r e f o r a n o d e , i t i s n o t e d f o r t h e w i r e l e n g t h , a n d t h e v e r t i c a l c o n n e c t i o n s . T h e w i r i n g m o d e l i s s h o w n i n F i g . 5 . 1 7 . T h e f l o w c h a r t s f o r t h e w i r i n g f u n c t i o n s a r e v e r y s i m i l a r t o t h a t o f t h e f i r s t w i r i n g f u n c t i o n ( W I R E 1 ) w h i c h i s s h o w n i n F i g . 5 . 1 8 . 5 . 6 . 2 T H E I N P U T N O D E S ( W I R E D A l l t h e e l e m e n t s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r i n v e r t i n g i n p u t n o d e a r e w i r e d u p b y t h e WIRE1 f u n c t i o n . E a c h s u c h n o d e c o n n e c t s t o o n e i n t e g r a t i n g c a p a c i t o r a n d a n y c o u p l i n g c a p a c i t o r s . I f t h e r e a r e n o c o u p l i n g c a p a c i t o r s i n t h e f i l t e r , n o h o r i z o n t a l m e t a l w i r e h a s t o b e p l a c e d , a n d n o v e r t i c a l p o l y s i l i c o n 2 w i r e i s p l a c e d a t t h i s t i m e . A n y v e r t i c a l c o n n e c t i o n s a r e m a d e i n p o l y s i l i c o n 2 a n d a r e m a d e F i g . 5 . 1 7 : W i r i n g m o d e l STRRT i n It i a l i z e t h e w i r i n g a r r a y FDR e8ch i n p u t node i n i t i a l i z e t h e w i r e end~po i n t s FDR e a c h c a p a c i t o r IF SC e l e m e n t d o n o t h i n q ELSE IF same F i r s t node | s S u e p o s i. t i o n ELSE IF same s e c o n d n o d e s a ^ e pos i t ionC r i g h t ) IF w i r e i s needed F i n d w i r e 1euel )I a c e w i r e i n m e t a l FOR e a c h c a p a c i t o r IF c o n n e c t i o n r e q u i r e d IF F i r s t node m a t c h e s s 9 v e c o n n e c t i o n I e u e l c o n n e c ! i o n p o i n t on l e F t ELSE c o n n e c t i o n p o i n t r i g h t IF n ot SC and w i r e n e e d e d p l a c e c o n n e c t i o n END F i g . 5 . 1 8 : W I R E 1 f u n c t i o n f l o w c h a r t 82 o n t h e l e f t s i d e o f t h e i n t e g r a t i n g c a p a c i t o r a n d o n e i t h e r s i d e o f t h e c o u p l i n g c a p a c i t o r , d e p e n d i n g o n w h e r e t h e n o d e i s . T h e o u t p u t f r o m t h e WIRE1 f u n c t i o n i s s h o w n i n F i g . 5 . 1 9 . 5 . 6 . 3 T H E O U T P U T N O D E S ( W I R E 2 ) A l l t h e e l e m e n t s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r o u t p u t n o d e a r e w i r e d u p b y t h e W I R E 2 f u n c t i o n . E a c h s u c h n o d e c o n n e c t s t o o n e i n t e g r a t i n g c a p a c i t o r , a n y c o u p l i n g c a p a c i t o r s , a n d a n y s w i t c h e d c a p a c i t o r s f e d b y t h e o p e r a t i o n a l a m p l i f e r . A l l v e r t i c a l c o n n e c t i o n s a r e m a d e i n p o l y s i l i c o n l . T h e i n t e g r a t i n g c a p a c i t o r i s c o n n e c t e d o n t h e r i g h t s i d e , w h i l e t h e c o u p l i n g c a p a c i t o r i s c o n n e c t e d o n e i t h e r . s i d e , d e p e n d i n g o n w h e r e t h e n o d e i s . T h e s w i t c h e d c a p a c i t o r i s n o t c o n n e c t e d t o t h e w i r e a s t h e c o n n e c t i o n i s m a d e l a t e r t o t h e s w i t c h p a i r , o n t h e c a p a c i t o r ' s r i g h t s i d e . T h e o u t p u t f r o m t h e W I R E 2 f u n c t i o n i s s h o w n i n F i g . 5 . 2 0 . 5 . 6 . 4 T H E S H A R E D N O D E A T T H E I N P U T ( W I R E 3 ) A l l s w i t c h e d c a p a c i t o r s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r i n v e r t i n g i n p u t n o d e a r e w i r e d t o g e t h e r n o w . T h e i n t e g r a t i n g c a p a c i t o r h a s t o b e i n c l u d e d i n t h e h o r i z o n t a l w i r i n g , a s i t i s l a t e r c o n n e c t e d t o i t s s w i t c h - p a i r . T h e s w i t c h e d c a p a c i t o r s a r e c o n n e c t e d w i t h p o l y s i l i c o n l w i r e s . T h e o u t p u t f r o m t h e W I R E 3 f u n c t i o n i s s h o w n i n F i g . 5 . 2 1 . F i g . 5 . 1 9 ; O u t p u t f r o m W I R E 1 F i g . 5 . 2 0 : O u t p u t f r o m W I R E 2 84 F i g . 5 . 2 1 : O u t p u t f r o m W I R E 3 F i g . 5 . 2 2 : O u t p u t f r o m W I R E 4 8 5 5 . 6 . 5 T H E S H A R E D N O D E S A T T H E O U T P U T ( W I R E 4 ) A l l t h e s w i t c h e d c a p a c i t o r s c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r o u t p u t n o d e a r e d i v i d e d i n t o t w o g r o u p s , a c c o r d i n g t o w h i c h c l o c k i n g s c h e m e t h e y u s e . E a c h g r o u p i s w i r e d s e p a r a t e l y . T h e c o n n e c t i o n s a r e m a d e o n t h e r i g h t s i d e o f t h e s w i t c h e d c a p a c i t o r s i n p o l y s i l i c o n l . T h e w i r e i s l a t e r c o n n e c t e d t o t h e m i d d l e o f a s w i t c h - p a i r . T h e o u t p u t f r o m t h e W I R E 4 f u n c t i o n i s s h o w n i n F i g . 5 . 2 2 . 5 . 6 . 6 T H E S W I T C H P L A C E M E N T A N D C O N N E C T I O N S ( S T R E A K ) T h e S T R E A K f u n c t i o n p l a c e s t h e s w i t c h - p a i r s d i r e c t l y b e l o w t h e i n t e g r a t i n g c a p a c i t o r s a n d t h e s w i t c h e d c a p a c i t o r s s e l e c t e d b y t h e P R E O P f u n c t i o n . T h e s w i t c h e s a r e t h e n c o n n e c t e d t o t h e p r e v i o u s c a p a c i t o r w i r i n g , a n d t h e c l o c k s a r e c o n n e c t e d p r o p e r l y f o r e a c h s w i t c h . T h e s w i t c h - p a i r s a r e g r o u n d e d b y m e t a l w i r e s c o n n e c t e d t o t h e g r o u n d l i n e t h a t i s l a t e r p l a c e d d i r e c t l y b e l o w t h e s w i t c h e s . T h e i n t e g r a t i n g c a p a c i t o r s a n d s w i t c h e d c a p a c i t o r s h a v e t h e i r c e n t r a l c o n n e c t i o n g o i n g s t r a i g h t t o t h e m i d d l e s w i t c h c o n n e c t i o n i n p o l y s i l i c o n 2 . T h e u n c o n n e c t e d t h i r d v e r t i c a l w i r e f o r t h e i n t e g r a t i n g a n d s w i t c h e d c a p a c i t o r s i s now c o n n e c t e d t o t h e s w i t c h - p a i r d i r e c t l y a b o v e t h o s e e l e m e n t s . I f t h e r e i s a n a c c e s s i b l e c o n t a c t a b o v e t h e s w i t c h , t h e s o f t w a r e t r i e s n o t t o p l a c e a n o t h e r c o n t a c t b e f o r e c o n n e c t i n g t h e m . A f l o w c h a r t o f t h e S T R E A K f u n c t i o n i s s h o w n i n F i g . 5 . 2 3 a n d t h e o u t p u t i s s h o w n i n F i g . 5 . 2 4 . STRRT FOR each c a p a c i t o r r e s t o r e c o n n e c i I o n l e v e l c a l c u l a t e c o n n e c t i o n p o i n t s IF SC element IF s n i t c h e s a r e to be p l a c e d p l a c e su11ch-psIr ground s u i l t c h ~ p a l r IF l e v e l Is J u s t above p l a c e metal u i r e ELSE p l a c e c o n t a c t p l a c e p o l y s t l ( c o n u i r e IF c o n n e c t i o n i s to be made connect to p r e v i o u s u l r l n g ELSE IF IC element p l a c e s u l t c h ~ p a l r ground su11 ch~pa I r IF l e v e l not J u s t above p l a c e c o n t a c t s p l a c e p o l y s i l i c o n u i r e ELSE p l a c e metal u i r e connect to c a p a c i t o r IF s h a r e d Input node connect to u l r l n g ELSE connect to c a p a c i t o r END F i g . 5 . 2 3 ; S T R E A K f u n c t i o n f l o w c h a r t  88 5 . 7 P L A C I N G A N D C O N N E C T I N G T H E O P E R A T I O N A L A M P L I F I E R S 5 . 7 . 1 C O N N E C T I N G T H E I N P U T A N D O U T P U T N O D E S ( W I R E 5 ) A l l t h e c o n n e c t i o n d a t a f o r t h e o p e r a t i o n a l a m p l i f i e r i n p u t s / o u t p u t a s w e l l a s t h e s w i t c h c o n n e c t i o n p o i n t s h a v e b e e n p r e v i o u s l y g a t h e r e d . T h e c o n n e c t i o n s f o r t h e o p e r a t i o n a l a m p l i f i e r i n v e r t i n g i n p u t s a n d o u t p u t s a r e d o n e b y t h e W I R E 5 f u n c t i o n . T h e s e c o n n e c t i o n s a r e d o n e t h e s a m e w a y a s t h e y a r e a l l c o n n e c t i o n s f r o m o n e c o - o r d i n a t e p a i r t o a n o t h e r c o - o r d i n a t e p a i r . T h e r e w i l l b e m e t a l g r o u n d a n d p o w e r l i n e s s e p a r a t i n g t h e o p e r a t i o n a l a m p l i f i e r s f r o m t h e s w i t c h e s s o t h e c o n n e c t i o n s a r e d o n e i n p o l y s i l i c o n l . I t i s n e c e s s a r y t o p l a c e a m e t a l - p o l y s i l i c o n l c o n t a c t b e l o w t h e s w i t c h - p a i r s a s a p o l y s i l i c o n l c l o c k l i n e w i l l s e p a r a t e t h e m . T h e p o w e r l i n e s t h e n g o b e l o w t h e c o n t a c t . T h i s p r o v i d e s r o o m f o r o n e l e v e l o f c o n n e c t i o n s b e t w e e n t h e s e c o n t a c t s . I f a c o n n e c t i o n c a n b e d o n e o n t h i s l e v e l , i t i s p l a c e d e n t i r e l y i n p o l y s i l i c o n l . S o m e 80% o f t h e c o n n e c t i o n s a r e p l a c e d o n t h i s l e v e l . I f - t h i s i s n o t p o s s i b l e , h o r i z o n t a l m e t a l w i r e s a r e p l a c e d b e l o w t h e p o w e r l i n e s a n d v e r t i c a l p o l y s i l i c o n l l i n e s c o n n e c t t h e m t o t h e s w i t c h - p a i r c o n t a c t s . T h e w i r i n g i s a g a i n d o n e i n a n a r r a y . T h e h o r i z o n t a l b o u n d s a r e f o u n d f o r e a c h w i r e a n d t h e w i r e i s p l a c e d i n t h e f i r s t a v a i l a b l e l e v e l . T h e c o n n e c t i o n t o t h e s w i t c h i s a l w a y s m a d e o n o n e s i d e o f t h e s w i t c h , h e n c e t h e r e i s r o o m t o l a t e r a l l y m o v e t h e 8 9 c o n n e c t i o n p o i n t b y u p t o 1 4 X . T h i s i s d o n e i f t h e v e r t i c a l c o n n e c t i o n h a p p e n s t o b e d i r e c t l y a b o v e a n o t h e r o p e r a t i o n a l a m p l i f e r i n p u t / o u t p u t . T h i s r e d u c e s t h e n u m b e r o f w i r i n g l e v e l s a s w i r e s d o n o t h a v e t o g o a r o u n d p r e v i o u s c o n n e c t i o n s a s o f t e n . T h e f l o w c h a r t o f t h e W I R E 5 f u n c t i o n i s s h o w n i n F i g . 5 . 2 5 a n d t h e o u t p u t i s s h o w n i n F i g . 5 . 2 6 . 5 . 7 . 2 C O N N E C T I N G T H E G R O U N D N O D E S ( W I R E 6 ) T h e n o n i n v e r t i n g i n p u t s o f t h e o p e r a t i o n a l a m p l i f i e r s a r e a l w a y s c o n n e c t e d t o g r o u n d . T h i s w i r i n g i s d o n e b y t h e W I R E 6 f u n c t i o n . U s u a l l y t h e c o n n e c t i o n i s a s i m p l e v e r t i c a l p o l y s i l i c o n l w i r e , b u t i f t h e r e i s a n o t h e r c o n n e c t i o n b l o c k i n g i t s p a t h , i t h a s t o b e l a t e r a l l y m o v e d a r o u n d t h e c o n n e c t i o n . T h e c o n n e c t i o n i s m o v e d u n t i l t h e o f f e n d i n g c o n n e c t i o n n o l o n g e r b l o c k s t h e g r o u n d w i r e . T h e w i r e i s a l w a y s m o v e d a w a y f r o m t h e i n v e r t i n g i n p u t . O n l y t h e h o r i z o n t a l w i r e s a r e p l a c e d h e r e a s t h e v e r t i c a l c o n n e c t i o n s t o t h e o p e r a t i o n a l a m p l i f i e r s a r e d o n e l a t e r . I f n o l a t e r a l m o v e s a r e n e c e s s a r y t h e f u n c t i o n o n l y p l a c e s c o n t a c t s o n t h e g r o u n d l i n e d i r e c t l y b e l o w t h e i n p u t . T h e o u t p u t f r o m t h e W I R E 6 f u n c t i o n i s s h o w n i n F i g . 5 . 2 7 . 5 . 7 . 3 P L A C I N G T H E O P E R A T I O N A L A M P L I F I E R S ( A M P S O N ) T h e o p e r a t i o n a l a m p l i f i e r s a r e now p l a c e d d i r e c t l y b e l o w t h e w i r i n g . T h e v e r t i c a l p l a c e m e n t c a n b e a d j u s t e d w i t h t h e y o r g v a r i a b l e i n t h e f i l t e r . c o m f i l e . T h e c o n n e c t i o n s a r e t h e n m a d e f r o m t h e p r e v i o u s w i r i n g t o t h e 90 STRRT i n i t i a l i z e t h e u i r i ng g r i d FDR e3ch c o n n e c t i o n F i n d l e F t a n d n i q h t c o n n e c t i o n I F room b e l o w s w i t c h e s r o r w i r e p l a c e p o l y l wire i F n e c c e s s S r y p l a c e s w i t c h c o n t a c t s a v e w i r i n g l e v e l 8nd c r o s s i n g E L SE p l a c e n o r m a l l y I F c r o s s i nq s h o u 1 d be moved a d j u s t c r o s s i n g p o i n t F i n d l e F t a n d r i g h t p o i n t s F i nd w i r e I e v e I I F no c r o s s i n g a d j us t m i e n t p l a c e w i r e s 8nd c o n t a c t E L S E pl.9ce e x t r S loop p18ce w i r e s 9nd c o n t a c t s8ve w i r i ng I e v e 1 END F i g . 5 . 2 5 ; W I R E 5 f u n c t i o n f l o w c h a r t 91 F i g . 5 . 2 7 ; O u t p u t f r o m t h e W I R E 6 f u n c t i o n 92 o p e r a t i o n a l a m p l i f i e r i n p u t s a n d o u t p u t . T h e o u t p u t f r o m t h e A M P S O N f u n c t i o n i s s h o w n i n F i g . 5 . 2 8 . I f t h e i n p u t s h a d b e e n r e v e r s e d o n t h e o p e r a t i o n a l a m p l i f i e r . t h e o u t p u t i n F i g . 5 . 2 9 w o u l d r e s u l t . 5 . 8 P L A C I N G T H E G L O B A L F E A T U R E S ( W R A P U P ) T h e o v e r a l l f e a t u r e s o f t h e l a y o u t a r e p l a c e d b y t h e W R A P U P f u n c t i o n . T h e c a p a c i t o r a r r a y a n d i t s w i r i n g i s p l a c e d i n s i d e a p - w e l l t o i s o l a t e i t f r o m s w i t c h n o i s e . T h e w e l l i s a n c h o r e d b y t h e g r o u n d l i n e t o k e e p t h e o p e r a t i o n a l a m p l i f i e r p o w e r l i n e s l e s s n o i s y . T h e p - w e l l i s a l s o p l a c e d f o r t h e s w i t c h e s , ( a n d i s a n c h o r e d t h e r e b y t h e V s s l i n e . T h e N+ a n d P+ a r e a s f o r t h e s w i t c h e s a r e t h e n p l a c e d . T h e o u t p u t l i n e i s d r a w n o u t s i d e t h e c a p a c i t o r a r r a y , b e y o n d t h e g r o u n d l i n e . S u b s t r a t e c o n t a c t s a r e a l s o p l a c e d o n t h e b o t t o m o f t h e c a p a c i t o r a r r a y p - w e l l , w h e r e s p a c e p e r m i t s . T h e l a y o u t t h e n c o n s i s t s o f t h e t o p c a p a c i t o r a r r a y p - w e l l , a b o v e t h e - p - t r a n s i s t o r s w i t c h e s i n t h e s u b s t r a t e . T h i s i s f o l l o w e d b y t h e n - t r a n s i s t o r s i n t h e s e c o n d p - w e l l a n d f i n a l l y t h e o p e r a t i o n a l a m p l i f i e r s . T h i s a r r a n g e m e n t c u t s d o w n t h e s w i t c h n o i s e i n t h e f i l t e r b y l e t t i n g t h e p - w e l l s a c t a s s u b s t r a t e b a r r i e r s . T h e o u t p u t o f t h e W R A P U P f u n c t i o n i s s h o w n i n F i g . 5 . 3 0 .    96 5 . 9 L A Y O U T O F T H E I N P U T S T A G E T h e r e a r e c u r r e n t l y f o u r I N P U T f u n c t i o n s a s e a c h I N P U T f u n c t i o n c o n n e c t s o n e o f t h e d i f f e r e n t i n p u t s t a g e s . T h e i n p u t s t a g e o f L e e ( F i g . 4 . 1 ) r e q u i r e s o n e e x t r a s w i t c h - p a i r a n d s o m e c o n n e c t i o n s t o b e m a d e . T h e s w i t c h - p a i r i s p l a c e d b e l o w t h e s e c o n d c a p a c i t o r a n d i s t h e n c o n n e c t e d t o i t . T h e b o t t o m p l a t e o f t h e s e c o n d c a p a c i t o r i s c o n n e c t e d t o g r o u n d , a n d t h e n t h e i n p u t n o d e i s c o n n e c t e d t o t h e f i r s t c a p a c i t o r a n d t o t h e e x t r a s w i t c h - p a i r . T h e f i n a l l a y o u t o f t h e d e s i g n i s s h o w n i n F i g . 5 . 3 1 . F o r t h e M a r t i n c a s e i t i s o n l y n e c e s s a r y t o c o n n e c t t h e i n p u t n o d e t o t h e f i r s t s w i t c h - p a i r . T h e i n p u t s t a g e o f D a t a r a n d S e d r a ( F i g . 4 . 2 ) i s t h e m o s t c o m p l e x o n e . A s w i t c h - p a i r i s p l a c e d b e l o w t h e e x t e n d e d f i r s t c a p a c i t o r a n d a n o t h e r o n e i s p l a c e d b e l o w t h e s e c o n d c a p a c i t o r . T h e b o t t o m p l a t e o f t h e f i r s t c a p a c i t o r i s t h e n g r o u n d e d . T h e s e s w i t c h - p a i r s a r e c o n n e c t e d t o t h e f i r s t s w i t c h e d c a p a c i t o r o f t h e f i l t e r , a f t e r w h i c h t h e t w o i n p u t s w i t c h e d c a p a c i t o r s a r e j o i n e d t o g e t h e r , a n d c o n n e c t e d t o t h e o p e r a t i o n a l a m p l i f i e r o u t p u t a n d n o n i n v e r t i n g n o d e s . A s i n g l e s w i t c h i s p l a c e d b e l o w t h e f i r s t c a p a c i t o r t o b e u s e d a s t h e f i l t e r i n p u t s w i t c h . T h e i n p u t n o d e i s t h e n c o n n e c t e d t o t h i s s w i t c h . T h e AROMA i n p u t s t a g e i s v e r y s i m i l a r t o t h e M a r t i n c a s e . T h e i n p u t n o d e i s c o n n e c t e d t o t h e i n p u t s w i t c h e d c a p a c i t o r ( s ) . T h e r e c a n b e o n e o r t h r e e o f t h e s e d e p e n d i n g o n w h e t h e r t h e f i l t e r h a s a f i r s t o r d e r s t a g e o r a s e c o n d  98 o r d e r s t a g e a t t h e i n p u t . I f t h e r e i s a s e c o n d o r d e r s t a g e , t w o o f t h e c a p a c i t o r s a r e c o n n e c t e d t o g e t h e r , s h a r i n g a s w i t c h - p a i r . T h e s w i t c h e d c a p a c i t o r w i t h t h e c o m p l e m e n t i n g c l o c k i n g i s c o n n e c t e d t o t h e i n p u t n o d e , a s i s t h e f i r s t s w i t c h e d c a p a c i t o r . 6 . R E S U L T S A N D D I S C U S S I O N 6 .1 A 3 8 2 5 HZ B A N D P A S S E L L I P T I C F I L T E R ( L E E ) T h e f i r s t f i l t e r i s a 3 8 2 5 H z , s i x t h - o r d e r b a n d p a s s f i l t e r ^ I t w a s d e s i g n e d b y MPR b y t h e t e c h n i q u e s o f L e e . T h e f i l t e r p r o t o t y p e i s s h o w n i n F i g . 6 . 1 , a n d t h e e q u i v a l e n t s w i t c h e d c a p a c i t o r f i l t e r i s s h o w n i n F i g . 6 . 2 . T h e S W I T C A P f i l e f o r t h i s f i l t e r i s s h o w n i n F i g . 6 . 3 . T h e f i l t e r l . i n f i l e ( F i g . 6 . 4 ) i s a n e d i t e d c o p y o f t h e S W I T C A P f i l e , h a v i n g o n l y t h e i n p u t s t a g e e l e m e n t s . T h e S W I T C A P f i l e w a s r u n t h r o u g h t h e C I R C E p r o g r a m r e s u l t i n g i n t h e f i l t e r l . n d f i l e ( F i g . 6 . 5 ) a n d t h e f i l t e r l . c t f i l e ( F i g . 6 . 6 ) . T h e f i l t e r 1 . c o m f i l e i s s h o w n i n F i g . 6 . 7 . T h e c a p a c i t o r a r r a y h e i g h t i s s e t a t 13 p l a t e s , a n d t h e a r r a y s w i t c h v a r i a b l e i s s e t t o 2 0 . T h e l a y o u t i s p l o t t e d i n F i g . 6 . 8 . T o s i m p l i f y t h e w i r i n g a b o v e t h e o p e r a t i o n a l a m p l i f i e r s t h e f i l t e r l . c t f i l e w a s s l i g h t l y a l t e r e d i n t o t h a t o f F i g . 6 . 9 . T h i s r e s u l t s i n t h e l a y o u t o f F i g . 6 . 1 0 w h i c h h a s s i m p l e r c o n n e c t i o n s t o t h e o p e r a t i o n a l a m p l i f i e r s . 9 9 8.479 uH 6,634 uH 916,6 uF 1856 uF 939,1 uF 246,7 uF 218,5 uF 1,822 uH 0,9332 uH 1,913 uH F i g . 6 . 1 : L C p r o t o t y p e o f f i l t e r l o o F i g . 6 . 2 : S C i m p l e m e n t a t i o n o f f i l t e r ! OPTIONS ; GRID ; END ; TITLE: EBP 3825 HZ FILTER (SOURCE: MPR TIMING ; /* t i m i n g s e c t i o n */ PERIOD 4.166667E-5 ; CLOCK C 1 (0 1/2) ; END ; CIRCUIT ; /* network s e c t i o n */ /* SWITCHES */ 1 4) #CLK ; 2 4) CLK ; 2 5) CLK ; 5 0) #CLK ; 3 6) CLK ; 6 0) #CLK ; 3 7) #CLK ; 7 0) CLK ; 9 15) #CLK ; 9 0) CLK ; 8 10) CLK ; 8 0) #CLK ; 11 12) CLK ; 12 0) 2 13) 13 0) 3 16) 16 0) 15 17 17 0) 18 32 18 0) 15 19 19 0) 20 32 20 0) 21 22 21 0) 23 24 24 0) 14 25 25 0) 26 27 26 0) 28 29 29 0) 30 31 30 0) 31 33 33 0) #CLK CLK ; #CLK #CLK CLK ; #CLK CLK ; #CLK CLK ; #CLK CLK ; #CLK CLK ; CLK #CLK CLK #CLK CLK #CLK CLK #CLK CLK #CLK CLK #CLK CLK #CLK F i g . 6.3: SWITCAP f i l t e r l f i l e 103 541 (32 34) CLK ; 542 (34 0) #CLK ; /* CAPACITORS */ C31 (1 2) 1.0 ; C32 (4 0) 4.4220 ; C33 (2 3) 76.4617 ; C34 (5 6) 2 .3438 ; C35 (3 14) 1.1135 ; C36 (7 8) 5 .5920 ; C37 (8 9) 1 .0 ; C38 (10 11) 6.3792 ; C39 (12 13) 81.2592 • C40 (2 15) 16.0117 ; C41 (14 15) 11.0305 • C42 (15 31) 7.0644 ; C43 (19 26) 1.0 ; C44 (20 26) 4.1181 ; C45 (17 21) 11.4885 • C46 (18 21) 1.1911 ; C47 (16 21) 1.0 ; C48 (22 23) 11.8053 • C49 (24 25) 10.4569 • t C50 (27 28) 4.5596 ; C51 (29 30) 33.9825 • C52 (31 32) 32.5742 • C53 (33 34) 1.0 ; C54 (14 32) 1.0 ; /* VOLTAGE-CONTROLLED VOLTAGE SOURCES */ E2 (11 0 0 10) 1000 ; E3 (23 0 0 22) 1000 ; E4 (15 0 0 14) 1000 ; E l (3 0 0 2) 1000 ; E5 (28 0 0 27) 1000 ; E6 (32 0 0 31) 1000 ; /* INDEPENDENT VOLTAGE SOURCES */ VI (1 0) 1; END ; ANALYZE SSS ; /* required analysis */ INFREQ 3000 4600 LIN 41 ; SET VI AC 1.0 0.0 ; SAMPLE INPUT HOLD 1 1/2+ ; SAMPLE OUTPUT HOLD 1 1/2- ; PLOT VDB (32) (-6 -96 7) ; END ; END ; F i g . 6.3; S W I T C A P f i l t e r l f i l e ( c o n t ' d ) 104 501 (1 4) #CLK ; 502 (2 4) CLK ; C31 (1 2) 1.0 ; C32 (4 0) 4.4220 F i g . 6 . 4 : F i l t e r ! . i n f i l e 1 32 2 3 10 11 22 23 14 15 27 28 31 32 F i g . 6 . 5 : F i l t e r l . n d f i l e 105 BS (1 4) #CLK ; BS (2 4) CLK ; BC (1 2) 1.0 ; BC (4 0) 4.4220 ; OA (3 0 0 2) 1000 ; IC (2 3) 76.4617 ; SC (2 3) 2.3438 CLK #CLK CLK #CLK ; SC (2 11) 81.2592 CLK #CLK CLK #CLK ; CC (2 15) 16.0117 ; OA (11 0 0 10) 1000 ; SC (10 3) 5.592 0 CLK #CLK #CLK CLK ; IC (10 11) 6.3792 ; SC (10 15) 1.0 CLK #CLK #CLK CLK ; OA (23 0 0 22) 1000 ; SC (22 3) 1.0 CLK #CLK #CLK CLK ; IC (22 23) 11.8053 ; SC (22 15) 11.4885 CLK #CLK #CLK CLK SC (22 32) 1.1911 CLK #CLK #CLK CLK ; OA (15 0 0 14) 1000 ; CC (3 14) 1.1135 ; SC (14 23) 10.4569 CLK #CLK CLK #CLK IC (14 15) 11.0305 ; CC (14 32) 1.0 ; OA (28 0 0 27) 1000 ; SC (27 15) 1.0 CLK #CLK #CLK CLK ; IC (27 28) 4.5596 ; SC (27 32) 4.1181 CLK #CLK #CLK CLK ; OA (32 0 0 31) 1000 ; CC (15 31) 7.0644 ; SC (31 28) 33.9825 CLK #CLK CLK #CLK IC (31 32) 32.5742 ; SC (31 32) 1.0 CLK #CLK CLK #CLK ; F i g . 6 . 6 : F i l t e r ! . c t f i l e 2.0 13 20 -3 -4 114 79 79 13 21 95 4 70 75 4 2 4 F i g . 6 . 7 : F i l t e r 1 . c o m f i l e  1 07 BS (1 4) #CLK ; BS (2 4) CLK ; BC (1 2) 1.0 ; BC (4 0) 4.4220 ; OA (3 0 0 2) 1000 ; SC (2 3) 2.3438 CLK #CLK CLK #CLK ; IC (2 3) 76.4617 ; SC (2 11) 81.2592 CLK #CLK CLK #CLK OA (11 0 0 10) 1000 ; SC (10 3) 5.5920 CLK #CLK #CLK CLK ; IC (10 11) 6.3792 ; CC (2 15) 16.0117 ; SC (14 23) 10.4569 CLK #CLK CLK #CLK SC (10 15) 1.0 CLK #CLK #CLK CLK ; OA (23 0 0 22) 1000 ; SC (22 3) 1.0 CLK #CLK #CLK CLK ; IC (22 23) 11.8053 ; SC (22 15) 11.4885 CLK #CLK #CLK CLK SC (22 32) 1.1911 CLK #CLK #CLK CLK OA (15 0 0 14) 1000 ; CC (3 14) 1.1135 ; IC (14 15) 11.0305 ; cc (14 32) 1.0 ; OA (28 0 0 27) 1000 ; SC (27 15) 1.0 CLK #CLK #CLK CLK ; IC (27 28) 4.5596 ; SC (31 28) 33.9825 CLK #CLK CLK #CLK SC (27 32) 4.1181 CLK #CLK #CLK CLK OA (32 0 0 31) 1000 ; CC (15 31) 7.0644 ; IC (31 32) 32.5742 ; SC (31 32) 1.0 CLK #CLK CLK #CLK ; F i g . 6 . 9 ; R e v i s e d f i l t e r l . c t f i l e  109 6 . 2 A 5 0 0 HZ L O W P A S S E L L I P T I C F I L T E R ( M A R T I N ) T h e s e c o n d f i l t e r i s a 5 0 0 H z , s e v e n t h - o r d e r l o w p a s s f i l t e r . I t w a s d e s i g n e d b y MPR b y t h e t e c h n i q u e s o f M a r t i n . T h e f i l t e r p r o t o t y p e i s s h o w n i n F i g . 6 . 1 1 , a n d t h e e q u i v a l e n t s w i t c h e d c a p a c i t o r f i l t e r i s s h o w n i n F i g . 6 . 1 2 . T h e S W I T C A P f i l e f o r t h i s f i l t e r i s s h o w n i n F i g . 6 . 1 3 . T h e f i l t e r 2 . i n f i l e i s e m p t y . T h e S W I T C A P f i l e w a s r u n t h r o u g h t h e C I R C E p r o g r a m r e s u l t i n g i n t h e f i l t e r 2 . n d f i l e ( F i g . 6 . 1 4 ) a n d t h e f i l t e r 2 . c t f i l e ( F i g . 6 . 1 5 ) . T h e f i l t e r 2 . c o m f i l e i s s h o w n i n F i g . 6 . 1 6 . T h e c a p a c i t o r a r r a y h e i g h t i s s e t a t 8 p l a t e s , a n d t h e a r r a y s w i t c h v a r i a b l e i s s e t t o 1 0 . T h e l a y o u t i s p l o t t e d i n F i g . 6 . 1 7 . 370,5 mh! 282,7 mH 315,2 mH 325,0 nF 453,7 nF 427,9 nF 240,5 nF n 47,241 nF — 173,81 nF 79,883 nF -q n F i g . 6 . 1 1 : L C p r o t o t y p e o f f i l t e r 2 F i g . 6 . 1 2 : S C i m p l e m e n t a t i o n o f f i l t e r 2 1 12 OPTIONS ; GRID ; END ; T I T L E : LP 500 HZ F I L T E R (SOURCE: MPR) ; T IMING ; / * t i m i n g s e c t i o n * / PERIOD 2 . 6 6 0 4 1 6 6 7 E - 0 5 ; CLOCK CLK 1 ( 0 1/2) ; END ; C IRCU IT ; / * n e t w o r k s e c t i o n * / / * SWITCHES */ SOI (1 2) #CLK ; S02 (2 C ) CLK ; S15 (11 0) CLK ; S16 (10 11) #CLK ; S18 (13 0) CLK ; S17 (12 13) #CLK ; S25 (21 0) CLK ; S26 (21 22) #CLK ; S27 (20 23) CLK ; S28 (23 0) #CLK ; S35 (31 0) CLK ; S36 (30 31) #CLK ; S37 (32 33) #CLK ; S38 (33 0) CLK ; S45 (41 0) CLK ; S46 (41 42) #CLK ; S47 (40 43) CLK ; S48 (43 0) #CLK ; S55 (51 0) CLK ; S56 (50 51) #CLK ; S57 (52 53) #CLK ; S58 (53 0) CLK ; S65 (61 0) CLK ; S66 (61 62) #CLK ; S67 (60 63) CLK ; S68 (63 0) #CLK ; S75 (71 0) CLK ; S76 (70 71) #CLK ; S77 (72 73) #CLK ; S78 (73 0) CLK ; CAPACITORS */ CA1 (11 21) 1.960 CA2 (21 31; 1.000 CA3 (31 41) 2 .500 CA4 (41 51) 1.000 CA5 (51 61) 3 .333 CA6 (61 71; 1.000 CB1 (12 i o ; 1 5 . 4 4 4 F i g . 6 . 1 3 : SWITCAP f i l t e r 2 f i l e 1 13 C B 2 ( 2 2 2 0 ) 2 8 . 1 6 9 C B 3 ( 3 2 3 0 ) 2 2 . 1 3 4 C B 4 ( 4 2 4 0 ) 3 2 . 2 3 7 C B 5 ( 5 2 5 0 ) 3 0 . 8 4 5 C B 6 ( 6 2 6 0 ) 3 4 . 2 3 5 C B 7 ( 7 2 7 0 ) 1 2 . 3 0 3 C C 1 ( 1 2 3 0 ) 1 . 0 0 0 ; C C 2 ( 1 0 3 2 ) 2 . 9 9 2 ; C C 3 (32 5 0 ) 2 . 2 4 7 ; C C 4 ( 3 0 5 2 ) 1 9 . 6 6 7 C C 5 (52 7 0 ) 1 . 0 8 5 ; C C 6 ( 5 0 7 2 ) 1 0 . 2 3 4 C D 1 ( 1 3 2 3 ) 1 . 0 9 1 ; C D 2 ( 2 3 3 3 ) 1 . 6 6 6 ; C D 3 ( 3 3 4 3 ) 1 . 0 0 0 ; C D 4 ( 4 3 5 3 ) 3 . 5 0 1 ; C D 5 ( 5 3 63 ) 1 . 0 0 0 ; C D 6 ( 6 3 73] 2 . 8 3 0 ; C E ( 2 1 3 ) 2 . 1 6 2 ; C F ( 1 1 1 3 ) 1 . 0 8 0 ; C G ( 7 1 7 3 ) 1 . 0 0 0 ; / * V O L T A G E - C O N T R O L L E D V O L T A G E S O U R C E S * / E 0 2 ( 2 0 0 0 2 2 ) 1 0 0 0 E 0 5 ( 5 0 0 0 5 2 ) 1 0 0 0 E 0 3 ( 3 0 0 0 3 2 ) 1 0 0 0 E 0 4 ( 4 0 0 0 4 2 ) 1 0 0 0 E 0 6 ( 6 0 0 0 6 2 ) 1 0 0 0 E 0 1 ( 1 0 0 0 1 2 ) 1 0 0 0 E 0 7 ( 7 0 0 0 7 2 ) 1 0 0 0 / * I N D E P E N D E N T V O L T A G E S O U R C E S * / V I (1 0) ; E N D ; A N A L Y Z E S S S ; / * r e q u i r e d a n a l y s i s * / I N F R E Q 3 0 0 0 4 6 0 0 L I N 4 1 ; S E T V I A C 1 . 0 0 . 0 ; S A M P L E I N P U T H O L D 1 1 / 2 + ; S A M P L E O U T P U T H O L D 1 1 / 2 - ; P L O T V D B ( 7 0 ) ( - 6 - 9 6 7) ; E N D ; E N D ; F i g . 6 . 1 3 ; S W I T C A P f i l t e r 2 f i l e ( c o n t ' d ) 1 7 0 1 12 1 0 22 2 0 32 3 0 42 4 0 52 5 0 62 6 0 72 7 0 F i g . . 6 . 1 4 : F i l t e r 2 . n d f i l e 115 OA (10 0 0 12) 1 0 0 0 ; SC (12 1) 2 .162 #CLK CLK #CLK C L K ; I C (12 10) 1 5 . 4 4 4 ; SC (12 10) 1 .080 #CLK CLK #CLK C L K ; SC (12 20) 1.091 #CLK CLK CLK #CLK; CC (12 30) 1 . 0 0 0 ; OA (20 0 0 22) 1 0 0 0 ; SC (22 10) 1 .960 #CLK CLK #CLK C L K ; I C (22 20) 2 8 . 1 6 9 ; SC (22 30) 1 .000 #CLK CLK #CLK C L K ; OA (30 0 0 32) 1 0 0 0 ; CC (10 32) 2 . 9 9 2 ; SC (32 20) 1 .666 #CLK CLK CLK #CLK; IC (32 30) 2 2 . 1 3 4 ; SC (32 40) 1 .000 #CLK CLK CLK #CLK; CC (32 50) 2 . 2 4 7 ; OA (40 0 0 42) 1 0 0 0 ; SC (42 30) 2 . 5 0 0 #CLK CLK #CLK C L K ; I C (42 40) 3 2 . 2 3 7 ; SC (42 50) 1 .000 #CLK CLK #CLK C L K ; OA (50 0 0 52) 1 0 0 0 ; CC (30 52) 1 9 . 6 6 7 ; SC (52 40) 3 .501 #CLK CLK CLK #CLK; I C (52 50) 3 0 . 8 4 5 ; SC (52 60) 1 .000 #CLK CLK CLK #CLK; c c (52 70) 1 . 0 8 5 ; OA (60 0 0 62) 1 0 0 0 ; SC (62 50) 3 .333 #CLK CLK #CLK C L K ; I C (62 60) 3 4 . 2 3 5 ; SC (62 70) 1 .000 #CLK CLK #CLK C L K ; OA (70 0 0 72) 1 0 0 0 ; CC (50 72) 1 0 . 2 3 4 ; SC (72 60) 2 .830 #CLK CLK CLK #CLK; I C (72 70) 1 2 . 3 0 3 ; SC (72 70) 1 .000 #CLK CLK #CLK C L K ; F i g . 6 . 1 5 ; F i l t e r 2 . c t f i l e 2 . 0 8 10 - 3 - 4 114 79 79 13 21 95 4 70 75 4 2 4 F i g . 6 . 1 6 : F i l t e r 2 . c o m f i l e  1 17 6 . 3 A 3 K H Z - 5 K H Z B A N D - E L I M I N A T I O N E L L I P T I C F I L T E R ( A R O M A ) T h e t h i r d f i l t e r i s a 3 k H z - 5 k H z , e i g t h - o r d e r b a n d - e l i m i n a t i o n f i l t e r . I t w a s d e s i g n e d b y t h e AROMA p r o g r a m . T h e s w i t c h e d c a p a c i t o r f i l t e r i s s h o w n i n F i g . 6 . 1 8 . T h e S W I T C A P f i l e f o r t h i s f i l t e r i s s h o w n i n F i g . 6 . 1 9 . T h e f i l t e r 3 . i n f i l e i s e m p t y . T h e S W I T C A P f i l e w a s r u n t h r o u g h t h e C I R C E p r o g r a m r e s u l t i n g i n t h e f i l t e r 3 . n d f i l e ( F i g . 6 . 2 0 ) a n d t h e f i l t e r 3 . c t f i l e ( F i g . 6 . 2 1 ) . T h e f i l t e r 3 . c o m f i l e i s s h o w n i n F i g . 6 . 2 2 . T h e c a p a c i t o r a r r a y h e i g h t i s s e t a t 8 p l a t e s , a n d t h e a r r a y s w i t c h v a r i a b l e i s s e t t o 6 . T o s i m p l i f y t h e c a p a c i t o r w i r i n g , t h e t w e n t y - f i r s t a n d t w e n t y - s e c o n d c a p a c i t o r s w e r e r e v e r s e d . T h i s r e m o v e s o n e w i r i n g l e v e l . T h e f i n a l l a y o u t i s p l o t t e d i n F i g . 6 . 2 3 . 5fei< fe§fei'§fe 3 f e < § f e § f e ' fesfei'fei' 7P?Hi 2 ^ 1=0 > Y Y g f e l f e ' ? l s f e i ' gfel' I ' ^ H i ' ^ i ' 119 O P T I O N S ; G R I D ; E N D ; T I T L E : E B E 3 . 3 k H Z - 4 . 5 k H Z F I L T E R ( S O U R C E : A R O M A ) ; T I M I N G ; / * t i m i n g s e c t i o n * / P E R I O D 4 . 1 6 6 6 6 7 E - 5 ; C L O C K C 1 (0 1 / 2 ) ; E N D ; / * s w i t c h e d c a p a c i t o r s u b - c i r c u i t * / S U B C K T (1 4) s w c ( K : p h i l K : p h i 2 K : p h i 3 K : p h i 4 P : c a p l ) ; 5 1 (1 2) p h i l ; 5 2 (2 0) p h i 2 ; 5 3 (3 4 ) p h i 3 ; 5 4 (3 0) p h i 4 ; C l (2 3) c a p l ; E N D ; C I R C U I T ; / * n e t w o r k s e c t i o n * / X a (1 1 0 ) s w c ( C #C C | C 1 . 0 0 ) ; X b (1 2 0 ) s w c ( C #C #C C 1 3 . 4 0 ) ; X c (1 2 0 ) SWC (#C C #C C 1 3 . 4 0 ) ; X e ( 1 1 2 0 ) SWC ( C #C #C C 8 . 5 0 ) ; X f ( 2 1 2 0 ) SWC ( C #C #C C 1 . 0 0 ) ; X g ( 2 1 2 0 ) s w c (#C C #C C 1 . 4 0 ) ; X d ( 2 1 1 0 ) s w c ( C #C C #C 1 . 6 0 ) ; C ( 1 1 1 0 ) 3 . 3 0 ; C ( 2 1 2 0 ) 1 5 . 9 0 ; X h ( 2 1 3 0 ) s w c ( C #C C #C 1 . 0 0 ) ; X i ( 2 1 4 0 ) SWC ( C #C #C C 3 . 6 0 ) ; X j ( 2 1 4 0 ) s w c (#C C #C C 3 . 6 0 ) ; X k ( 3 1 4 0 ) s w c ( C #C #C C 2 . 4 0 ) ; X I ( 4 1 4 0 ) s w c ( C #C #C C 1 . 0 0 ) ; Xm ( 4 1 4 0 ) s w c (#C C #C C 2 . 0 0 ) ; X n ( 4 1 3 0 ) SWC ( C #C C #C 2 . 1 0 ) ; C ( 3 1 3 0 ) 4 . 0 0 ; C ( 4 1 4 0 ) 2 . 3 0 ; X O ( 4 1 5 0 ) SWC ( C #C C #C 2 . 1 0 ) ; X p ( 4 1 6 0 ) SWC ( C #C #C C 8 . 6 0 ) ; X q ( 4 1 6 0 ) SWC (#C C #C C 8 . 6 0 ) ; X r ( 5 1 6 0 ) SWC ( C #C #C C 2 . 8 0 ) ; X s ( 6 1 6 0 ) SWC ( C #C #C C 1 . 0 0 ) ; X t ( 6 1 6 0 ) SWC (#C C #C C 2 . 0 0 ) ; X u ( 6 1 5 0 ) s w c ( C #C C #C 1 . 0 0 ) ; C ( 5 1 5 0 ) 5 . 5 0 ; C ( 6 1 6 0 ) 6 . 9 0 ; X v ( 6 1 7 0 ) SWC ( C #C C #C 1 . 3 0 ) ; Xw ( 6 1 8 0 ) SWC ( C #C #C C 2 8 . 2 0 ) ; F i g . 6 . 1 9 : S W I T C A P f i l t e r 3 f i l e 120 X X ( 6 1 8 0 ) SWC (#C C #C C 2 8 . 2 0 ) ; X y ( 7 1 8 0 ) s w c ( C #C #C C 8 . 4 0 ) ; X Z ( 8 1 8 0 ) s w c ( C #C #C C 1 . 0 0 ) ; X I ( 8 1 8 0 ) SWC (#C C #C C 1 . 4 0 ) ; X 2 ( 8 1 7 0 ) s w c ( C #C C #C 1 . 1 0 ) ; C ( 7 1 7 0 ) 3 . 5 0 ; C ( 8 1 8 0 ) 2 6 . 9 0 ; / * V O L T A G E - C O N T R O L L E D V O L T A G E S O U R C E S * / E l ( 1 1 0 0 1 0 ) 1 0 0 0 E 3 ( 3 1 0 0 3 0 ) 1 0 0 0 E 4 ( 4 1 0 0 4 0 ) 1 0 0 0 E 6 ( 6 1 0 0 6 0 ) 1 0 0 0 E 5 ( 5 1 0 0 5 0 ) 1 0 0 0 E 7 ( 7 1 0 0 7 0 ) 1 0 0 0 E 2 ( 2 1 0 0 2 0 ) 1 0 0 0 E 8 ( 8 1 0 0 8 0 ) 1 0 0 0 / * I N D E P E N D E N T V O L T A G E S O U R C E S * / V I ( 1 0) ; E N D ; A N A L Y Z E S S S ; / * r e q u i r e d a n a l y s i s * / I N F R E Q 1 0 0 0 1 0 0 0 0 L I N 4 0 ; S E T V I A C 1 . 0 0 . 0 ; S A M P L E I N P U T H O L D 1 1 / 2 + ; S A M P L E O U T P U T H O L D 1 1 / 2 - ; P L O T V D B ( 8 1 ) ( - 6 - 9 6 7 ) ; E N D ; E N D ; F i g . 6 . 1 9 : S W I T C A P f i l t e r 3 f i l e ( c o n t ' d ) 1 81 1 10 11 20 21 30 31 40 41 50 51 60 61 70 71 80 81 F i g . 6 . 2 0 : F i l t e r 3 . n d f i l e 122 OA ( 1 1 0 0 10) 1 0 0 0 ; SC (10 1) 1 .00 C #C C #C ; I C (10 11) 3 . 3 0 ; SC (10 21) 1 . 6 0 C #C C #C . 1 OA ( 2 1 0 0 20) 1 0 0 0 ; SC (20 1) 1 3 . 4 0 #C C C #C ; SC (20 1) 1 3 . 4 0 #C C #c c ; SC (20 11) 8 . 5 0 #C C c #c ; I C (20 21) 1 5 . 9 0 ; SC (20 21) 1 . 0 0 #C C c #c • / SC (20 21) 1 . 4 0 #C C #c c • OA (31 0 0 30) 1000 ; SC (30 21) 1 . 0 0 C #C c #c 7 I C (30 31) 4 . 0 0 ; SC (30 41) 2 . 1 0 C #C c #c • OA (41 0 0 40) 1 0 0 0 ; SC (40 21) 3 . 6 0 #C C c #c • 9 SC (40 21) 3 . 6 0 #C C #c c 7 S C (40 31) 2 . 4 0 #C C c #c • I C (40 41) 2 . 3 0 ; SC (40 41) 1 . 0 0 #C C c #c • SC (40 41) 2 . 0 0 #C C #c c 7 OA ( 5 1 0 0 50) 1 0 0 0 ; SC (50 41) 2 . 1 0 C #C c #c • I C (50 51) 5 . 5 0 ; SC (50 61) 1 . 0 0 C #C c #c • OA ( 6 1 0 0 60) 1000 ; SC (60 41) 8 . 6 0 #C C c #c • SC (60 41) 8 . 6 0 #C C #c c 7 SC (60 51) 2 . 8 0 #C C c #c • I C (60 61) 6 . 9 0 ; SC (60 61) 1 . 0 0 #C C c #c • SC (60 61) 2 . 0 0 #C C #c c 7 OA ( 7 1 0 0 70) 1 0 0 0 ; SC (70 61) 1 . 3 0 C #C c #c • I C (70 71) 3 . 5 0 ; SC (70 81) 1 . 1 0 C #C c #c • 9 F i g . 6 . 2 1 ; F i l t e r 3 . c t f i l e 123 OA (81 0 0 80) 1000 ; S C (80 61) 2 8 . 2 0 #C C C #C ; S C (80 61) 2 8 . 2 0 #C C #C C ; S C (80 71 ) 8 . 4 0 #C C C #C ; I C (80 81) 2 6 . 9 0 ; S C (80 81) 1 . 0 0 #C C C #C ; S C (80 81) 1 . 4 0 #C C #C C ; F i g . 6 . 2 1 : F i l t e r 3 . c t f i l e ( c o n t ' d ) 2 . 0 8 6 - 3 - 4 114 79 79 13 21 95 4 70 75 4 2 4 F i g . 6 . 2 2 : F i l t e r 3 . c o m f i l e F i g . 6 . 2 3 : F i l t e r 3 l a y o u t to 125 6 . 4 D I S C U S S I O N T h e c a p a c i t o r a r r a y u s u a l l y t a k e s u p a t l e a s t h a l f t h e t o t a l l a y o u t a r e a . I f a l l t h e c a p a c i t o r v a l u e s a r e o f t h e s a m e g e n e r a l v a l u e , t h e n t h e a r r a y w i l l b e v e r y d e n s e a s e a c h c a p a c i t o r g e t s a n e q u a l s h a r e o f t h e a r e a ( F i g . 6 . 1 7 ) . I f t h e f i l t e r h a s i n t e g r a t o r s w i t h l a r g e Q f a c t o r s a t t h e b e g i n n i n g a n d e n d , l a r g e c a p a c i t o r s p r e a d s r e s u l t f o r t h e s e i n t e g r a t o r s . T h e s e c a p a c i t o r s w i l l s p r e a d o u t , b u t a n e m p t i e r a r e a u s u a l l y r e s u l t s i n t h e m i d d l e o f t h e c a p a c i t o r a r r a y ( F i g . 6 . 2 3 ) . T h e a r r a y h e i g h t i s a v e r y i m p o r t a n t v a r i a b l e f o r t h e m i n i m i z a t i o n o f t h e c a p a c i t o r a r e a . E a c h f i l t e r t e n d s t o h a v e a n o p t i m u m h e i g h t . I f t h e h e i g h t i s s e t l a r g e r t h a n t h i s , t h e r e w i l l b e e x c e s s s p a c e i n t h e a r r a y . I f t h e h e i g h t i s s e t t o o s m a l l , t h e f i l t e r w i l l b e l o n g e r , a n d s p a c e w i l l b e i n s e r t e d b e t w e e n t h e o p e r a t i o n a l a m p l i f i e r s . T h e a r r a y s w i t c h v a r i a b l e c a n b e u s e d t o f i n e t u n e t h e l a y o u t . S o m e t i m e s i t i s n e c e s s a r y t o e n s u r e t h a t a c a p a c i t o r s t a y s a s l o w a s p o s s i b l e , t o a l l o w a l a r g e c a p a c i t o r m o r e r o o m o n t o p . T h e c a p a c i t o r p l a t e s i z e a n d t h e p l a t e s e p a r a t i o n c a n b e e a s i l y a d j u s t e d i n t h e s o f t w a r e t o l a r g e r v a l u e s . T h e c a p a c i t o r w i r i n g w o r k s w e l l . B y k e e p i n g t h e s w i t c h e s d i r e c t l y b e l o w t h e c a p a c i t o r s t h e v e r t i c a l c o n n e c t i o n s a r e g r e a t l y s i m p l i f i e d . A t y p i c a l l a y o u t u s u a l l y r e q u i r e s s i x o r s e v e n l e v e l s o f w i r i n g . I t i s u s u a l l y p o s s i b l e t o i m p r o v e t h e w i r i n g b y o n e l e v e l b y u s i n g m o r e c o m p l e x w i r i n g , g a i n i n g 5 X . 126 T h e s w i t c h - p a i r s a r e a l w a y s p l a c e d f o r f u l l s w i t c h - s h a r i n g . T h e m a i n d r a w b a c k o f t h i s p l a c e m e n t t e c h n i q u e i s t h e l a r g e n u m b e r o f c r o s s i n g s b e t w e e n t h e c l o c k l i n e s a n d t h e s i g n a l p a t h s , c a u s i n g n o i s e . T h e r e t e n d s t o b e s o m e u n n e c e s s a r y c o n t a c t i n t h e w i r i n g t o t h e s w i t c h e s . T h e s e c a n b e e l i m i n a t e d w i t h a b i t m o r e s o p h i s t i c a t e d s o f t w a r e . T h e w i r i n g t o t h e o p e r a t i o n a l a m p l i f i e r s u s u a l l y t a k e s o n e w i r i n g l e v e l . T h e r e h a s t o b e s o m e s e p a r a t i o n b e t w e e n t h e o p e r a t i o n a l a m p l i f i e r s a n d t h e p - w e l l w h i c h g i v e s r o o m f o r o n e w i r i n g l e v e l . I f t h e r e i s m o r e t h a n o n e l e v e l o f w i r i n g h e r e , t h e l a y o u t c a n u s u a l l y b e s i m p l i f i e d b y m o v i n g s o m e o f t h e c a p a c i t o r s i n t h e f i l t e r . c t f i l e . T h i s a l s o p r o v i d e s a m e a n s o f s h o r t e n i n g c e r t a i n w i r i n g c o n n e c t i o n s i f i t i s d e s i r e d . T h e p - w e l l s h a v e m a n y s u b s t r a t e c o n t a c t s , a n d t h e o p e r a t i o n a l a m p l i f i e r V D D l i n e p r o v i d e s t h e s u b s t r a t e c o n t a c t s f o r t h e p M O S t r a n s i s t o r s o n t h e o t h e r s i d e o f t h e i n t e r v e n i n g p - w e l l . T h e s e s u b s t r a t e c o n n e c t i o n s w o r k , h o w e v e r i t w o u l d b e d e s i r a b l e t o h a v e t h e m c l o s e r t o t h e p - t r a n s i s t o r s . O v e r a l l t h e l a y o u t i s v e r y n e a t a n d e l e g a n t b e c a u s e i t i s v e r y o r d e r e d . M o d i f i c a t i o n s a r e e a s y t o m a k e b y m o v i n g c a p a c i t o r s i n t h e f i l t e r . c t f i l e , a n d i t i s p o s s i b l e t o c h a n g e t h e w i r i n g o r d e r b y m o v i n g n o d e s i n t h e f i l t e r . n d f i l e . T h i s s h o u l d n o t b e d o n e u n l e s s o n e u n d e r s t a n d s how t h e f i l t e r . n d f i l e i s a r r a n g e d . 1 27 T h e w i d t h o f t h e l a y o u t i s m i n i m u m . T h e h e i g h t o f t h e l a y o u t t e n d s t o b e s o m e 5X m o r e t h a n m i n i m u m . O v e r a l l t h e p r o g r a m s p r o d u c e a n e x c e l l e n t o u t p u t . T h e s e l a y o u t s c o m p a r e v e r y w e l l w i t h f i l t e r l a y o u t s d o n e b y M P R . A f i l t e r l a y o u t c a n b e g e n e r a t e d i n u n d e r t h r e e m i n u t e s u s i n g t h e s e p r o g r a m s , b y s o m e o n e w h o h a s n e v e r d o n e a f i l t e r l a y o u t b e f o r e . 7 . C O N C L U S I O N T w o p r o g r a m s h a v e b e e n d e v e l o p e d t o g e n e r a t e a u t o m a t i c a l l y t h e l a y o u t o f s t r a y s i n s e n s i t i v e s w i t c h e d c a p a c i t o r f i l t e r s w i t h f u l l s w i t c h - s h a r i n g a n d u s i n g s t a n d a r d - c e l l o p e r a t i o n a l a m p l i f i e r s . T h e f i r s t p r o g r a m ( C I R C E ) , r e f o r m a t s a S W I T C A P f i l t e r d e s c r i p t i o n i n t o o n e s u i t a b l e f o r a d i r e c t l a y o u t . T h e s e c o n d p r o g r a m ( S I S C L ) , g e n e r a t e s t h e l a y o u t o f t h e f i l t e r i n C I F . T h e s e p r o g r a m s w e r e t e s t e d b y g e n e r a t i n g l a y o u t s o f f i l t e r d e s i g n s f r o m M i c r o t e l P a c i f i c R e s e a r c h L t d . a n d f r o m t h e AROMA p r o g r a m . T h e l a y o u t s s e e m s a t i s f a c t o r y i n t e r m s o f c o m p a c t n e s s a n d i n f l e x i b i l i t y o f d o i n g m o d i f i c a t i o n s . A c h i p i s b e i n g f a b r i c a t e d t o t e s t t h e p e r f o r m a n c e o f a f i l t e r l a y o u t . I t i s h o p e d t h a t t h e s e p r o g r a m s w i l l b e d e v e l o p e d i n t o a u s e f u l d e s i g n t o o l f o r t h e l a y o u t o f s t r a y s i n s e n s i t i v e s w i t c h e d c a p a c i t o r f i l t e r s . 7 . 1 F U T U R E WORK T h e s e l a y o u t s s u f f e r f r o m a n u m b e r o f u n d e s i r a b l e e f f e c t s . I t w o u l d b e b e t t e r t o k e e p t h e o p e r a t i o n a l a m p l i f i e r s f u r t h e r a w a y f r o m t h e s w i t c h e s a n d t o r e m o v e a l l c r o s s i n g s o f t h e a n a l o g a n d d i g i t a l b u s s e s . N o i s e t e n d s t o b e a v e r y s e r i o u s p r o b l e m . T h e r e s t r i c t i o n o f o n l y a l l o w i n g t h e o n e c l o c k t o f e e d c h a r g e i n t o t h e o p e r a t i o n a l a m p l i f i e r s s h o u l d a l s o b e r e m o v e d . 128 129 O n e w a y o f s o l v i n g t h e s e p r o b l e m s i s t o m o v e t h e o p e r a t i o n a l a m p l i f i e r s a b o v e t h e c a p a c i t o r a r r a y a n d t o c o n n e c t t h e m d i r e c t l y t o t h e i n t e g r a t i n g c a p a c i t o r s . T h i s w i l l p r o v i d e e n o u g h d i s t a n c e f r o m t h e s w i t c h e s . T h e s w i t c h e s c a n b e a r r a n g e d i n t o s t a n d a r d c e l l s c o n s i s t i n g o f f o u r s w i t c h - p a i r s . T w o c o n n e c t t o t h e o p e r a t i o n a l a m p l i f i e r i n p u t a n d t w o c o n n e c t t o t h e o u t p u t . T h e p r o p o s e d c e l l o f F i g . 7 .1 a l s o h a s n o c r o s s i n g s o f t h e a n a l o g s i g n a l p a t h s a n d t h e d i g i t a l c l o c k s . T h e s e c e l l s c a n b e p l a c e d b e l o w t h e c a p a c i t o r w i r i n g . T h e c e l l h a s s i x i n p u t s / o u t p u t s . F o u r c o n n e c t t o t h e s h a r e d n o d e s o f t h e s w i t c h e d c a p a c i t o r s a n d t h e m i d d l e t w o c o n n e c t t o t h e o p e r a t i o n a l a m p l i f i e r i n p u t a n d o u t p u t n o d e s . I f t h e i n t e g r a t i n g c a p a c i t o r i s p l a c e d d i r e c t l y a b o v e t h e F i g . 7 . 1 : S w i t c h c e l l 130 s w i t c h c e l l , t h e c o n n e c t i o n s w i l l b e v e r y s i m p l e . A n o t h e r a p p r o a c h i s t o g e n e r a t e i n t e g r a t o r l a y o u t s a s s t a n d a r d c e l l s , a n d t h e n t o c o n n e c t t h e m i n t o t h e f i l t e r . C o u p l i n g c a p a c i t o r s a n d v a r y i n g c a p a c i t o r s i z e s c a n c a u s e p r o b l e m s w i t h t h i s a p p r o a c h . T h e r e a r e t w o r e c e n t c o n f e r e n c e p u b l i c a t i o n s t h a t u s e t h i s a p p r o a c h [ 1 5 ] [ 1 6 ] . REFERENCES J . T. Cave s , M . A . Cope l and , C. F. Rah im, and S. D. Ro senbaum, " S amp led A n a l o g F i l te r ing Us ing S w i t c h e d Capac i t o r s as Res i s to r Eu iva lent s , " IEEE J. Solid-State Circuits, v o l . S C - 1 2 , no. 6, pp. 592 -599 , 1977. B. J . H o s t i c a , R. W. B r ode r s on , and P. R. G rey , " M O S S a m p l e d Data Recur s i ve F i l te r s U s ing S w i t c h e d Capac i to r Integrators, " IEEE J. Solid-State Circuits, v o l . S C - 1 2 , no. 6, pp. 600 -608 , 1977. R. W. B rode r son , P. R. Gray , and D: A . Hodges , " M O S S w i t c h e d - C a p a c i t o r F i l t e r s , " Proc. IEEE, v o l . 67, no. 1, pp. 6 1 - 75 , 1979. P. E. F l e i s che r , and K. R. Laker, " A F am i l y of A c t i v e S w i t c h e d Capac i to r B iquad Bu i ld ing B l o ck s , " Bell System Technical Journal, v o l . 58, no. 10, pp. 2235 -2269 , 1979. K. Ma r t i n , and A . S. Sed ra , "Exact Des ign of S w i t c h e d - C a p a c i t o r Bandpass F i l te r s U s i ng C o u p l e d - B i q u a d St ructures , " IEEE Trans. Circuits Syst., v o l . C A S - 2 7 , no. 6, pp. 469 -474 , 1980. K. Ma r t i n , " Improved C i r cu i t s f o r the Rea l i za t i on of S w i t c h e d - C a p a c i t o r F i l t e r s , " IEEE Trans. Circuits Syst., v o l . C A S - 2 7 , no. 4, pp. 237 -244 , 1980. M . S. Lee, G. C. T e m e s , C. Chang, and B. Ghader i , "B i l inear S w i t c h e d - C a p a c i t o r Ladder F i l te r s , " IEEE Trans. Circuits Syst., v o l . C A S - 2 8 , no. 8, pp. 811 -821 , 1981. R. B. Datar, and A . S. Sedra , "Exact Des ign o f S t r a y s - I n s e n s i t i v e S w i t c h e d - C a p a c i t o r Ladder F i l te r s , " IEEE Trans. Circuits Syst., v o l . C A S - 3 0 , no. 12, pp. 888 -897 , 1983. E. S a n c h e z - S i n e n c i o , and J . R a m f r e z - A n g u l o , " A R O M A : A n A r e a O p t i m i z e d C A D P rog ram fo r Ca s cade SC F i l ter Des i gn , " IEEE Trans. Computer-Aided Design, v o l . C A D - 4 , no. 3, pp. 296 - 303 , 1985. P. E. A l l e n , and E. S S n c h e z - S i n e n c i o , " S w i t c h e d - C a p a c i t o r C i r cu i t s , " Van Nos t rand Re inho ld , N e w York , 1984. C. M e a d , and L. C o n w a y , " I n t roduct ion to VLS I S y s t e m s , " A d d i s o n - W e s l e y Pub l i s h i ng C o m p a n y , Read ing , Ma s s a chu se t t s , 1980. B. J . Sheu, and C. Hu, " S w i t c h - I n d u c e d Error Vo l t a ge on a S w i t c h e d Capac i t o r , " IEEE J. Solid-State Circuits, v o l . S C - 1 9 , no. 4, pp. 519 -525 , 1984. J . L. M c C r e a r y , "Ma t ch i ng P r ope r t i e s , and Vo l t age and Temperature Dependence o f M O S Capac i t o r s , " IEEE J. Solid-State Circuits, v o l . S C - 1 6 , no. 6, pp. 608 - 615 , 1981. 131 132 J . Shyu , G. C. T e m e s , and K. Yao , "Random Errors in M O S Capac i t o r s , " IEEE J. Solid-State Circuits, v o l . S C - 1 7 , no. 6, pp. 1070-1075, 1982. T. P l e te r sek , J . T ron te l j , L. T ron te l j , I. J o n e s , G. Shenton, Y. Sun, " A n a l o g LSI De s i gn W i t h C M O S Standard Ce l l s , " Proc. CICC, 1985, pp. 479 -483 . P. E. A l l e n , E. R. M a c a l u s o , S. F. B i l y , and A . Nedungadi , "A IDE2: A n A u t o m a t e d A n a l o g IC Des ign S y s t e m , " Proc. CICC, 1985, pp. 4 98 - 501 . S. C. Fang, " S W I T C A P User ' s Gu ide, " Department of E l ec t r i c a l Eng ineer ing , C o l u m b i a Un i ve r s i t y , Oc tobe r , 1982. A P P E N D I X A : I S O C M O S D E S I G N R U L E S T h e f o l l o w i n g s i m p l i f i e d d e s i g n r u l e s w e r e u s e d i n t h e l a y o u t . L A Y O U T D E S I G N T O L E R A N C E S D e v i c e A c t i v e A r e a s C o n d u c t o r w i d t h C o n d u c t o r S e p a r a t i o n N+ t o P+ i n s a m e s u b s t r a t e P+ a c t i v e i n N - s u b s t r a t e t o p - w e l l N+ a c t i v e i n N - s u b s t r a t e t o p - w e l l P - w e l l W i d t h O v e r l a p o n a c t i v e S e p a r a t i o n ( d i f f e r e n t p o t e n t i a l s ) P o l y s i l i c o n 1 C o n d u c t o r w i d t h C o n d u c t o r s e p a r a t i o n T r a n s i s t o r c h a n n e l o v e r l a p N + / P + O v e r l a p o n a c t i v e D i s t a n c e t o P + / N + a c t i v e D i s t a n c e t o P + / N + c h a n n e l g a t e P o l y s i 1 i c o n 2 C o n d u c t o r w i d t h C o n d u c t o r s e p a r a t i o n P1 o v e r l a p f o r p r e c i s i o n c a p a c i t a n c e M I N I M U M V A L U E 2X 2X 3X 5X 4 X 3X 2X 8 X 2X 2X 2X 2 X 2 X 3X 2X 2 X I X 1 33 134 L A Y O U T D E S I G N T O L E R A N C E S C u t s S i z e A c t i v e o v e r l a p P1 o v e r l a p P 2 o v e r l a p M e t a l o v e r l a p S e p a r a t i o n f r o m P 1 / P 2 M e t a l C o n d u c t o r w i d t h C o n d u c t o r s e p a r a t i o n P a s s i v a t i o n D i s t a n c e i n s i d e p a d e d g e M I N I M U M V A L U E 2 X * 2 X 1X 1X 1 . 5 X 1X 2X 2X 2X 2X T h e r e s h o u l d b e a p - w e l l s u b s t r a t e c o n t a c t e v e r y 6 0 X . T h e r e s h o u l d b e a n N - s u b s t r a t e c o n t a c t e v e r y 1 2 0 X . A P P E N D I X B : S W I T C A P S W I T C A P i s a g e n e r a l p u r p o s e s i m u l a t i o n p r o g r a m f o r t h e a n a l y s i s o f s w i t c h e d c a p a c i t o r n e t w o r k s d e v e l o p e d a t C o l u m b i a U n i v e r s i t y [ 1 7 ] . F e a t u r e s i n c l u d e s w i t c h i n g i n t e r v a l s , n e t w o r k e l e m e n t s a n d f r e q u e n c y d o m a i n a n a l y s i s a m o n g o t h e r s . T h e p r o g r a m u s e s a n u m b e r o f c h a r g e v a r i a b l e s a s t h e n e t w o r k v a r i a b l e s f o r a n a l y s i s . A S W I T C A P i n p u t f i l e c o n s i s t s o f a T I M I N G b l o c k s p e c i f y i n g t h e c l o c k s u s e d , a n o p t i o n a l S U B C K T b l o c k c o n t a i n i n g a n y s u b c i r c u i t c a l l s , a C I R C U I T b l o c k c o n t a i n i n g t h e n e t w o r k e l e m e n t s , a n d a n A N A L Y Z E b l o c k s p e c i f y i n g t h e i n p u t v o l t a g e , t h e a n a l y s i s d e s i r e d a n d t h e o u t p u t f o r m a t . T h e o n l y n e t w o r k e l e m e n t s a l l o w e d a r e s w i t c h e s , c a p a c i t o r s , v o l t a g e - c o n t r o l l e d v o l t a g e s o u r c e s , a n d i n d e p e n d e n t v o l t a g e s o u r c e s . A n e t w o r k e l e m e n t s t a t e m e n t f o l l o w s t h e f o l l o w i n g g e n e r a l f o r m a t : < r> < e l e m e n t name> ( < n o d e l i s t > ) < e l e m e n t v a l u e > ; w h e r e < r> i s a k e y c h a r a c t e r i n d i c a t i n g t h e e l e m e n t t y p e . T h e k e y c h a r a c t e r d e s i g n a t i o n s a r e S ( s w i t c h ) , C ( c a p a c i t o r ) , E ( v o l t a g e - c o n t r o l l e d v o l t a g e s o u r c e ) , a n d V ( i n d e p e n d e n t v o l t a g e s o u r c e ) . < e l e m e n t n a m e > i s a s t r i n g o f a l p h a n u m e r i c c h a r a c t e r s l e s s 135 136 t h a n s e v e n c h a r a c t e r s l o n g s e r v i n g a s a l a b e l f o r t h e e l e m e n t . < n o d e l i s t > i s a l i s t o f n o d e s t o w h i c h t h e e l e m e n t i s c o n n e c t e d . A n o d e n a m e i s a s t r i n g o f s e v e n o r l e s s a l p h a n u m e r i c c h a r a c t e r s . T h e g r o u n d n o d e i s a l w a y s 0 ( t h e d i g i t z e r o ) . < e l e m e n t v a l u e > g i v e s t h e " v a l u e " o f t h e e l e m e n t t h a t i s a p p r o p r i a t e t o t h e e l e m e n t . A s w i t c h may a l s o b e c l o c k e d b y t h e c o m p l e m e n t o f a c l o c k d e f i n e d i n t h e T I M I N G b l o c k . T h i s i s d o n e b y a d d i n g t h e c h a r a c t e r # i n f r o n t o f t h e c l o c k n a m e f o r t h e s w i t c h . A s a m p l e S W I T C A P i n p u t f i l e o f a s w i t c h e d c a p a c i t o r i n t e g r a t o r i s s h o w n i n F i g . B . 1 . 1 37 O P T I O N S ; R E P O R T ; C H K C L K ; E N D ; T I T L E : S a m p l e S W I T C A P f i l e / * t i m i n g s e c t i o n * / T I M I N G ; P E R I O D l e - 6 ; C L O C K c 1 (0 3 / 8 ) ; E N D ; / * n e t w o r k s e c t i o n * / C I R C U I T ; / * s w i t c h e s * / 5 1 (1 2 ) c ; 5 2 (2 3) # c ; / * p e r i o d o f t i m e b a s e * / / * c l o c k d e f i n i t i o n * / / * c a p a c i t o r s * / C I (2 0) 0 . 1 0 0 ; C 2 (1 3) 0 . 2 3 3 ; C 3 (3 4 ) 0 . 9 5 2 ; / * v o l t a g e - c o n t r o l l e d v o l t a g e s o u r c e s * / / * E l (4 0 0 3) 1 0 0 0 0 ; / * i n d e p e n d e n t v o l t a g e s o u r c e * / V I (1 0 ) ; / * v a l u e g i v e n i n a n a l y s i s s e c t i o n * / E N D ; / * a n a l y s i s s e c t i o n * / A N A L Y Z E S S S ; / * s i n u s o i d a l s t e a d y - s t a t e a n a l y s i s * / I N F R E Q 0 . 0 1 1 0 0 0 0 L O G 1 2 ; / * s w e e p i n 12 s t e p s * / S E T V I A C 1 . 0 0 . 0 ; / * a m p l i t u d e a n d p h a s e * / P R I N T V R ( 4 ) V I ( 4 ) ; / * r e a l a n d i m a g i n a r y * / P L O T V D B ( 4 ) V P ( 4 ) ; / * m a g n i t u d e a n d p h a s e * / E N D ; E N D ; F i g . B . 1 : S a m p l e S W I T C A P f i l e A P P E N D I X C : T H E C I R C U I T E X T R A C T O R L I S T I N G T h e c i r c u i t e x t r a c t o r r e q u i r e s t h e f i l e n a m e a n d f i l e n a m e . i n f i l e s t o r u n . I t i s r u n a s f o l l o w s : C I R C E f i l e n a m e s t y l e <CR> w h e r e s t y l e r e f e r s t o o n e o f t h e f o l l o w i n g d e s i g n t e c h n i q u e s : A ( A R O M A ) , L ( L e e ) , M ( M a r t i n ) , a n d S ( D a t a r & S e d r a ) . T h e s i n g l e c h a r a c t e r i s u s e d . I t p r o d u c e s t w o o u t p u t f i l e s c a l l e d f i l e n a m e . n d a n d f i l e n a m e . c t . 138 139 # i n c l u d e < s t d i o . h > # d e f i n e L E N G T H 72 /* B U F F E R L E N G T H * / # d e f i n e WORD 8 /* I D E N T I F I E R L E N G T H * / # d e f i n e S I Z E 5 0 /* S I Z E O F T A B L E A R R A Y * / # d e f i n e Z E R O 0 /* Z E R O C O N S T A N T * / # d e f i n e O N E 1 /* O N E C O N S T A N T * / # d e f i n e TWO 2 /* TWO C O N S T A N T * / # d e f i n e T H R E E 3 /* T H R E E C O N S T A N T * / # d e f i n e F O U R 4 /* F O U R C O N S T A N T * / # d e f i n e EOW • \ 0 « ' \ n ' /* E N D O F WORD * / # d e f i n e E O L /* E N D O F L I N E * / c h a r t a b l e [ 2 ] [ S I Z E ] [ W O R D ] c h a r f i r s t n o d e [ W O R D ] ; c h a r m i d n o d e [ W O R D ] ; c h a r l a s t n o d e [ W O R D ] ; / * S U B S T I T U T I O N T A B L E * / / * F I L T E R I N P U T N O D E * / / * F I L T E R L I N K N O D E * / / * F I L T E R O U T P U T N O D E * / c h a r * p s u b = " S U B C K T " ; /* S U B C K T P O I N T E R * / c h a r * p c i r = " C I R C U I T " ; /* C I R C U I T P O I N T E R * / c h a r * p a n a = " A N A L Y Z E " ; /* A N A L Y Z E P O I N T E R * / c h a r * p e n d = " E N D " ; /* E N D P O I N T E R * / c h a r * n o d e = " ! A A " ; /* NEW N O D E P O I N T E R * / c h a r * o a — " O A (" ; /* O P E R A T I O N A L A M P * / c h a r * b s = " B S (" ; /* B U F F E R S W I T C H * / c h a r * b c SB " B C (" ; /* B U F F E R C A P A C I T O R * / c h a r * s c = " S C (" ; /* S W I T C H E D C A P A C I T O R * / c h a r * i c = " I C (" ; /* I N T E G R A T I N G C A P A C I T O R c h a r * c c = " C C (" ; /* C O U P L I N G C A P A C I T O R * / /**************************************** /* */ / * M A I N P R O G R A M — C I R C U I T E X T R A C T O R * / /* */ /***********************************************************/ m a i n ( a r g c , a r g v ) /* F E T C H C S H E L L P A R A M E T E R S * / i n t a r g c ; /* N U M B E R O F A R G U M E N T S * / c h a r * a r g v [ ] ; /* A R G U M E N T P O I N T E R S * / { c h a r h e a d ; /* I N P U T S E C T I O N S T Y L E * / c h a r * f p ; /* F I L E P O I N T E R * / c h a r s t ; /* C H A R A C T E R S T O R A G E * / i n t i ; /* I T E R A T I O N V A R I A B L E * / F I L E * f d i n ; /* . I N F I L E D E S C R I P T O R * / F I L E * f d c t ; /* . C T F I L E D E S C R I P T O R * / F I L E * f d n d ; /* . N D F I L E D E S C R I P T O R * / F I L E * f d s w ; /* S W I T C A P F I L E D E S C R I P T O R * / F I L E * f o p e n ( ) ; /* F I L E O P E N F U N C T I O N * / 1 4 0 / * S T O R E T H E I N P U T S E C T I O N S T Y L E * / s t = * a r g v [ 2 ] ; h e a d = ( ( s t > = ' a » && s t < = » z ' ) ? s t - ' a ' + ' A ' s t ) / * O P E N S W I T C A P I N P U T F I L E F O R R E A D I N G * / f p = a r g v f l ] ; f d s w = f o p e n ( f p , " r " ) ; / * O P E N T H E . I N F I L E F O R R E A D I N G f o r ( i = 0 ; * ( f p + i ) ! = E O W ; i + + ) ; = t > */ * ( f p + i + 0 ) * ( f p + i + l ) * ( f p + i + 2 ) * ( f p + i + 3 ) f d i n = f o p e n ( f p , " r " ) = ' i ' = ' n ' = EOW / * O P E N T H E . C T F I L E * ( f p + i + l ) = ' c ' ; * ( f p + i + 2 ) = ' t ' ; f d c t = f o p e n ( f p , " w " ) F O R W R I T I N G * / / * O P E N T H E . N D F I L E F O R W R I T I N G * / * ( f p + i + l ) = ' n ' ; * ( f p + i + 2 ) = ' d 1 ; f d n d = f o p e n ( f p , " w " ) ; r e d u c e ( f d s w ) r e p l a c e ( ) ; i s o l a t e ( f d i n ) s t a g e s ( ) ; / * C L E A N U P T H E I N P U T F I L E * / / * S U B S T I T U T E A L L S U B C K T C A L L S * / / * I S O L A T E I N P U T S E C T I O N * / / * G R O U P I N T O I N T E G R A T O R S * / } / * i f i f i f i f P R O C E S S T H E A P P R O P R I A T E I N P U T S E C T I O N * / ( h e a d = = ' L ' ) i n p u t l ( f d c t ) ; i n p u t 2 ( f d c t ) ; i n p u t 3 ( f d c t ) ; i n p u t 4 ( f d c t ) ; ( h e a d = = ' M ' ) ( h e a d = = ' S « ) ( h e a d = = ' A ' ) o r d e r l ( f d n d ) o r d e r 2 ( f d c t ) f c l o s e ( f d i n ) ; f c l o s e ( f d s w ) ; f c l o s e ( f d n d ) ; f c l o s e ( f d c t ) ; / * S O R T I N T E G R A T O R S * / / * S O R T E L E M E N T S A N D N O D E S * / / * C L O S E . I N F I L E * / / * C L O S E S W I T C A P F I L E * / / * C L O S E . N D F I L E * / / * C L O S E . C T F I L E * / /******************************************** /* */ / * R E D U C E F U N C T I O N — C l e a n U p T h e I n p u t F i l e * / 141 /* */ / * T h e reduce function removes any comments and blank */ /* lines in the S W I T C A P input f i l e . I t also capitalizes */ /* a l l characters and ensures that there i s only one */ /* statement per line. T h e f i l t e r input and output nodes */ /* are saved here. */ /* */ /**************************************** reduce(fdsw) F I L E *fdsw ; / * S W I T C A P I N P U T F I L E * / { C h a r buf[L E N G T H ] ; / * L I N E B U F F E R * / F I L E *fdto ; / * O U T P U T F I L E * / F I L E *fopen() ; / * F I L E O P E N F U N C T I O N * / fdto - fopenC ' S C I N P " , "w") ; / * O P E N O U T P U T F I L E * / / * R E A D L I N E S U N T I L A S U B C K T OR T H E C I R C U I T S E C T I O N * / do { readclean(fdsw,buf) ; } while (!same(buf,psub) && !same(buf,pcir)) ; / * W R I T E L I N E S T O O U T P U T F I L E U N T I L A N A L Y Z E S E C T I O N * / / * T H E I N P U T N O D E I S T A K E N F R O M T H E V O L T A G E S O U R C E * / while (!same(buf,pana)) { i f (buf [ 0 ] ! = E O L ) i f ( b u f [ 0 ] = = ' V ) getnode(buf ,ONE,firstnode) ; else writeline(fdto,buf) ; readclean(fdsw,buf) ; ) / * N O T E O U T P U T N O D E F R O M P R I N T / P L O T S T A T E M E N T * / while (buf [ 0 ] ! = E O F ) { i f ( b u f [ 0 ] = = ' P ' ) getnode(buf,ONE,lastnode) ; readclean(fdsw,buf) ; } } f c l o s e ( f d t o ) ; / * C L O S E O U T P U T F I L E * / /*********************************************** /* */ / * R E P L A C E F U N C T I O N — I n s e r t S u b c k t s I n t o C i r c u i t * / /* */ / * T h e r e p l a c e f u n c t i o n i n s e r t s a n y s u b c i r c u i t s i n t o * / / * t h e C I R C U I T b l o c k . * / /* */ /************************************************* 1 4 2 replace() { char b u f [ L E N G T H ] ; char subname[WORD] char callname[WORD] int count = 0 ; int ch ; F I L E *fdfrom ; F I L E *fdto ; F I L E *fdsub ; F I L E *fopen() ; /* /* /* /* /* /* /* /* /* L I N E B U F F E R * / S U B C I R C U I T N A M E * / S U B C I R C U I T C A L L N A M E * / C O U N T I N G I N T E G E R * / C H A R A C T E R S T O R A G E * / F I L E B E I N G R E A D F R O M * / F I L E B E I N G W R I T T E N T O * / S U B C I R C U I T S T O R A G E F I L E * / F I L E O P E N F U N C T I O N * / fdfrom = fopenC 'SCINP'V'r") ; / * O P E N I N P U T F I L E * / fdto = fopen ( " S C I N Q " , " W " ) ; / * O P E N O U T P U T F I L E * / / * R E P L A C E T H E S U B C I R C U I T S O N E A T A T I M E * / / * U N T I L T H E R E A R E NO M O R E S U B C K T B L O C K S * / readline(fdfrom,buf) ; while (same(buf,psub)) / * G E T T H E S U B C I R C U I T N A M E * / { getval(buf,subname) ; empty(ZERO) ; / * W R I T E T H E S U B C K T B L O C K T O A S P A R E F I L E W H I L E * / / * T A B U L A T I N G A L L P A R A M E T E R S I N T O T A B L E [ 0 ] * / fdsub = f o p e n C ' S U B C " , "w") ; while (!same(buf,pend)) w r i t e l i n e ( f d s u b , b u f ) ; f c l o s e ( f d s u b ) ; / * S C A N T H E R E S T O F T H E F I L E F O R S U B C I R C U I T C A L L S * / d o ( r e a d l i n e ( f d f r o m , b u f ) ; i f ( b u f [ 0 ] == ' X ' ) / * G E T T H E C A L L E D S U B C I R C U I T 1 S N A M E * / ( g e t v a l ( b u f , c a l l n a m e ) ; { writeline(fdsub,buf) tabulate(buf ,ZERO) ; readline(fdfrom,buf) / * C O M P A R E T H E N A M E S * / i f (same(subname,callname)) / * I F T H E S A M E , T A B U L A T E C A L L I N G * / / * P A R A M E T E R S I N T O T A B L E [ 1 ] * / { empty(ONE) ; tabulate(buf,ONE) ; 143 } / * I N S E R T A N Y A D D I T I O N A L N O D E S * / f i l l ( ) ; / * R E P L A C E T H E C A L L B Y T H E S U B C I R C U I T * / w r i t e s u b ( f d t o ) ; } e l s e w r i t e l i n e ( f d t o , b u f ) ; } e l s e i f ( b u f [ 0 ] != E O F ) w r i t e l i n e ( f d t o , b u f ) ; ) w h i l e ( b u f [ 0 ] != E O F ) ; / * C L O S E I N P U T A N D O U T P U T F I L E S * / f c l o s e ( f d t o ) ; f c l o s e ( f d f r o m ) ; / * R E V E R S E T H E I N P U T A N D O U T P U T F I L E S * / / * F O R T H E N E X T P A S S * / i f ( c o u n t % 2) { f d f r o m = f o p e n C ' S C I N P " , " r " ) ; f d t o = f o p e n ( " S C I N Q " , " w " ) ; } e l s e { f d f r o m = f o p e n ( " S C I N Q H , " r " ) ; f d t o = f o p e n ( " S C I N P " , " w " ) ; } c o u n t + + ; r e a d l i n e ( f d f r o m , b u f ) ; } / * C L O S E I N P U T A N D O U T P U T F I L E S * / f c l o s e ( f d f r o m ) ; f c l o s e ( f d t o ) ; / * M A K E S U R E T H A T T H E F I N A L O U T P U T * / / * F I L E I S T H E E X P E C T E D O N E * / i f ( ! ( c o u n t % 2 ) ) { f d f r o m = f o p e n ( " S C I N P " , " r " ) ; f d t o = f o p e n ( " S C I N Q " , " w " ) ; / * C O P Y I N P U T F I L E T O O U T P U T F I L E * / w h i l e ( ( c h = g e t c ( f d f r o m ) ) ! = E O F ) p u t c ( c h , f d t o ) ; f c l o s e ( f d f r o m ) ; f c l o s e ( f d t o ) ; ) /*****************************^ /* */ / * W R I T E S U B F U N C T I O N — I n s e r t s S u b c i r c u i t * / /* */ / * T h e w r i t e s i i b f u n c t i o n c o p i e s t h e s u b c i r c u i t * / / * c u r r e n t l y s t o r e d i n t o t h e o u t p u t f i l e . T h e p a r a m e t e r s * / / * a r e r e p l a c e d b y t h o s e o f t h e c a l l i n g s t a t e m e n t . * / 1 4 4 / * V / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / w r i t e s u b ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / { C h a r 1 i n [ L E N G T H ] ; / * S U B C I R C U I T L I N E B U F F E R * / C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R F O R O U T P U T * / c h a r p a r [ W O R D ] ; / * P A R A M E T E R B U F F E R * / i n t a , b , i , j ; / * I N D E X P A R A M E T E R S * / i n t l o c n ; / * I N D E X T A B L E L O C A T I O N * / i n t f l a g ; / * S E A R C H S U C C E S S F L A G * / F I L E * f d s u b ; / * S U B C I R C U I T F I L E * / F I L E * f o p e n ( ) ; / * F I L E O P E N F U N C T I O N * / / * P R O C E S S E A C H L I N E I N T H E S U B C I R C U I T F I L E I N T U R N * / f d s u b = f o p e n C ' S U B C " , " r " ) ; d o { r e a d l i n e ( f d s u b , l i n ) ; / * DO N O T P R O C E S S H E A D E R A N D E N D S T A T E M E N T S * / i f ( ! s a m e ( l i n , p e n d ) && ! s a m e ( l i n , p s u b ) && l i n [ 0 ] ! = E O F ) / * C O P Y T H E F I R S T P A R T O F T H E L I N E * / { a = b = 0 ; d o { b u f [ a + + ] = l i n [ b ] ; } w h i l e ( l i n [ b + + ] ! = ' ( ' ) ; / * R E P L A C E A L L P A R A M E T E R S * / d o ( w h i l e ( l i n [ b ] = = ' •) b u f [ a + + ] = l i n [ b + + ] ; / * S T O R E T H E P A R A M E T E R * / i = 0 ; w h i l e ( l i n [ b ] ! = ' • && l i n [ b ] i = ' ) ' && l i n [ b ] ! = p a r [ i + + ] = l i n [ b + + ] ; p a r [ i ] = EOW ; / * L O C A T E T H E P A R A M E T E R I N T A B L E [ 0 ] * / i f ( i ! = 0 ) { l o c n = 0 ; f l a g - 1 ; d o { i f ( s a m e ( p a r , & t a b l e [ 0 ] [ l o c n + + ] [ 0 ] ) ) f l a g = 0 ; } w h i l e ( t a b l e [ 0 ] [ l o c n - 1 ] [ 0 ] ! = E O W && f l a g ) / * I N S E R T T H E R E P L A C E M E N T P A R A M E T E R * / j = (-D ; w h i l e ( t a b l e [ 1 ] [ l o c n - 1 ] ! = E O W ) b u f [ a + + ] = t a b l e [ l ] [ l o c n - 1 ] [ j ] ; } i f ( l i n [ b ] = = « ) ' II l i n [ b ] = = ' ; » ) b u f [ a + + ] = l i n [ b + + ] ; } w h i l e ( l i n [ b - l ] ! = ' ; ' && i!=0) ; / * W R I T E C O N V E R T E D L I N E T O O U T P U T F I L E * / b u f [ a ] = E O L ; w r i t e l i n e ( f d t o , b u f ) ; } } w h i l e ( l i n [ 0 ] ! = E O F ) ; f c l o s e ( f d s u b ) ; / * C L O S E S U B C I R C U I T F I L E * / > /******************************************* /* / * T A B U L A T E F U N C T I O N — F i l l s S u b s t i t u t i o n T a b l e / * / * T h e t a b u l a t e f u n c t i o n s t o r e s a l l p a r a m e t e r s i n t h e / * i n p u t s t r i n g i n T A B L E [ ] . W h e n t a b u l a t i n g t h e l i n e s i n / * t h e s u b c i r c u i t , n o p a r a m e t e r i s s t o r e d m o r e t h a n o n c e . / * /********************************************************* t a b u l a t e ( b u f , c o l ) C h a r b u f [ L E N G T H ] ; / * I N P U T L I N E B U F F E R * / i n t C O l ; / * T A B U L A T I O N C O L U M N * / { C h a r p a r [ W O R D ] ; / * P A R A M E T E R B U F F E R * / i n t i , q ; / * I N D E X I N G V A R I A B L E S * / i n t s e t ; / * P A R A M E T E R S E T * / / * P R O C E S S I N P U T L I N E * / q = 0 ; f o r ( s e t=0; s e t<2; s e t + + ) / * I G N O R E D A T A B E F O R E F I R S T B R A C K E T * / { w h i l e ( b u f [ q ] != • ( ' && b u f [ q ] != ' ; ' ) q++ ; i f ( b u f [ q ] == • ( ' ) q++ ; / * P L U C K O U T T H E P A R A M E T E R S * / d o { w h i l e ( b u f [ q ] == • 1 ) q++ ; / * M A K E A L L O W A N C E F O R : I N S U B C K T L I N E * / i f ( s e t = = l && s a m e ( b u f , p s u b ) ) w h i l e ( b u f [ q ] != • : « && b u f [ q ] ! = • ; ' ) q++ i f ( b u f [ q ] == ' : 1 ) q++ ; 1 4 6 / * S T O R E T H E P A R A M E T E R * / i - 0 ; w h i l e ( b u f [ q ] ! = ' ' && b u f [ q ] ! = ' ) • && b u f [ q ] ! = • ; 1 ) p a r [ i + + ] = b u f [ q + + ] ; p a r [ i ] = EOW ; / * I N S E R T P A R A M E T E R I N T O T A B L E [ ] * / i f ( b u f [ 0 ] != ' ; ' ) i f ( c o l = = 0 && ! i n ( p a r , 0 ) || c o l = = l ) i n s e r t ( p a r , c o l ) ; } w h i l e ( b u f [ q ] ! = ' ) 1 && b u f [ q ] ! = ' ; ' ) ; } } /*********************************************** / * * / / * I S O L A T E F U N C T I O N - - I s o l a t e I n p u t S t a g e * / /* */ / * T h e i s o l a t e f u n c t i o n c l e a n s u p t h e . i n f i l e , a n d * / / * r e m o v e s a n y l i n e s i n t h e f i l t e r f i l e t h a t m a t c h o n e i n * / / * t h e i n p u t s e c t i o n f i l e . T h i s s e p a r a t e s t h e i n p u t * / / * s e c t i o n f r o m t h e f i l t e r d e s c r i p t i o n . * / /* */ /***********************************************************/ i s o l a t e ( f d i n ) F I L E * f d i n ; / * . I N I N P U T F I L E * / ( c h a r b u f [ L E N G T H ] , l i n [ L E N G T H ] ; / * L I N E B U F F E R S * / C h a r S t l [ W O R D ] , s t 2 [ W O R D ] ; / * S T O R A G E F O R N O D E S * / C h a r s t 3 [ W O R D ] , s t 4 [ W O R D ] ; / * S T O R A G E F O R N O D E S * / i n t f l a g ; / * M A T C H I N G F L A G * / F I L E * f d t o ; / * O U T P U T F I L E * / F I L E * f d f l ; / * I N P U T F I L E 1 * / F I L E * f d f 2 ; / * I N P U T F I L E 2 * / F I L E * f o p e n ( ) ; / * F I L E O P E N F U N C T I O N * / / * E M P T Y T A B L E * / e m p t y ( Z E R O ) ; e m p t y ( O N E ) ; / * I N I T I A L I Z E N O D A L I N F O R M A T I O N I N T A B L E * / c o p y ( f i r s t n o d e , S t a b l e [ 1 ] [ 0 ] [ 0 ] ) ; c o p y ( l a s t n o d e , S t a b l e [ 1 ] [ 1 ] [ 0 ] ) ; t a b l e [ l ] [ 2 ] [ 0 ] = E O L ; / * W R I T E I N P U T S E C T I O N T O O U T P U T F I L E , U S I N G T H E * / / * S A M E P R O C E S S I N G A S T H E R E D U C E F U N C T I O N D O E S * / f d f l = f o p e n p ' S U B C ' V ' w " ) ; r e a d c l e a n ( f d i n , b u f ) ; 1 4 7 w h i l e ( b u f [ 0 ] != E O F ) { i f ( b u f [ 0 ] != E O L ) w r i t e l i n e ( f d f l , b u f ) ; r e a d c l e a n ( f d i n , b u f ) ; } f c l o s e ( f d f l ) ; f d f l = f o p e n ( , , S C I N Q , , , " r " ) ; f d t o = f o p e n ( " S C I N P " , " w " ) ; f d f 2 = f o p e n ( » S U B C " , " r " ) ; / * O P E N F I L T E R F I L E * / / * O P E N O U T P U T F I L E * / / * O P E N I N P U T S E C T I O N F I L E * / / * W R I T E A L L L I N E S N O T E X I S T I N G I N I N P U T * / / * S E C T I O N F I L E T O T H E O U T P U T F I L E * / r e a d l i n e ( f d f l , b u f ) ; r e a d l i n e ( f d f l , b u f ) ; w h i l e ( ! s a m e ( b u f , p e n d ) ) { f l a g = 1 ; / * R E A D O N E L I N E F R O M T H E I N P U T S E C T I O N F I L E * / r e a d l i n e ( f d f 2 , l i n ) ; w h i l e ( f l a g && l i n [ 0 ] ! = E O F ) / * C H E C K T O S E E I F T H E Y A R E T H E S A M E T Y P E * / { i f ( b u f [ 0 ] = = l i n [ 0 ] ) / * G E T T H E N O D E S F R O M B O T H L I N E S * / ( g e t n o d e ( b u f , l , s t l ) ; g e t n o d e ( b u f , 2 , s t 2 ) ; g e t n o d e ( l i n , l , s t 3 ) ; g e t n o d e ( l i n , 2 , s t 4 ) ; / * I F N O D E S A R E T H E S A M E , L I N E S A R E E Q U A L * / i f ( s a m e ( s t l , s t 3 ) && s a m e ( s t 2 , s t 4 ) | | s a m e ( s t l , s t 4 ) && s a m e ( s t 2 , s t 3 ) ) f l a g = 0 ; } / * R E A D N E X T L I N E F R O M I N P U T S E C T I O N F I L E * / r e a d l i n e ( f d f 2 , l i n ) ; } / * I F NO M A T C H WAS M A D E , W R I T E L I N E T O O U T P U T F I L E * / i f ( f l a g ) w r i t e l i n e ( f d t o , b u f ) ; / * P R E P A R E F O R T H E N E X T L I N E F R O M T H E F I L T E R F I L E * / r e w i n d ( f d f 2 ) ; r e a d l i n e ( f d f l , b u f ) ; } f c l o s e ( f d f l ) ; / * C L O S E F I L T E R F I L E * / f c l o s e ( f d f 2 ) ; / * C L O S E I N P U T S E C T I O N F I L E * / f c l o s e ( f d t o ) ; / * C L O S E O U T P U T F I L E * / 1 4 8 /******************************^ / * * / / * S T A G E S F U N C T I O N — G r o u p E l e m e n t s I n t o S t a g e s * / /* */ / * T h e s t a g e s f u n c t i o n g r o u p s t h e f i l t e r e l e m e n t s i n t o * / / * g r o u p s b a s e d o n w h i c h o p - a m p i n p u t t h e y a r e c o n n e c t e d * / / * t o . S I S C e l e m e n t s a r e c o l l e c t e d i n t o o n e e l e m e n t . * / /* */ /********************************^ s t a g e s ( ) { Char o p l [ W O R D ] , o p 4 [ W O R D ] ; / * O P - A M P N O D E S * / c h a r s t l [ W O R D ] , s t 2 [ W O R D ] ; / * E L E M E N T N O D E S * / c h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / l o n g o f f s e t ; / * F I L E M A R K E R * / F I L E * f d t o ; / * O U T P U T F I L E * / F I L E * f d f r o m ; / * I N P U T F I L E * / F I L E * f o p e n ( ) ; / * F I L E O P E N F U N C T I O N * / f d f r o m = fopenC ' S C I N P'V ' r " ) ; / * O P E N T H E I N P U T F I L E * / f d t o = ^penC ' S C I N O'V^ w " ) ; / * O P E N T H E O U T P U T F I L E * / / * T H E G R O U P I N G I S B A S E D ON T H E O P - A M P S * / r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) / * C H E C K F O R A N O P - A M P E L E M E N T * / { i f ( b u f [ 0 ] = = ' E ' && " s a m e ( b u f , p e n d ) ) / * W R I T E O P - A M P T O O U T P U T F I L E * / / * A N D S A V E I T S N O D E S * / { w r o u t ( f d t o , b u f , o a ) ; g e t n o d e ( b u f , O N E , o p l ) ; g e t n o d e ( b u f , F O U R , o p 4 ) ; / * NOW S E A R C H T H E F I L E F O R C O N N E C T I N G E L E M E N T S * / o f f s e t = f t e l l ( f d f r o m ) ; r e w i n d ( f d f r o m ) ; r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) / * C A P A C I T O R S M U S T B E I C O R C C * / { i f ( b u f [ 0 ] = = ' C ) { g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * I C I F C O N N E C T E D A C R O S S T H E O P - A M P * / i f ( s a m e ( o p 4 , s t l ) && s a m e ( o p l , s t 2 ) | | 149 s a m e ( o p l , s t l ) && s a m e ( o p 4 , s t 2 ) ) w r o u t ( f d t o , b u f , i c ) ; / * E L S E I T MUST BE A CC * / e l s e i f ( s a m e ( o p 4 , s t l ) || s a m e ( o p 4 , s t 2 ) ) w r o u t ( f d t o , b u f , c c ) ; } / * SWITCHES MUST BE PART OF S I S C ' S * / e l s e i f ( b u f [ 0 ] = = ' S ' ) { g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * COMPLETE THE S I SC ELEMENT * / i f ( s a m e ( o p 4 , s t l ) ) s i s c ( f d f r o m , f d t o , b u f , s t 2 , s t l ) ; i f ( s a m e ( o p 4 , s t 2 ) ) s i s c ( f d f r o m , f d t o , b u f , s t l , s t 2 ) ; } r e a d l i n e ( f d f r o m , b u f ) ; } / * SEPARATE THE BLOCKS WITH A BLANK L I N E * / p u t c ( E O L , f d t o ) ; / * RETURN THE F I L E TO ITS SAVED POS IT ION * / f s e e k ( f d f r o m , o f f s e t , Z E R O ) ; } r e a d l i n e ( f d f r o m , b u f ) ; } / * CLOSE INPUT AND OUTPUT F I L E S * / f c l o s e ( f d t o ) ; f c l o s e ( f d f r o m ) ; /***********************************************************/ / * * / / * S I S C FUNCTION — I d e n t i f y a S w i t c h e d C a p a c i t o r * / /* */ / * T h e s i s c f u n c t i o n g a t h e r s t h e o t h e r f o u r e l e m e n t s * / / * o f a s t r a y - i n s e n s i t i v e s w i t c h e d c a p a c i t o r b e l o n g i n g t o * / / * t h e s w i t c h p r o v i d e d b y t h e s t a g e s f u n c t i o n . * / /* */ /************************************************ s i s c ( f d f r o m , f d t o , b u f , c o n 2 , c o n l ) c h a r b u f [ L E N G T H ] c h a r con2[W0RD] c h a r con l [WORD] F I L E * f d f r o m ; F I L E * f d t o ; / * INPUT F I L E * / / * OUTPUT F I L E * / / * L INE FOR SWITCH ELEMENT * / / * SECOND NODE OF SWITCH * / / * NODE #1 OF S I S C ELEMENT * / { Char Stl [WORD],St2 [WORD] / * NODE STORAGE STRINGS * / 1 5 0 Char COn3 [WORD],COn4[WORD] ; / * S I S C E L E M E N T H I D D E N N O D E S Char c l k [ 5 ] [ W O R D ] ; / * S I S C E L E M E N T P A R A M E T E R S * / l o n g o f f s e t , o f f s e t 2 ; / * F I L E P O S I T I O N M A R K E R S * / / * S T O R E T H E F I R S T C L O C K * / g e t v a l ( b u f , & c l k [ l ] [ 0 ] ) ; / * S A V E T H E F I L E P O S I T I O N A N D R E W I N D T H E F I L E * / o f f s e t = f t e l l ( f d f r o m ) ; rewind(fdfrom) ; / * S E A R C H F O R T H E R E S T O F T H E E L E M E N T S * / r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) / * F I N D T H E C A P A C I T O R F I R S T * / { i f ( b u f [ 0 ] = = « C ' ) ( g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * D O E S I T C O N N E C T T O T H E S W I T C H N O D E ? * / i f ( s a m e ( c o n 2 , s t l ) | | s a m e ( c o n 2 , s t 2 ) ) / * S A V E T H E C A P A C I T O R V A L U E A N D S A V E * / / * T H E O T H E R N O D E O F T H E C A P A C I T O R * / ( g e t v a l ( b u f , & c l k [ 0 ] [ 0 ] ) ; i f ( s a m e ( c o n 2 , s t l ) ) g e t n o d e ( b u f , T W O , c o n 3 ) ; e l s e g e t n o d e ( b u f , O N E , c o n 3 ) ; / * S A V E T H E F I L E P O S I T I O N * / o f f s e t 2 = f t e l l ( f d f r o m ) ; r e w i n d ( f d f r o m ) ; / * NOW S E A R C H F O R T H E O T H E R T H R E E S W I T C H E S * / r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] != E O F ) / * L O O K F O R A S W I T C H E L E M E N T * / ( i f ( b u f [ 0 ] == ' S ' ) ( g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * C O N N E C T S I N P U T S W I T C H T O G R O U N D ? * i f ( s a m e ( c o n 2 , s t l ) && s t 2 [ 0 ] = = ' 0 ' | | s a m e ( c o n 2 , s t 2 ) && s t l [ 0 ] = = ' 0 ' ) g e t v a l ( b u f , & c l k [ 2 ] [ 0 ] ) ; / * C O N N E C T S O U T P U T S W I T C H T O G R O U N D ? e l s e i f ( s a m e ( c o n 3 , s t l ) && s t 2 [ 0 ] = = ' 0 1 5 1 s a m e ( c o n 3 , s t 2 ) && s t l [ 0 ] = = ' 0 ' ) g e t v a l ( b u f , & c l k [ 4 ] [ 0 ] ) ; / * I S I T T H E O U T P U T S W I T C H ? * / e l s e i f ( s a m e ( c o n 3 , s t l ) | | s a m e ( c o n 3 , s t 2 ) ) { g e t v a l ( b u f , & c l k [ 3 ] [ 0 ] ) ; i f ( s a m e ( c o n 3 , s t l ) ) g e t n o d e ( b u f , T W O , c o n 4 ) ; e l s e g e t n o d e ( b u f , O N E , c o n 4 ) ; } } r e a d l i n e ( f d f r o m , b u f ) ; } / * W R I T E G A T H E R E D I N F O R M A T I O N T O O U T P U T F I L E * / s c o u t ( c o n l , c o n 4 , e l k , f d t o ) ; / * R E S T O R E F I L E P O S I T I O N * / f s e e k ( f d f r o m , o f f s e t 2 , Z E R O ) ; } } r e a d l i n e ( f d f r o m , b u f ) ; } / * R E S T O R E F I L E P O S I T I O N * / f s e e k ( f d f r o m , o f f s e t , Z E R O ) ; } /******************************************* /* */ / * I N P U T 1 F U N C T I O N — P r o c e s s I n p u t S t a g e ( L E E ) * / /* */ / * T h e i n p u t 1 f u n c t i o n p r o c e s s e s t h e i n p u t s t a g e o f * / / * M a n S h e k L e e , c o n s i s t i n g o f t w o s w i t c h e s a n d t w o c a p s . * / / * T h e s w i t c h e s a r e l i s t e d f i r s t , f o l l o w e d b y t h e i n p u t * / / * c a p a c i t o r a n d t h e n t h e s w i t c h e d c a p a c i t o r . * / /* */ /******************************^ i n p u t 1 ( f d c t ) F I L E * f d c t ; / * . C T O U T P U T F I L E * / ( c h a r b u f [ 3 ] [ L E N G T H ] ; / * C A P L I N E B U F F E R S * / Char S t l [ W O R D ] , s t 2 [ W O R D ] ; / * N O D E S T O R A G E S T R I N G S * / Char S t 3 [ W O R D ] , s t 4 [ W O R D ] ; / * N O D E S T O R A G E S T R I N G S * / i n t i = 0 ; / * I N D E X V A R I A B L E * / F I L E * f d f r o m ; / * I N P U T F I L E * / F I L E * f o p e n ( ) ; / * F I L E O P E N F U N C T I O N * / / * O P E N T H E I N P U T S E C T I O N F I L E * / f d f r o m = f o p e n ( " S U B C " , " r " ) ; / * W R I T E T H E TWO S W I T C H E L E M E N T S T O T H E . C T F I L E * / 1 5 2 / * S T O R E T H E TWO C A P A C I T O R E L E M E N T S F O R NOW * / r e a d l i n e ( f d f r o m , & b u f [ i + + ] [ 0 ] ) ; w h i l e ( b u f [ i - 1 ] [ 0 ] J = E O F ) { i f ( b u f [ i - 1 ] [ 0 ] = = , S I ) { w r o u t ( f d c t , & b u f [ i - 1 ] [ 0 ] , b s ) ; i — ; } r e a d l i n e ( f d f r o m , & b u f [ i + + ] [ 0 ] ) ; } f c l o s e ( f d f r o m ) ; / * S T O R E T H E N O D E S O F T H E TWO C A P A C I T O R E L E M E N T S * / g e t n o d e ( & b u f [ 0 ] [ 0 ] , O N E , s t l ) ; g e t n o d e ( & b u f [ 0 ] [ 0 ] , T W O , s t 2 ) ; g e t n o d e ( & b u f [ 1 ] [ 0 ] , O N E , s t 3 ) ; g e t n o d e ( S b u f [ 1 ] [ 0 ] , T W O , s t 4 ) ; / * W R I T E T H E C A P A C I T O R C O N N E C T E D T O T H E I N P U T N O D E * / / * F I R S T , W I T H T H E I N P U T N O D E L I S T E D F I R S T . T H E * / / * F I L T E R L I N K N O D E I S T H E O T H E R N O D E . * / i f ( s t l [ 0 ] = = ' 0 ' | | s t 2 [ 0 ] = = l 0 ' ) { n o d e s o r t ( & b u f [ 1 ] [ 0 ] , f i r s t n o d e ) ; w r o u t ( f d c t , & b u f [ 1 ] [ 0 ] , b c ) ; g e t n o d e ( & b u f [ 1 ] [ 0 ] , T W O , m i d n o d e ) ; / * U P D A T E T H E N O D A L T A B L E * / i f ( S t l [ 0 ] = = ' 0 ' ) c o p y ( s t 2 , S t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; e l s e c o p y ( s t l , & t a b l e [ l ] [ 3 ] [ 0 ] ) ; w r o u t ( f d c t , & b u f [ 0 ] [ 0 ] , b c ) ; } e l s e { n o d e s o r t ( & b u f [ 0 ] [ 0 ] , f i r s t n o d e ) ; w r o u t ( f d c t , & b u f [ 0 ] [ 0 ] , b c ) ; g e t n o d e ( & b u f [ 0 ] [ 0 ] , T W O , m i d n o d e ) ; / * U P D A T E T H E N O D A L T A B L E * / i f ( s t 3 [ 0 ] = = ' 0 ' ) c o p y ( s t 4 , S t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; e l s e c o p y ( s t 3 , S t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; w r o u t ( f d c t , & b u f [ 1 ] [ 0 ] , b c ) ; } / * P U T A G A P I N T H E N O D E T A B L E * / t a b l e [ 1 ] [ 4 ] [ 0 ] = E O L ; / * P U T A G A P I N T H E . C T F I L E * / p u t c ( E O L , f d c t ) ; } /************************************************* / * * / / * I N P U T 2 F U N C T I O N — P r o c e s s I n p u t S t a g e ( M A R T I N ) * / 153 /* */ / * T h e i n p u t 2 f u n c t i o n p r o c e s s e s t h e i n p u t s t a g e o f * / / * K e n M a r t i n , c o n s i s t i n g o f o n e S I S C . T h e r e g u l a r * / / * s o f t w a r e c a n p r o c e s s t h i s e l e m e n t , h e n c e t h e . i n f i l e * / / * i s empty f o r t h i s i n p u t s t a g e . T h e f i l t e r l i n k n o d e i s * / / * t h e o t h e r n o d e o f t h i s S I SC e l e m e n t . * / /* */ /******************************************** i n p u t 2 ( f d c t ) F I L E * f d c t ; { c h a r b u f [ L E N G T H ] ; c h a r s t l [ W O R D ] , s t 2 [ W O R D ] ; F I L E * f d f r o m ; F I L E * f o p e n ( ) ; i n t f l a g = 1 ; / * .CT OUTPUT F I L E * / / * L INE BUFFER * / / * NODE STORAGE STRINGS * / / * INPUT F I L E * / / * F I L E OPEN FUNCTION * / / * SEARCH FLAG * / / * SEARCH THE F I L T E R F I L E FOR A S I SC ELEMENT * / / * CONNECTED TO THE F I L T E R INPUT NODE. * / f d f r o m = f o p e n ( " S C I N Q " , " r " ) ; r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] l = E O F && f l a g ) { i f ( b u f [ 0 ] = = ' S ' ) { g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * SAVE THE F I L T E R L INK NODE * / i f ( s a m e ( f i r s t n o d e , s t l ) || s a m e ( f i r s t n o d e , s t 2 ) ) { f l a g = 0 ; i f ( s a m e ( f i r s t n o d e , s t 2 ) ) c o p y ( s t l , m i d n o d e ) ; e l s e c o p y ( s t 2 , m i d n o d e ) ; } } r e a d l i n e ( f d f r o m , b u f ) ; } / * UPDATE THE NODE TABLE * / c o p y ( f i r s t n o d e , S t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; t a b l e [ l ] [4] [0] = EOL ; /********************************************* /* */ / * INPUT3 FUNCTION — P r o c e s s I n p u t S t a g e (SEDRA) * / /* */ / * T h e i n p u t 3 f u n c t i o n p r o c e s s e s t h e i n p u t s t a g e b y * / / * A d e l S e d r a , c o n s i s t i n g o f o n e o p - a m p , o n e s w i t c h , o n e * / / * c a p a c i t o r , a n d two S I S C ' s . T h e op -amp i s w r i t t e n f i r s t * / / * f o l l o w e d b y t h e c a p a c i t o r - s w i t c h p a i r a n d t h e n t h e two * / 1 5 4 / * S I S C ' s . T h e S I S C ' s a r e s o r t e d t o s i m p l i f y t h e w i r i n g * / / * i n t h e l a y o u t p r o g r a m . * / /* */ /******************************************** i n p u t 3 ( f d c t ) F I L E *fdct ; ( char b u f [ L E N G T H ] , 1 i n [ L E N G T H ] char s t l [ W O R D ] , s t 2 [ W O R D ] ; char s t 3 [ W O R D ] , s t 4 [ W O R D ] ; int f l a g , f l a g 2 ; F I L E *fdfrom ; F I L E *fdto ; F I L E *fopen() ; fdfrom = fopen ( " S U B C ' \ "r") ; fdto = fopenC ' S C I N S " , "w" ) ; / * . C T O U T P U T F I L E * / / * L I N E B U F F E R S * / / * N O D E S T O R A G E S T R I N G S * / / * N O D E S T O R A G E S T R I N G S * / / * C L O C K P H A S E F L A G S * / / * I N P U T F I L E * / / * O U T P U T F I L E * / / * F I L E O P E N F U N C T I O N * / / * O P E N I N P U T S T A G E F I L E * / / * O P E N S T O R A G E F I L E * / / * G R O U P T H E I N P U T S T A G E F R O M T H E O P - A M P * / r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) / * F I N D T H E O P - A M P * / { i f ( b u f [ 0 ] = = , E I ) ( g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T H R E E , s t 3 ) ; / * U P D A T E T H E N O D E T A B L E * / c o p y ( s t 3 , & t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; c o p y ( s t l , S t a b l e [ 1 ] [ 4 ] [ 0 ] ) ; / * W R I T E T H E O P - A M P T O T H E . C T F I L E * / w r o u t ( f d c t , b u f , o a ) ; / * S E A R C H F O R T H E R E M A I N I N G E L E M E N T S * / r e w i n d ( f d f r o m ) ; r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) / * T H E R E A R E T H R E E C A P A C I T O R S * / ( i f ( b u f [ 0 ] = = , C « ) ( g e t n o d e ( b u f , O N E , s t 2 ) ; g e t n o d e ( b u f , T W O , s t 4 ) ; / * I F I T C O N N E C T S T O T H E N O N - I N V E R T I N G * / / * O P - A M P I N P U T , W R I T E T O . C T F I L E * / i f ( s a m e ( s t 3 , s t 2 ) | | s a m e ( s t 3 , s t 4 ) ) w r o u t ( f d c t , b u f , b e ) ; ) 1 5 5 / * T H E R E A R E F I V E S W I T C H E S * / else i f ( b u f [ 0 ] = = ' S ' ) { getnode(buf ,ONE,s t2 ) ; getnode(buf ,TWO,st4 ) ; / * I F I T C O N N E C T S T O T H E N O N - I N V E R T I N G * / / * O P - A M P I N P U T , W R I T E T O . C T F I L E * / i f (same ( s t 3 , s t 2 ) | | same( s t 3 , s t 4 ) ) wrout(fdct,buf,bs) ; / * E L S E G A T H E R U P T H E R E S T O F T H E S I S C * / else { i f (same(stl , s t 2 ) ) sisc(fdfrom,fdto,buf , s t 4 , s t 2 ) ; i f (same(stl , s t 4 ) ) sisc(fdfrom,fdto,buf , s t 2 , s t 4 ) ; } } readline(fdfrom,buf) ; } } readline(fdfrom,buf) ; } / * S P A C E T H E N O D E T A B L E * / t a b l e [ l ] [ 5 ] [ 0 ] = E O L ; / * C L O S E I N P U T A N D O U T P U T F I L E S * / fclose(fdfrom) ; fclose(fdto) ; / * T H E F I L T E R L I N K N O D E I S T H E S E C O N D * / / * N O D E O F E I T H E R S I S C E L E M E N T * / fdfrom = fopenC 'SCINS'V'r") ; readline(fdfrom,buf) ; getnode(buf,TWO,midnode) ; fclose(fdfrom) ; / * I T I S NOW N E C E S S A R Y T O S O R T T H E TWO S I S C E L E M E N T S * / / * T H E O N E T H A T I S S W I T C H E D S I M I L A R T O T H E F I R S T * / / * I N T E G R A T O R S T A G E M U S T GO L A S T , W I T H R E V E R S E N O D E S * / / * F I N D T H E F I R S T I N T E G R A T O R S T A G E * / fdfrom = fopen ( H S C I N Q M ,"r") ; readline(fdfrom,buf) ; while (buf [ 0 ] ! = E O F ) { i f (buf [ 0 ] = = ' O ' ) { getnode(buf,FOUR,stl) ; / * I S I T T H E F I R S T O P - A M P ? * / i f (same(midnode,stl)) / * F I N D T H E P H A S E O F T H I S S T A G E * / ( do ( readline(fdfrom,buf) ; 156 } i f ( b u f [ 0 ] = = ' S ' ) flag = clockphase(buf, O N E ) ; } while ( b u f [ 0 ] ! = E O L && b u f [ 0 ] ! = E O F ) ; } } readline(fdfrom,buf) ; } fclose(fdfrom) ; / * G E T T H E TWO S I S C E L E M E N T S A N D C H E C K T H E C L O C K P H A S E * / fdfrom = fopenC 'SCINS'V'r") ; readline(fdfrom,buf) ; readline(fdfrom,lin) ; f l a g 2 = clockphase(lin,ONE) ; / * W R I T E T H E S I S C E L E M E N T S T O T H E . C T F I L E * / i f ( f l a g = = f l a g 2 ) { writeline(fdct,buf) ; getnode(lin,T W O , s t 2 ) ; nodesort(lin,s t 2 ) ; writeline(fdct,lin) ; } else { writeline(fdct,lin) ; getnode(buf ,TWO,st2 ) ; nodesort(buf ,s t2 ) ; writeline(fdct,buf) ; ) / * P U T A G A P I N T H E . C T F I L E * / putc(E O L ,fdct) ; / * C L O S E T H E I N P U T F I L E * / fclose(fdfrom) ; /********************************************** / * * / / * I N P U T 4 F U N C T I O N — P r o c e s s I n p u t S t a g e ( A R O M A ) * / /* */ /***************************************************** i n p u t 4 ( f d c t ) F I L E * f d c t ; / * . C T O U T P U T F I L E * / { Char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / c h a r s t l [ W O R D ] , s t 2 [ W O R D ] ; / * N O D E S T O R A G E S T R I N G S * / F I L E * f d f r o m ; / * I N P U T F I L E * / F I L E * f o p e n ( ) ; / * F I L E O P E N F U N C T I O N * / c h a r m i d [ 3 ] [ W O R D ] ; / * N O D E S T O R A G E * / i n t c o u n t = 0 ; / * C O U N T E R * / m i d [ 0 ] [ 0 ] = m i d [ l ] [ 0 ] = m i d [ 2 ] [ 0 ] = EOW ; 1 5 7 } / * S E A R C H T H E F I L T E R F I L E F O R A S I S C E L E M E N T * / / * C O N N E C T E D T O T H E F I L T E R I N P U T N O D E . * / f d f r o m = f o p e n ( , , S C I N Q , \ , , r l , ) ; r e a d l i n e ( f d f r o m , b u f ) ; w h i l e ( b u f [ 0 ] ! = E O F ) { i f ( b u f [ 0 ] = = ' S ' ) { g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * S A V E T H E F I L T E R L I N K N O D E * / i f ( s a m e ( f i r s t n o d e , s t l ) | | s a m e ( f i r s t n o d e , s t 2 ) ) { i f ( s a m e ( f i r s t n o d e , s t 2 ) ) c o p y ( s t l , & m i d [ c o u n t + + ] [ 0 ] ) ; e l s e c o p y ( s t 2 , & m i d [ c o u n t + + ] [ 0 ] ) ; } } r e a d l i n e ( f d f r o m , b u f ) ; } i f ( m i d [ l ] [ 0 ] = = E O W ) c o p y ( & m i d [ 0 ] [ 0 ] , m i d n o d e ) ; e l s e { i f ( s a m e ( & m i d [ 0 ] [ 0 ] , & m i d [ l ] [ 0 ] ) ) c o p y ( & m i d [ 2 ] [ 0 ] , m i d n o d e ) ; i f ( s a m e ( & m i d [ 0 ] [ 0 ] , & m i d [ 2 ] [ 0 ] ) ) c o p y ( & m i d [ 1 ] [ 0 ] , m i d n o d e ) ; i f ( s a m e ( & m i d [ l ] [ 0 ] , & m i d [ 2 ] [ 0 ] ) ) c o p y ( & m i d [ 0 ] [ 0 ] , m i d n o d e ) ; } / * U P D A T E T H E N O D E T A B L E * / c o p y ( f i r s t n o d e , S t a b l e [ 1 ] [ 3 ] [ 0 ] ) ; t a b l e [ l ] [ 4 ] [ 0 ] = E O L ; /******************************************* /* */ / * O R D E R 1 F U N C T I O N — S o r t S t a g e s * / /* */ / * T h e o r d e r 1 f u n c t i o n s o r t s t h e i n t e g r a t o r s t a g e s o f * / / * t h e f i l t e r . T h e s o r t s t a r t s w i t h t h e o p - a m p c o n n e c t e d * / / * t o t h e i n p u t s t a g e , a n d t h e n f o l l o w s t h e S I S C p a t h s * / / * f r o m t h e o p - a m p o u t p u t o f t h e s t a g e . O n c e a s t a g e h a s * / / * b e e n s o r t e d , i t i s i g n o r e d b y t h e s o r t i n g a l g o r i t h m . * / /* */ /****************************^ o r d e r 1 ( f d n d ) F I L E * f d n d ; / * . N D O U T P U T F I L E * / { c h a r o l d l [ W O R D ] , o l d 2 [ W O R D ] , o l d 3 [ W O R D ] ; / * B A S E P A T H N O D E S * / 1 5 8 c h a r n e w l [ W O R D ] , n e w 2 [ W O R D ] , n e w 3 [ W O R D ] ; / * F O R W A R D P A T H N O D E S c h a r n e w 4 [ W O R D ] , n e w 5 [ W O R D ] , n e w 6 [ W O R D ] c h a r b u f [ L E N G T H ] ; l o n g o f s i , o f s 2 , o f s 3 i n t i = 0 ; F I L E * f d t o ; F I L E * f d f r o m ; F I L E * f o p e n ( ) ; / * F O R W A R D P A T H N O D E S / * L I N E B U F F E R * / / * F I L E M A R K E R S * / / * I N D E X V A R I A B L E * / / * O U T P U T F I L E * / / * I N P U T F I L E * / / * F I L E O P E N F U N C T I O N fdfrom = fopenC 'SCINQ'V'r") ; / * O P E N I N P U T F I L E * / fdto = fopen("SCINP","w") ; / * O P E N O U T P U T F I L E * / / * F I N D T H E O P - A M P C O N N E C T E D T O T H E L I N K N O D E * / readline(fdfrom,buf) ; while (buf [ 0 ] ! = E O F ) ( i f (buf [ 0 ] = = ' O ' ) { getnode(buf,ONE,newl) ; getnode(buf,FOUR,new4) ; / * T H E O U T P U T N O D E I S T H E S T A R T O F T H E S O R T * / i f (same(midnode,new4)) copy(newl,oldl) ; } r e a d l i n e ( f d f r o m , b u f ) ; } r e w i n d ( f d f r o m ) ; / * S T A R T T H E S O R T F R O M T H E F I R S T O U T P U T N O D E * / d o ( o f s l = n e w b l o c k ( o l d l , n e w l , n e w 2 , f d f r o m ) ; / * W R I T E T H E I N T E G R A T O R S T A G E T O T H E O U T P U T F I L E * / d u m p ( f d f r o m , o f s l , f d t o ) ; / * I F A S I N G L E F E E D , U P D A T E T H E S E A R C H P A T H * / i f ( n e w 2 [ 0 ] = = E O W ) c o p y ( n e w l , o l d l ) ; / * I F A D O U B L E F E E D , C H E C K B O T H NEW P A T H S * / e l s e ( w h i l e ( n e w 2 [ 0 ] ! = E O W ) ( c o p y ( n e w l , o l d 2 ) ; c o p y ( n e w 2 , o l d 3 ) ; / * T R A C E T H E NEW P A T H S * / o f s 2 = n e w b l o c k ( o l d 2 , n e w 3 , n e w 4 , f d f r o m ) ; o f s 3 = n e w b l o c k ( o l d 3 , n e w 5 , n e w 6 , f d f r o m ) ; / * DUMP T H E I N T E G R A T O R W I T H NO NEW F E E D S F I R S T * / / * F O L L O W E D B Y T H E O T H E R I N T E G R A T O R , T H E N * / / * U P D A T E T H E S E A R C H P A T H * / i f ( n e w 3 [ 0 ] = = E O W && n e w 4 [ 0 ] = = E O W ) { d u m p ( f d f r o m , o f s 2 , f d t o ) ; 1 5 9 d u m p ( f d f r o m , o f s 3 , f d t o ) c o p y ( n e w 5 , o l d l ) ; c o p y ( n e w 5 , n e w l ) ; c o p y ( n e w 6 , n e w 2 ) ; e l s e i f ( n e w 5 [ 0 ] = = E O W && n e w 6 [ 0 ] = = E O W ) { d u m p ( f d f r o m , o f s 3 , f d t o ) ; d u m p ( f d f r o m , o f s 2 , f d t o ) ; c o p y ( n e w 3 , o l d l ) ; c o p y ( n e w 3 , n e w l ) ; c o p y ( n e w 4 , n e w 2 ) ; } } } } / * C O N T I N U E U N T I L NO NEW P A T H S E X I S T * / w h i l e ( n e w l [ 0 ] ! = E O W | | n e w 2 [ 0 ] ! = E O W ) ; / * W R I T E T H E N O D E T A B L E T O T H E . N D F I L E * / w h i l e ( t a b l e [ l ] [ i ] [ 0 ] ! = E 0 W ) ( w r i t e l i n e ( f d n d , S t a b l e [ 1 ] [ i ] [ 0 ] ) ; i f ( t a b l e [ 1 ] [ i + + ] [ 0 ] ! = E 0 L ) p u t c ( E 0 L , f d n d ) ; } / * C L O S E T H E I N P U T A N D O U T P U T F I L E S * / f c l o s e ( f d f r o m ) ; f c l o s e ( f d t o ) ; } /********************************^ / * * / / * N E W B L O C K F U N C T I O N — F i n d N e x t S t a g e s * / /* */ / * T h e n e w b l o c k f u n c t i o n f i n d s t h e p a t h s b y w h i c h t h e * / / * g i v e n n o d e f e e d s n e w i n t e g r a t o r s t a g e s . I t r e t u r n s t h e * / / * i n p u t n o d e s o f t h e f o u n d s t a g e s . T h e s e a r c h i n g i s o n l y * / / * a l o n g S I S C e l e m e n t s . * / ( C h a r stl [ W O R D ],st2 [ W O R D ] ; / * N O D E S T O R E S T R I N G S * / C h a r S t 3 [ W O R D ] , s t 4 [ W O R D ] ; / * N O D E S T O R E S T R I N G S * / n e w b l o c k ( o l d , n e w l , n e w 2 , f d f r o m ) c h a r o l d [ W O R D ] c h a r n e w l [ W O R D ] c h a r n e w 2 [ W O R D ] F I L E * f d f r o m ; / * S T A R T O F S E A R C H P A T H * / / * E N D 1 O F S E A R C H P A T H * / / * E N D 2 O F S E A R C H P A T H * / / * I N P U T F I L E * / c h a r b u f [ L E N G T H ] i n t f l a g = 0 ; i n t f l a g 2 = 0 ; l o n g o f f s l , o f f s 2 / * L I N E B U F F E R * / / * F L A G F O R S T A R T I N G S T A G E * / / * F L A G F O R S E C O N D P A T H * / / * F I L E M A R K E R S * / 160 / * I N I T I A L I Z E THE FORWARD PATH NODES * / n e w l [ 0 ] = EOW ; new2[0 ] = EOW ; / * HAVE TO F IND THE STARTING STAGE LOCATION IN * / / * ADDIT ION TO THE TWO POSS IBLE FORWARD PATHS * / r e w i n d ( f d f r o m ) ; do { o f f s l = f t e l l ( f d f r o m ) ; / * AN OP-AMP IS ALWAYS F I R S T * / r e a d l i n e ( f d f r o m , b u f ) ; g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , F O U R , s t 4 ) ; / * CHECK FOR STARTING STAGE * / i f ( s a m e ( o l d , s t l ) && ! f l a g ) / * SAVE THE F I L E O F F S E T * / { o f f s 2 = o f f s l ; f l a g = 1 ; w h i l e ( b u f [ 0 ] ! = E O L && b u f [ 0 ] ! = E O F ) r e a d l i n e ( f d f r o m , b u f ) ; } / * E L S E SEE I F STAGE IS FED BY THE STARTING NODE * / e l s e do { r e a d l i n e ( f d f r o m , b u f ) ; / * ONLY S I S C ELEMENTS COUNT * / i f ( b u f [ 0 ] = = « S ' ) { g e t n o d e ( b u f , O N E , s t 2 ) ; g e t n o d e ( b u f , T W O , s t 3 ) ; / * SAVE I T I F I T SHARES THE STARTING NODE * / i f ( s a m e ( s t 2 , o l d ) && ! i n ( s t 3 , l ) || s a m e ( s t 3 , o l d ) && ! i n ( s t 2 , l ) ) { i f ( ! i n ( s t l , 0 ) ) { i n s e r t ( s t l , 0 ) ; i f ( ! f l a g 2 ) c o p y ( s t l , n e w l ) ; e l s e c o p y ( s t l , n e w 2 ) ; f l a g 2 - 1 ; } } } ) w h i l e ( b u f [ 0 ] ! = E O L && b u f [ 0 ] ! = E O F ) ; } w h i l e ( b u f [ 0 ] ! = E O F ) ; r e t u r n ( o f f s 2 ) ; > /******************************************** / * * / / * ORDER2 FUNCTION — S o r t E l e m e n t s a n d N o d e s * / 161 /* */ / * T h e o r d e r 2 f u n c t i o n s o r t s t h e e l e m e n t s a n d n o d e s o f * / / * t h e i n t e g r a t o r s t a g e s . T h e e l e m e n t s a r e p u t i n t h e * / / * o r d e r a s t h e n o d e s i n T A B L E a r e . I n t e g r a t i n g c a p s * / / * a r e w r i t t e n b e f o r e i n t e g r a t i n g S C ' s . T h e op -amp i n p u t * / / * n o d e i s p u t f i r s t f o r I C a n d SC e l e m e n t s . T h e CC n o d e s * / / * a r e s o r t e d i n t h e same o r d e r a s T A B L E . * / /* */ /******************************************** o r d e r 2 ( f d c t ) F I L E * f d c t ; / * . CT OUTPUT F I L E * / { c h a r b u f [ 1 0 ] [ L E N G T H ] ; c h a r l i n e [ L E N G T H ] ; c h a r op l [WORD],op4[WORD] ; c h a r s t l [ W O R D ] , s t 2 [ W O R D ] ; i n t f l a g ; i n t c o u n t ; i n t j , k , r ; F I L E * f d f r o m ; F I L E * f o p e n ( ) ; f d f r o m = f o p e n ( " S C I N P " , " r " ) ; / * L INE BUFFERS FOR STAGE * / / * L INE BUFFER * / / * NODE STORAGE STRINGS * / / * NODE STORAGE STRINGS * / / * NODE B E F O R E / A F T E R FLAG * / / * COUNTER OF ELEMENTS * / / * INDEX VAR IABLES * / / * INPUT F I L E * / / * F I L E OPEN FUNCTION * / / * OPEN INPUT F I L E * / / * SORT THE BLOCKS ONE AT A T IME * / r e a d l i n e ( f d f r o m , l i n e ) ; w h i l e ( l i n e [ 0 ] J = E O F ) / * SAVE THE OP-AMP NODES * / ( g e t n o d e ( l i n e , F O U R , o p 4 ) ; g e t n o d e ( l i n e , O N E , o p l ) ; w r i t e l i n e ( f d c t , l i n e ) ; / * STORE THE REST OF THE INTEGRATOR BLOCK * / c o u n t = 0 ; do { r e a d l i n e ( f d f r o m , & b u f [ c o u n t ] [ 0 ] ) ; } w h i l e ( b u f [ c o u n t + + ] [ 0 ] ! = E O L ) ; / * WRITE THE ELEMENTS AS THE NODE * / / * SEARCH COMES TO THE IR NODES * / f l a g = 0 ; f o r (k=2; t a b l e [ l ] [ k ] [ 0 ] ! = E O W ; k++) f o r ( j = 0 ; j < c o u n t - l ; j++) { g e t n o d e ( & b u f [ j ] [ 0 ] , O N E , s t l ) ; g e t n o d e ( & b u f [ j ] [ 0 ] , T W O , s t 2 ) ; / * WRITE IC BEFORE INTEGRATING SC * / i f ( s a m e ( o p 4 , S t a b l e [ 1 ] [ k ] [ 0 ] ) ) 162 { i f (buf[j][0] — ' I ' ) i f (same(stl,opl) && same(st2,op4) || same(stl,op4) && same(st2,opl)) /* SET FLAG AND SORT THE NODES */ { f l a g = 1 ; nodesort(Sbuf[j][0],op4) ; writeline(fdct,&buf[j][0]) ; } } /* WRITE INTEGRATING SC */ else i f (same(opl,Stable[1][k][0])) { i f (buf[j][0]=='S«) i f (same(stl,opl) SS same(st2,op4) || same(stl,op4) && same(st2,opl)) /* SORT THE NODES */ ( nodesort(&buf[j][0],op4) ; writeline(fdct,&buf[j][0]) ; ) } /* WRITE REMAINING ELEMENTS, CHECK FIRST NODE else i f (same(stl,Stable[1][k][0])) /* CCS NODES ARE IN SAME ORDER AS TABLE */ ( i f (buf[j][0]=='C) ( i f (flag) nodesort(Sbuf[j][0],st2) ; ) /* MUST BE SC */ else nodesort(Sbuf[j][0],op4) ; write l i n e ( f d c t , S b u f [ j ] [ 0 ] ) ; } /* CHECK THE OTHER NODE */ else i f (same(st2,Stable[1][k][0])) /* CCS NODES ARE IN SAME ORDER AS TABLE */ { i f (buf[jj [0]=='C) { i f (Iflag) nodesort(Sbuf[j][0],st2) ; } /* MUST BE SC */ else nodesort(Sbuf[j][0],op4) ; writel i n e ( f d c t , S b u f [ j ] [ 0 ] ) ; } } /* INSERT GAP IN .CT FILE */ putc(EOL,fdct) ; readline(fdfrom,line) ; } fclose(fdfrom) ; /* CLOSE INPUT FILE */ 163 /**************************************************** /* */ /* CLOCKPHASE FUNCTION — Check Phase of a C l o c k */ /* */ /* The clockphase f u n c t i o n checks the phase o f the */ /* s p e c i f i e d . T h i s f u n c t i o n i s o n l y v a l i d f o r SC elements */ /* and the c l o c k s must be of the C and #C v a r i e t y . */ /* */ /***********************************************************/ clockphase(buf,spot) Char buf[LENGTH] ; /* SC ELEMENT LINE BUFFER */ i n t spot ; /* CLOCK POSITION 1 - 4 */ { i n t j , i ; /* INDEX VARIABLES */ /* ADVANCE TO THE BEGINNING OF THE CAP VALUE */ j = 0 ; while (buf[j++]!=')•) ; while (buf[j]==' ') j++ ; /* ADVANCE TO THE DESIRED CLOCK */ for (i=0; i<=spot; i++) { while (buf[j]!=' ') j++ ; while (buf[j]==' •) j++ ; } /* RETURN 0 IF #C IS FOUND */ return(((buf[j]=='#') ? 0 : 1)) ; > /***********************************************************/ / * V /* COPY FUNCTION — S t r i n g Copy F u n c t i o n */ /* */ /* The copy f u n c t i o n c o p i e s s t r i n g l t o s t r i n g 2 . The */ /* f i r s t s t r i n g must be ter m i n a t e d by an EOW. */ /* */ /*************************************************** copy(str1,str2) char * s t r l ; /* INPUT STRING */ char *Str2 ; /* OUTPUT STRING */ { i n t i = 0 ; /* INDEX VARIABLE */ /* COPY STRING1 TO STRING 2 */ do { *(str2+i) = * ( s t r l + i ) ; } w h i l e (*(strl+i++) != EOW) ; 164 } /***********************************************************/ / * * / / * DUMP F U N C T I O N — W r i t e I n t e g e r a t o r S t a g e t o F i l e * / /* */ / * T h e d u m p f u n c t i o n w r i t e s t h e i n t e g r a t o r s t a g e f o u n d * / / * a t t h e f i l e l o c a t i o n s p e c i f i e d b y t h e o f f s e t . I f a l s o * / / * u p d a t e s t h e n o d e t a b l e . * / /* */ /******************************^ d u m p ( f d f r o m , o f f s e t , f d t o ) F I L E * f d f r o m ; / * I N P U T F I L E * / F I L E * f d t o ; / * O U T P U T F I L E * / l o n g o f f s e t ; / * I N P U T F I L E O F F S E T * / { c h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / C h a r s t [ W O R D ] ; / * N O D E S T O R A G E S T R I N G * / / * I N D E X I N T O T H E I N P U T F I L E * / f s e e k ( f d f r o m , o f f s e t , Z E R O ) ; / * C O P Y I N T E G R A T O R S T A G E T O O U T P U T F I L E * / d o ( r e a d l i n e ( f d f r o m , b u f ) ; i f ( b u f [ 0 ] = = ' O ' ) / * I N S E R T O P - A M P I N P U T N O D E * / ( g e t n o d e ( b u f , F O U R , s t ) ; i n s e r t ( s t , l ) ; / * I N S E R T O P - A M P O U T P U T N O D E * / g e t n o d e ( b u f , O N E , s t ) ; i n s e r t ( s t , l ) ; } > w r i t e l i n e ( f d t o , b u f ) ; } w h i l e ( b u f [ 0 ] ! = E O L && b u f [ 0 ] ! = E O F ) ; /************************************************ /* */ / * E M P T Y F U N C T I O N — C l e a r s a C o l u m n o f T A B L E * / /* */ / * T h e e m p t y f u n c t i o n i n i t i a l i z e s o n e c o l u m n o f T A B L E * / / * t o E O W . * / /* */ /******************************************************* e m p t y ( c o l ) 1 6 5 i n t C O l ; / * C O L U M N O F T A B L E * / { i n t b ; / * I N D E X V A R I A B L E * / / * I N I T I A L I Z E T A B L E C O L U M N * / f o r ( b = 0 ; b < S I Z E ; b++) t a b l e [ c o l ] [ b ] [ 0 ] = EOW ; } /***********************************************************/ / * * / / * F I L L F U N C T I O N — I n s e r t New N o d e s * / /* */ / * T h e f i l l f u n c t i o n f i l l s u p T A B L E f o r s u b c i r c u i t * / / * s u b s t i t u t i o n s . T h e i n s e r t e d n o d e s a r e o f t h e f o r m ! A D * / / * w h i c h a r e n o t a l l o w e d i n S W I T C A P . * / /* */ f i l l ( ) { i n t y = ( - 1 ) ; /* INDEX VARIABLE */ / * S C A N C O L U M N Z E R O A N D S E E WHAT C O L U M N O N E H A S * / w h i l e ( t a b l e [ 0 ] [ + + y ] [ 0 ] ! = E O W ) / * T H E G R O U N D N O D E I S A L W A Y S ' O ' * / { i f ( t a b l e [ 0 ] [ y ] [ 0 ] = = ' 0 ' ) c o p y ( S t a b l e [ 0 ] [ y ] [ 0 ] , & t a b l e [ l ] [ y ] [ 0 ] ) ; / * E L S E I N S E R T T H E N O D E A N D U P D A T E T H E N O D E * / e l s e i f ( t a b l e [ 1 ] [ y ] [ 0 ] = = E O W ) { c o p y ( n o d e , & t a b l e [ l ] [ y ] [ 0 ] ) ; n o d e [ 2 ] += 1 ; / * C H E C K F O R O V E R F L O W * / i f ( n o d e [ 2 ] > ' Z 1 ) { n o d e [ 2 ] = ' A ' ; n o d e [ l ] += 1 ; } } } } /**************************************** / * * / / * G E T N O D E F U N C T I O N — G e t O n e N o d e o f a L i n e * / / * * / / * T h e g e t n o d e f u n c t i o n r e t u r n s t h e r e q u e s t e d n o d e * / / * f r o m t h e p r o v i d e d l i n e . * / / * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 166 getnode(buf,pos,vertx) char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / char vertx [ W O R D ] ; / * N O D E B U F F E R * / i n t pos ; / * N O D E P O S I T I O N * / { i n t q,i,k ; / * I N D E X V A R I A B L E S * / q = i = 0 ; while (buf[i++]!='(') / * S T O R E T H E R E Q U E S T E D N O D E * / f o r (k=l; k<=pos; k++) ( while (buf[i]==« •) i++ ; while (buf[i]!=' • && buf[i]!=') 1) ( i f (k==pos) vertx[q++] = buf[i++] ; else i++ ; } } vertx[q] = EOW ; } /*********************************^ /* */ / * G E T V A L F U N C T I O N — G e t s V a r i a b l e F r o m L i n e * / /* */ / * T h e g e t v a l f u n c t i o n r e t u r n s t h e v a r i a b l e s t o r e d * / / * a f t e r t h e n o d e s i n t h e l i n e b u f f e r . * / /* */ /********************************************** g e t v a l ( b u f , s t o r e ) Char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / Char S t o r e [ W O R D ] ; / * V A R I A B L E B U F F E R * / ( i n t q , i ; / * I N D E X V A R I A B L E S * / / * A D V A N C E B E Y O N D T H E N O D E S * / q = i = 0 ; w h i l e ( b u f [ i + + ] ! = ' ) ' ) w h i l e ( b u f [ i ] = = « ' ) i + + ; / * C O P Y T H E V A R I A B L E T O T H E S T R I N G B U F F E R * / w h i l e ( b u f [ i ] ! = « 1 && b u f [ i ] ! = • ; 1 && b u f [ i ] ! = ' ( • ) s t o r e [ q + + ] = b u f [ i + + ] ; s t o r e [ q ] = EOW ; 1 6 7 /*************************************^ /* */ / * I N F U N C T I O N — S e e i f S t r i n g i s i n T A B L E * / /* */ / * T h e i n f u n c t i o n d e t e r m i n e s i f t h e i n p u t s t r i n g i s * / / * s t o r e d i n t h e g i v e n c o l u m n o f T A B L E . * / /* */ /***********************************************************/ i n ( s t r , c o l ) c h a r * s t r i n t c o l ; / * I N P U T S T R I N G * / / * T A B L E C O L U M N * / { i n t i = 0 / * I N D E X V A R I A B L E * / / * S C A N T H E T A B L E C O L U M N F O R T H E G I V E N S T R I N G * / d o { i f ( s a m e ( s t r , S t a b l e [ c o l ] [ i ] [ 0 ] ) ) r e t u r n ( 1 ) ; } w h i l e ( t a b l e [ c o l ] [ i + + ] [ 0 ] ! = E O W ) ; / * I F N O T F O U N D R E T U R N Z E R O * / r e t u r n ( 0 ) ; } /*********************************************** / * * / / * I N S E R T F U N C T I O N — I n s e r t S t r i n g i n T A B L E * / /* */ / * T h e i n s e r t f u n c t i o n i n s e r t s t h e g i v e n s t r i n g i n t o * / / * t h e r e q u e s t e d c o l u m n o f T A B L E . T h e f i r s t o p e n s l o t i s * / / * u s e d . * / i n s e r t ( s t r , c o l ) c h a r * s t r i n t c o l ; / * S T R I N G T O B E I N S E R T E D * / / * C O L U M N F O R I N S E R T I O N * / { i n t i = 0 / * I N D E X V A R I A B L E * / / * C O P Y T H E S T R I N G I N T O T H E F I R S T O P E N S L O T * / w h i l e ( t a b l e [ c o l ] [ i + + ] [ 0 ] ! = E O W ) ; c o p y ( s t r , S t a b l e [ c o l ] [ i - 1 ] [ 0 ] ) ; 168 / * V / * T h e n o d e s o r t f u n c t i o n e n s u r e s t h a t t h e t h e g i v e n * / / * n o d e i s t h e f i r s t n o d e o f t h e g i v e n l i n e . * / / * V /******************************************* n o d e s o r t ( b u f , s t r ) C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / c h a r s t r [ W O R D ] ; / * N O D E B U F F E R * / ( c h a r s t l [ W O R D ] , s t 2 [ W 0 R D ] ; / * N O D E S T O R A G E B U F F E R S * / i n t i , j ; / * I N D E X V A R I A B L E S * / i = j = 0 ; g e t n o d e ( b u f , O N E , s t l ) ; g e t n o d e ( b u f , T W O , s t 2 ) ; / * I F T H E N O D E I S I N T H E S E C O N D * / / * S P O T T H E N R E V E R S E T H E N O D E S * / i f ( ! s a m e ( s t r , s t l ) ) { w h i l e ( b u f [ i + + ] ! = ' ( • ) ; w h i l e ( s t 2 [ j ] i = E O W ) b u f [ i + + ] = s t 2 [ j + + ] ; b u f [ i + + ] = • • ; j - 0 ; w h i l e ( s t l [ j ] ! = E O W ) b u f [ i + + ] = s t l [ j + + ] ; w h i l e ( b u f [ i ] ! = ' ) ' ) b u f [ i + + ] = ' ' ; } ) /*********************************^ /* */ / * R E A D C L E A N F U N C T I O N — R e a d a n d C l e a n a L i n e * / /* */ / * T h e r e a d c l e a n f u n c t i o n r e a d s a l i n e f r o m t h e i n p u t * / / * f i l e a n d m o d i f i e s i t a s f o l l o w s : * / /* */ / * 1 . C a p i t a l i z e l e t t e r s 2 . R e m o v e c o m m e n t s * / / * 3 . S i n g l e s t a t e m e n t p e r l i n e 4 . L e f t a d j u s t t h e l i n e * / /* */ /************************************************* r e a d c l e a n ( f d f r o m , b u f ) F I L E * f d f r o m ; / * I N P U T F I L E * / 1 6 9 C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / { i n t a , b ; / * COMMENT B O U N D S * / i n t c h ; / * F I L E C H A R A C T E R * / i n t i , q ; / * I N D E X V A R I A B L E S * / q = 0 ; a = b = ( - 1 ) ; / * S T A R T R E A D I N G C H A R A C T E R S F R O M I N P U T F I L E * / d o { c h = g e t c ( f d f r o m ) ; b u f [ q + + ] = ( ( c h > = ' a ' && c h < = ' z ' ) ? c h - ' a ' + ' A ' : c h ) ; / * C H E C K F O R C O M M E N T B E G I N N I N G * / i f ( q > l && b u f [ q - 2 ] = = V ' && b u f [ q - l ] = = ' * • ) a = q - 2 ; / * C H E C K F O R COMMENT E N D * / i f (a>=0 && b u f [ q - 2 ] = = * * • && b u f [ q - l ] = = ' / 1 ) b = q - 1 ; } w h i l e ( c h ! = E O L && c h ! = E O F && ! ( c h = = ' ; ' && q - l > b ) ) ; / * A P P E N D E O L I F N E E D E D * / i f ( c h = = ' ; ' ) b u f [ q ] = E O L ; / * I F C O M M E N T E X I S T S , B L A N K I T O U T * / i f ( a ! = b ) f o r ( i = a ; i < = b ; i ++ ) b u f [ i ] = • • ; / * C H E C K F O R S P A C E S A T B E G I N N I N G O F L I N E * / q - 0 ; w h i l e ( b u f [ q ] = = « • && b u f [ q ] ! = E O L && b u f [ q ] ! = E O F ) q++ ; / * L E F T A D J U S T T H E L I N E * / i = q ; i f ( q > 0 ) d o { b u f [ i - q ] = b u f [ i ] ; } w h i l e ( b u f [ i + + ] != E O L ) ; } /********************************************************* / * * / / * R E A D L I N E F U N C T I O N — R e a d a L i n e F r o m I n p u t F i l e * / / * * / / * T h e r e a d l i n e f u n c t i o n r e a d s a l i n e t e r m i n a t e d b y a n * / / * E O L o r E O F f r o m t h e i n p u t f i l e g i v e n . * / 1 7 0 /* */ /***********************************************************/ r e a d l i n e ( f d f r o m , b u f ) F I L E * f d f r o m ; / * I N P U T F I L E * / C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / { i n t q = 0 ; / * I N D E X V A R I A B L E * / / * R E A D C H A R A C T E R S F R O M I N P U T F I L E * / d o { b u f [ q + + ] = g e t c ( f d f r o m ) ; } w h i l e ( b u f [ q - 1 ] ! = E O L && b u f [ q - 1 ] ! = E O F ) ; ) /***********************************************************/ / * * / / * S A M E F U N C T I O N — S t r i n g E q u a l i t y T e s t e r * / / * * / / * T h e s a m e f u n c t i o n c o m p a r e s t w o s t r i n g s u p t o t h e * / / * l a s t E O W , E O L , o r E O F . * / /* */ /***************************************** s a m e ( b u f 1 , b u f 2 ) c h a r * b u f l ; / * F I R S T S T R I N G * / c h a r * b u f 2 ; / / * S E C O N D S T R I N G * / ( i n t k = ( - 1 ) ; / * I N D E X V A R I A B L E * / i n t s e t = 1 ; / * O F F S E T F O R L O N G S T R I N G S * / / * T A K E N O T E I F S T R I N G I S T E R M I N A T E D W I T H E O L * / d o ( i f ( b u f l [ + + k ] = = E O L ) s e t = 0 ; } w h i l e ( b u f l [ k ] ! = E O W && b u f l [ k ] ! = E O L && b u f 1 [ k ] ! = E O F ) ; / * C O M P A R E T H E S T R I N G S C H A R A C T E R B Y C H A R A C T E R * / k = 0 ; d o ( i f ( b u f l [ k ] ! = b u f 2 [ k + + ] ) r e t u r n ( 0 ) ; } w h i l e ( b u f 2 [ k - s e t ] ! = E O W && b u f l [ k - s e t ] ! = E O W ) ; r e t u r n ( 1 ) ; } /******************************************* / * * / / * S C O U T F U N C T I O N — W R I T E S C E L E M E N T * / / * * / / * T h e s c o u t f u n c t i o n a s s e m b l e s t h e d a t a f o r t h e S C * / 171 / * e l e m e n t a n d w r i t e s i t t o t h e o u t p u t f i l e . * / /* */ /***********************************************************/ s c o u t ( c o n l , c o n 4 , e l k , f d t o ) C h a r c o n l [ W O R D ] ; / * F I R S T N O D E O F S C E L E M E N T * / C h a r COn4[W0RD] ; / * S E C O N D N O D E O F S C E L E M E N T * / Char c l k [ 5 ] [ W O R D ] ; / * C A P V A L U E A N D C L O C K S * / F I L E * f d t o ; / * O U T P U T F I L E * / { c h a r l i n e [ L E N G T H ] ; / * L I N E B U F F E R * / i n t q = 4 i n t i = 0 i n t x = 0 / * I N D E X V A R I A B L E * / / * I N D E X V A R I A B L E * / / * I N D E X V A R I A B L E * / } / * L A B E L T H E S C E L E M E N T * / c o p y ( s c , & l i n e [ 0 ] ) ; / * I N S E R T T H E F I R S T N O D E * / w h i l e ( c o n l [ x ] ! = E O W ) l i n e [ q + + ] = c o n l [ x + + ] ; l i n e [ q + + ] = ' 1 ; / * I N S E R T T H E S E C O N D N O D E * / w h i l e ( c o n 4 [ i ] ! = E O W ) l i n e [ q + + ] = c o n 4 [ i + + ] ; l i n e [ q + + ] = • ) • ; / * I N S E R T T H E C A P V A L U E A N D T H E F O U R C L O C K S * / f o r ( x = 0 ; x < 5 ; x++) { l i n e [ q + + ] = ' ' ; i - 0 ; w h i l e ( c l k [ x ] [ i ] ! = E O W ) l i n e [ q + + ] = c l k [ x ] [ i + + ] ; } / * T E R M I N A T E T H E L I N E A N D W R I T E I T T O T H E O U T P U T F I L E * / l i n e [ q + + ] = ' 1 ; l i n e [ q + + ] = • ; ' ; l i n e [ q ] = E O L ; w r i t e l i n e ( f d t o , l i n e ) ; /************************************************ /* */ / * W R I T E L I N E F U N C T I O N ~ W r i t e a L i n e T o O u t p u t F i l e * / /* */ / * T h e w r i t e l i n e f u n c t i o n w r i t e s a l i n e t e r m i n a t e d b y * / / * E O L o r E O F o r EOW t o t h e o u t p u t f i l e . * / /* */ 1 7 2 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / w r i t e l i n e ( f d t o , b u f ) F I L E * f d t o ; / * O U T P U T F I L E * / c h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / { i n t q = 0 ; / * I N D E X V A R I A B L E * / / * W R I T E T H E L I N E T O T H E O U T P U T F I L E * / d o { p u t c ( b u f [ q + + ] , f d t o ) ; } w h i l e ( b u f [ q - 1 ] ! = E O L && b u f [ q - 1 ] ! = E O F && b u f [ q ] ! = E O W ) ; } /***********************************************************/ / * * / / * WROUT F U N C T I O N — W r i t e E n c o d e d O u t p u t * / / * * / / * T h e w r o u t f u n c t i o n r e l a b e l s c i r c u i t e l e m e n t s a n d * / / * w r i t e s i t t o t h e o u t p u t f i l e . * / /* */ /***********************************************************/ w r o u t ( f d t o , b u f , t i t l e ) F I L E * f d t o ; / * O U T P U T F I L E * / Char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / Char * t i t l e ; / * NEW L A B E L F O R E L E M E N T * / ( c h a r l i n e [ L E N G T H ] ; / * L I N E B U F F E R * / i n t i = 0 ; / * I N D E X V A R I A B L E * / i n t q = 4 ; / * I N D E X V A R I A B L E * / / * R E L A B E L T H E L I N E * / c o p y ( t i t l e , & l i n e [ 0 ] ) ; w h i l e ( b u f [ i + + ] ! = • ( • ) ; / * I N S E R T T H E R E S T O F T H E L I N E F R O M B E F O R E * / w h i l e ( b u f [ i - 1 ] ! = E O L ) l i n e [ q + + ] = b u f [ i + + ] ; / * W R I T E T H E L I N E T O T H E O U T P U T F I L E * / w r i t e l i n e ( f d t o , l i n e ) ; A P P E N D I X D : T H E L A Y O U T G E N E R A T O R L I S T I N G T h e l a y o u t g e n e r a t o r r e q u i r e s t h e f i l e n a m e . n d , f i l e n a m e . c t , f i l e n a m e . c o m , a n d t h e o p a m p . c i f f i l e s t o r u n . T h e o p e r a t i o n a l a m p l i f i e r C I F c o d e m u s t b e s y m b o l #2 a n d m u s t b e i n a f i l e c a l l e d o p a m p . c i f . I t i s r u n a s f o l l o w s : S I S C L f i l e n a m e s t y l e <CR> w h e r e s t y l e r e f e r s t o o n e o f t h e f o l l o w i n g d e s i g n t e c h n i q u e s : A ( A R O M A ) , L ( L e e ) , M ( M a r t i n ) , a n d S ( D a t a r & S e d r a ) . T h e s i n g l e c h a r a c t e r i s u s e d . I t p r o d u c e s o n e o u t p u t f i l e c a l l e d f i l e n a m e . c i f . 173 1 7 4 # i n c l u d e < s t d i o . h > # d e f i n e L E N G T H 72 # d e f i n e WORD 8 # d e f i n e Z E R O 0 # d e f i n e O N E 1 # d e f i n e TWO 2 # d e f i n e EOW ' \ 0 ' # d e f i n e E O L ' \ n ' # d e f i n e L I M I T 0 . 4 # d e f i n e E D G E 2 0 # d e f i n e C A P G A P 2 # d e f i n e T O P M A X 2 0 # d e f i n e M A X O P 2 0 # d e f i n e M A X C A P 8 0 # d e f i n e M A X V A L 1 0 0 # d e f i n e M1W " L M l ;W" # d e f i n e M 1 B " L M l ; B " # d e f i n e P1W " L P l ;W" # d e f i n e P 1 B " L P l ; B » # d e f i n e P2W " L P 2 ;W" # d e f i n e P 2 B " L P 2 ; B " # d e f i n e C1W " L C l ;W" # d e f i n e C 1 B " L C l ; B " # d e f i n e ACW " L A C ; W " # d e f i n e A C B " L A C ; B " # d e f i n e PWB " L PW ; B " # d e f i n e P P B " L P P ; B " # d e f i n e N P B " L N P ; B " c h a r t a b l e [ 3 ] [ 5 0 ] [ W O R D ] ; s h o r t g r i d [ 2 0 0 0 ] [ T O P M A X ] ; s h o r t p a t h [ 1 0 ] [ 3 * M A X C A P ] ; s h o r t p a t h 2 [ 5 ] [ 5 0 0 0 ] ; f l o a t L A M B D A ; i n t U ; i n t X B A S E = 1 4 0 0 ; i n t Y B A S E = 3 4 0 0 0 ; i n t w ; i n t t o t a l ; i n t t o p p e r ; i n t s t a g e s ; / * B U F F E R L E N G T H * / / * I D E N T I F I E R L E N G T H * / / * Z E R O C O N S T A N T * / / * O N E C O N S T A N T * / / * TWO C O N S T A N T * / / * E N D O F WORD * / / * E N D O F L I N E * / / * F R A C T I O N B O U N D * / / * P L A T E S I Z E * / / * P L A T E S E P A R A T I O N * / / * C A P A R R A Y H E I G H T * / / * T O T A L O P - A M P S * / / * T O T A L C A P A C I T O R S * / / * M A X C A P V A L U E * / / * M E T A L W I R E COMMAND * / / * M E T A L B O X COMMAND * / / * P O L Y 1 W I R E COMMAND * / / * P O L Y 1 B O X COMMAND * / / * P O L Y 2 W I R E COMMAND * / / * P O L Y 2 B O X COMMAND * / / * C U T W I R E COMMAND * / / * C U T B O X COMMAND * / / * A C T I V E W I R E COMMAND * / / * A C T I V E B O X COMMAND * / / * P - W E L L B O X COMMAND * / / * P+ B O X COMMAND * / / * N+ B O X COMMAND * / / * N O D E T A B L E * / / * C A P A C I T O R L A Y O U T A R R A Y * / / * C A P A C I T O R W I R I N G A R R A Y * / / * O P - A M P W I R I N G A R R A Y * / / * L A Y O U T S C A L I N G F A C T O R * / / * C I F B A S E U N I T * / / * L A Y O U T X - A X I S S T A R T * / . / * L A Y O U T Y - A X I S S T A R T * / / * 2 * L A M B D A W I R E W I D T H * / / * N U M B E R O F C A P A C I T O R S * / / * C A P A R R A Y H E I G H T * / / * N U M B E R O F F I L T E R S T A G E S * / 1 7 5 i n t s w a p ; i n t s t a r t ; i n t l e v e l [ 1 0 ] s t r u c t c e l l { / * A R R A Y L A Y O U T S T R A T E G Y * / / * F I L T E R S T A R T I N G P O I N T * / / * V E R T I C A L L A Y O U T L E V E L S * / i n t h e i g h t i n t w i d t h ; i n t x o r g ; i n t y o r g ; i n t l e v e l j i n t c o n [ 3 ] i n t v o s [ 3 ] i n t w i d [ 3 ] / * O P - A M P H E I G H T * / / * O P - A M P W I D T H * / / * X O R I G I N O F O P - A M P * / Y O R I G I N O F O P - A M P * / O P - A M P C O N N E C T I O N L E V E L * / C O N N E C T I O N D I S P L A C E M E N T S * / POWER C O N N E C T L E V E L S * / POWER L I N E W I D T H S * / /* /* /* /* /* s t r u c t c e l l o p a m p / * O P - A M P D A T A * / s t r u c t m o t h e r { i n t c a p ; /* C A P A C I T O R C O N T A C T * / i n t o u t ; /* O P - A M P C O N T A C T * / i n t c r o s s ; /* H O R I Z O N T A L C R O S S I N G * / i n t l e v e l ; /* W I R I N G L E V E L * / i n t b a s e ; /* O P - A M P P L A C E M E N T * / i n t m i r r o r ; /* M I R R O R F L A G * / i n t g n d ; /* + I N P U T C O N T A C T * / i n t g n d c r o s s ; /* H O R I Z O N T A L C R O S S I N G * / i n t g n d l e v e l ; } ; /* W I R I N G L E V E L * / s t r u c t m o t h e r w h i p [ 2 * M A X O P ] ; /* O P - A M P C O N N E C T I O N D A T A * / s t r u c t c o n t a i n { f l o a t v a l ; f l o a t v 2 ; s h o r t h o r [ M A X V A L ] s h o r t v e r [ M A X V A L ] i n t p n t ; i n t n e x t ; i n t u s e d ; i n t s w t c h ; i n t l a y ; i n t f l a g ; i n t t i p f l a g ; c h a r t y p ; c h a r f s t [ W O R D ] ; c h a r s e c [ W O R D ] ; s t r u c t c o n t a i n c a p a c [ M A X C A P ] ; } / * C A P A C I T O R V A L U E * / / * C A P A C I T O R V A L U E * / / * P L A T E H O R I Z O N T A L * / / * P L A T E V E R T I C A L * / / * N U M B E R O F P L A T E S * / / * E X T R A C A P G A P S * / / * S W I T C H P L A C E M E N T * / / * C L O C K I N G S C H E M E * / / * C A P A C I T O R L A Y O U T * / S W I T C H C O N N E C T I O N * / T I P P L A C E M E N T * / C A P A C I T O R T Y P E * / F I R S T C A P N O D E * / S E C O N D C A P N O D E * / /* /* /* /* /* / * C A P A C I T O R D A T A * / /********************************************* / * * / / * M A I N P R O G R A M — L A Y O U T G E N E R A T O R * / /* */ /*************************************** m a i n ( a r g c , a r g v ) /* F E T C H C S H E L L P A R A M E T E R S i n t a r g c ; c h a r * a r g v [ ] /* /* N U M B E R O F A R G U M E N T S * / A R G U M E N T P O I N T E R S * / { c h a r h e a d ; /* /* /* /* /* /* /* /* /* /* I N P U T S E C T I O N S T Y L E * / L I N E B U F F E R * / c h a r * b u f ; c h a r * f p ; c h a r s t ; F I L E P O I N T E R * / C H A R A C T E R S T O R A G E * / I N D E X V A R I A B L E * / i n t i ; F I L E * f d c o m ; F I L E * f d c i f ; F I L E * f o p e n ( ) F I L E * f d c t ; F I L E * f d n d ; • C T F I L E D E S C R I P T O R * / . N D F I L E D E S C R I P T O R * / . C O M F I L E D E S C R I P T O R * / . C I F F I L E D E S C R I P T O R * / F I L E O P E N F U N C T I O N * / / * S A V E T H E I N P U T S E C T I O N S T Y L E * / s t = * a r g v [ 2 ] ; h e a d = ( ( s t > = ' a ' && s t < = ' z ' ) ? s t - ' a ' + ' A ' : s t ) ; / * O P E N T H E . C T F I L E F O R R E A D I N G * / f p = a r g v [ l ] ; f o r ( i = 0 ; * ( f p + i ) ! = E O W ; i ++ ) ; * ( f p + i + 0 ) = ' . • ; * ( f p + i + l ) = ' c ' ; * ( f p + i + 2 ) = ' t ' ; * ( f p + i + 3 ) = EOW ; f d c t = f o p e n ( f p , " r " ) ; / * O P E N T H E . C O M F I L E F O R R E A D I N G * / * ( f p + i + l ) = ' c 1 ; * ( f p + i + 2 ) = ' o ' ; * ( f p + i + 3 ) = ' m ' ; * ( f p + i + 4 ) = EOW ; f d c o m = f o p e n ( f p , " r " ) ; / * O P E N T H E . N D F I L E F O R R E A D I N G * / * ( f p + i + l ) = ' n ' ; * ( f p + i + 2 ) = ' d ' ; * ( f p + i + 3 ) = EOW ; f d n d = f o p e n ( f p , " r " ) ; / * O P E N T H E . C I F F I L E F O R W R I T I N G * / * ( f p + i + l ) = ' c ' ; * ( f p + i + 2 ) = ' i ' ; * ( f p + i + 3 ) = ' f ; * ( f p + i + 4 ) = EOW ; f d c i f = f o p e n ( f p , " w " ) ; / * I N I T I A L I Z E T H E N O D E A N D C A P A C I T O R D A T A * / i n i t ( f d c o m , f d c t , f d n d , h e a d ) ; / * G E N E R A T E T H E C A P A C I T O R A R R A Y * / c a p a r r a y ( f d c i f ) ; / * I N I T I A L I Z E T H E O P - A M P A N D S W I T C H D A T A p r e o p ( f d c i f ) ; / * W I R E T H E I N P U T N O D E S * / w i r e l ( f d c i f ) ; / * W I R E T H E O U T P U T N O D E S * / w i r e 2 ( f d c i f ) ; / * W I R E T H E H I D D E N I N P U T N O D E S * / w i r e 3 ( f d c i f ) ; / * W I R E T H E H I D D E N O U T P U T N O D E S * / w i r e 4 ( f d c i f , 0 ) ; w i r e 4 ( f d c i f , 1 ) ; / * C O N N E C T T H E S W I T C H E S * / s t r e a k ( f d c i f ) ; / * C O N N E C T T H E I N P U T A N D O U T P U T N O D E S * / w i r e 5 ( f d c i f ) ; / * C O N N E C T T H E G R O U N D L E A D S * / w i r e 6 ( f d c i f ) ; / * P L A C E A N D C O N N E C T T H E O P - A M P S * / a m p s o n ( f d c i f ) ; / * I N S E R T G L O B A L L A Y O U T F E A T U R E S * / w r a p u p ( f d c i f ) ; / * H A R D - W I R E T H E I N P U T S E C T I O N * / i f ( h e a d = = « L ' ) i n p u t l ( f d c i f ) ; i f ( h e a d = = ' M ' ) i n p u t 2 ( f d c i f ) ; i f ( h e a d = = « S ' ) i n p u t 3 ( f d c i f ) ; i f ( h e a d = = ' A l ) i n p u t 4 ( f d c i f ) ; / * F I N I S H T H E . C I F F I L E * / b u f = " D F ; \ n " ; w r i t e l i n e ( f d c i f , b u f ) ; / * C L O S E T H E F I L E S * / f c l o s e ( f d c t ) ; f c l o s e ( f d c i f ) ; f c l o s e ( f d c o m ) ; f c l o s e ( f d n d ) ; 1 7 8 /***********************************************************/ / * * / / * I N I T F U N C T I O N — R e a d I n p u t D a t a * / /* */ / * T h e i n i t f u n c t i o n r e a d s t h e i n p u t . C T f i l e a n d * / / * i n i t i a l i z e s t h e c a p a c s t r u c t u r e . I t a l s o i n i t i a l i z e s * / / * t h e n o d e t a b l e . * / /* */ /***********************************************************/ i n i t ( f d c o m , f d c t , f d n d , h e a d ) F I L E * f d c o m ; / * . C O M I N P U T F I L E * / F I L E * f d c t ; / * . C T I N P U T F I L E * / F I L E * f d n d ; / * . N D I N P U T F I L E * / c h a r h e a d ; / * I N P U T S E C T I O N S T Y L E * / { i n t i , j , k ; / * I N D E X V A R I A B L E S * / i n t c o n n [ 4 ] ; / * C L O C K P H A S E S * / i n t f l i p [ M A X C A P ] ; / * C A P C L O C K S T O R A G E * / c h a r l i n e [ L E N G T H ] ; / * L I N E B U F F E R * / Char S t l [ W O R D ] , s t 2 [ W O R D ] ; / * N O D E B U F F E R S * / / * I N I T I A L I Z E T H E L E V E L S T O R A G E * / f o r ( i = 0 ; i < 1 0 ; i + + ) l e v e l [ i ] = 0 ; / * R E A D T H E . C O M F I L E D A T A * / r e a d c o m ( f d c o m ) ; / * R E A D I N P U T A N D O U T P U T N O D E S * / r e a d n d ( f d n d , h e a d ) ; / * I N I T I A L I Z E T H E C A P A C I T O R S * / i = 1 ; s t a g e s = 0 ; r e a d l i n e ( f d c t , l i n e ) ; w h i l e ( l i n e [ 0 ] != E O F ) / * T H E I N P U T S W I T C H I S P U T ON T H E F I R S T C A P A C I T O R * / { i f ( l i n e [ 0 ] = = ' B ' && l i n e [ l ] = = ' S ' ) { g e t n o d e ( l i n e , O N E , s t l ) ; g e t n o d e ( l i n e , T W O , s t 2 ) ; i f ( s a m e ( S t a b l e [ 0 ] [ 0 ] [ 0 ] , s t l ) | | s a m e ( & t a b l e [ 0 ] [ 0 ] [ 0 ] , s { i f ( h e a d = = ' L ' ) c a p a c [ 2 ] . s w t c h = ! c l o c k p h a s e ( l i n e , Z E R O ) ; i f ( h e a d = = ' M ' ) c a p a c [ 1 ] . s w t c h = I c l o c k p h a s e ( l i n e , Z E R O ) ; } } 179 / * GET THE CAP PARAMETERS FROM THE INPUT F I L E * / i f ( l i n e [ l ] = = l C && l i n e [ 0 ] ! = E O L ) { s s c a n f ( l i n e , " % * s % [ A ) ] % c % f 1 1 , s t l , s t 2 , & c a p a c [ i ] . v a l ) ; c a p a c [ i ] . v 2 = c a p a c [ i ] . v a l ; g e t n o d e ( l i n e , O N E , & c a p a c [ i ] . f s t [ 0 ] ) ; g e t n o d e ( l i n e , T W O , & c a p a c [ i ] . s e c [ 0 ] ) ; c a p a c [ i ] • n e x t = 1 ; c a p a c [ i ] . u s e d = 0 ; c a p a c [ i ] . l a y = ( ( c a p a c [ i ] . v a l > s w a p ) ? 0 : 1) ; / * GET THE CLOCKS FOR THE SWITCHED CAPS * / i f ( l i n e [ 0 ] = = ' S ' ) { c a p a c [ i ] . t y p = •s' ; f l i p [ i ] = c l o c k p h a s e ( l i n e , 1 ) ; c a p a c [ i ] . s w t c h = c l o c k p h a s e ( l i n e , 3 ) ; } / * SAVE THE CAPACITOR TYPE * / i f ( l i n e [ 0 ] = = ' I ' ) c a p a c [ i ] . t y p = ' I ' ; i f ( l i n e [ 0 ] = = ' C ) c a p a c [ i ] . t y p = ' C ; i++ ; } / * INCREMENT THE STAGE COUNT * / i f ( l i n e [ 0 ] = = ' O ' ) s t a g e s + + ; r e a d l i n e ( f d c t , l i n e ) ; } / * SAVE THE CLOCKING FOR THE INTEGRATING CAPS * / t o t a l = i - 1 ; f o r ( i = l ; i < = t o t a l ; i++) i f ( c a p a c [ i ] . t y p = = ' I ' ) f o r ( j = 0 ; j < = t o t a l ; j++) i f ( s a m e ( & c a p a c [ i ] . f s t [ 0 ] , f i c a p a c [ j ] . f s t [ 0 ] ) ) c a p a c [ i ] . s w t c h = f l i p [ j ] ; / * I N I T I A L I Z E THE SWITCH CONNECTION FLAGS * / f o r ( i = l ; i < = t o t a l ; i++) c a p a c [ i ] . f l a g = 1 ; / * CUSTOMIZE THE INPUT STAGE PARAMETERS * / i f ( head== 'M ' ) ( c a p a c [ 1 ] . f l a g = 0 ; c a p a c [ 1 ] . u s e d = 1 ; } i f ( h e a d = = ' A ' ) { c a p a c [ 1 ] . u s e d = 1 ; c a p a c [ 1 ] . f l a g = 0 ; f o r ( i = 2 ; i < = t o t a l ; i++) i f ( s a m e ( & c a p a c [ i ] . s e c [ 0 ] , & t a b l e [ 0 ] [ 0 ] [ 0 ] ) && c a p a c [ i ] • t y p = = ' S 1 && c a p a c [ i ] . s w t c h ! = c a p a c [ l ] . s w t c h ) { c a p a c [ i ] . f l a g = 0 ; 1 8 0 c a p a c [ i ] . u s e d = 1 ; } } i f ( h e a d = = ' S ' ) { c a p a c [ 1 ] . f l a g = 0 c a p a c [ 2 ] . f l a g = 0 c a p a c [ 2 ] . u s e d = 1 c a p a c [ 3 ] . f l a g = 0 c a p a c [ 3 ] . u s e d = 1 c a p a c [ 1 ] . n e x t = 2 c a p a c [ 2 ] . s w t c h = ! c a p a c [ 3 ] . s w t c h ; /*********************************^ / * * / / * C A P A R R A Y F U N C T I O N — G e n e r a t e C a p a c i t o r A r r a y * / / * V / * T h e c a p a r r a y f u n c t i o n g e n e r a t e s t h e c a p a c i t o r a r r a y * / / * b y l a y i n g o u t t h e c a p a c i t o r s a n d t h e n e n s u r i n g t h a t * / / * t h e o p - a m p w i d t h s a r e c o m p a r a b l e t o t h e c a p a c i t o r b a s e * / / * w i d t h s . I f t h i s i s n o t t h e c a s e , s p a c e s a r e i n s e r t e d * / / * t h e c a p a c i t o r a r r a y . T h e c a p a c i t o r t i p i s a d d e d a t t h e * / / * e n d t o p r o v i d e p r o p e r a r e a s a n d m a s k s h i f t i m m u n i t y . * / /* */ /***************************************** c a p a r r a y ( f d c i f ) F I L E * f d c i f ; / * . C I F F I L E * / { i n t x c l ; / * W I D T H O F T H E O P - A M P S * / i n t XC2 ; / * W I D T H O F C A P A C I T O R S * / f l o a t s p a c e ; / * E X T R A S P A C E N E E D E D * / / * L A Y O U T T H E C A P A C I T O R A R R A Y * / l a y o u t ( f d c i f , 0 . 0 ) ; / * C O M P A R E W I D T H S O F O P - A M P S A N D C A P A C I T O R S * / x c l = s t a g e s * o p a m p . w i d t h ; xc2 = c a p a c [ t o t a l ] . n o r [ 0 ] + c a p a c [ t o t a l ] . n e x t * E D G E ; s p a c e = ( x c l - xc2 + 1 0 ) / ( t o t a l - 1 ) ; / * I N S E R T E X T R A S P A C E S I N T H E C A P A R R A Y I F N E C C E S S A R Y * / i f ( s p a c e > 0) l a y o u t ( f d c i f , s p a c e ) ; / * A D D T H E T I P ON T H E C A P A C I T O R S * / t e r m o n a t e ( f d c i f ) ; > /***********************************************************/ 1 8 1 /* */ / * L A Y O U T F U N C T I O N — L a y o u t C a p a c i t o r s * / /* */ / * T h e l a y o u t f u n c t i o n g e n e r a t e s t h e c a p a c i t o r a r r a y . * / / * T h e l a y o u t i s g e n e r a t e d b y l a y i n g o u t e a c h c a p a c i t o r * / / * o n e p l a t e a t a t i m e a n d i n s e r t i n g s p a c e s u n t i l a l l t h e * / / * c a p a c i t o r s f i t . T h e h e i g h t o f t h e a r r a y i s u s e r s e t . * / / * V / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * l a y o u t ( f d t o , s p a c e ) F I L E * f d t o ; f l o a t s p a c e ; { c h a r * b u f ; f l o a t f r a c t i o n ; f l o a t g a p 2 ; f l o a t F E D G E = E D G E ; i n t d i r [ 2 ] [ 4 ] [ 2 ] ; i n t x , y ; i n t i , j ; i n t f l a g ; i n t f i n i s h ; i n t h o r z ; i n t l e f t ; i n t g a p ; i n t n u m b ; i n t x d i r , y d i r ; i n t i n d e x ; / * O U T P U T F I L E * / / * E X T R A G A P R E Q U I R E D * / / * L I N E B U F F E R * / / * F R A C T I O N A L C A P S I Z E * / * G A P I N C R E M E N T * / / * P L A T E E D G E * / / * P L A T E D I R E C T I O N S * / / * P L A T E C O - O R D I N A T E S * / / * I N D E X V A R I A B L E S * / / * P L A T E L A Y O U T S U C C E S S / * A R R A Y L A Y O U T S U C C E S S / * H O R I Z . L A Y O U T C O - O R D / * L E F T P L A T E B O U N D A R Y * / * P L A T E G A P * / / * C U R R E N T C A P A C I T O R * / / * P L A T E D I R E C T I O N * / / * S E A R C H I N D E X * / / * I N I T I A L I Z E P L A T E D I R E C T I O N U P - D O W N P R E F E R E N C E * / d i r [ 0 ] [ 0 ] [ 0 ] = 0 ; d i r [ 0 ] [ 0 ] [ 1 ] = 1 ; d i r [ 0 ] [ l ] [ 0 ] = 0 ; d i r [ 0 ] [ l ] [ l ] = - 1 ; d i r [ 0 ] [ 2 ] [ 0 ] = 1 ; d i r [ 0 ] [ 2 ] [ l ] = 0 ; d i r [ 0 ] [ 3 ] [ 0 ] = - 1 ; d i r [ 0 ] [ 3 ] [ 1 ] = 0 ; / * I N I T I A L I Z E P L A T E D I R E C T I O N R I G H T - L E F T P R E F E R E N C E * / d i r [ l ] [ 0 ] [ 0 ] = 0 ; d i r [ 1 ] [ 0 ] [ 1 ] = - 1 ; d i r [ l ] [ l ] [ 0 ] = 1 ; d i r [ l ] [ l ] [ l ] = 0 ; d i r [ l ] [ 2 ] [ 0 ] = - 1 ; d i r [ l ] [ 2 ] [ l ] = 0 ; d i r [ l ] [ 3 ] [ 0 ] = 0 ; d i r [ 1 ] [ 3 ] [ 1 ] = 1 ; / * C O P Y O P - A M P C E L L T O C I F F I L E * / r e w i n d ( f d t o ) ; s h o v e o n ( f d t o ) ; / * I N I T I A L I Z E L A Y O U T S Y M B O L * / b u f = " D S 1 ; \ n " ; w r i t e l i n e ( f d t o , b u f ) ; 1 8 2 / * E M P T Y T H E A R R A Y * / f o r ( i = 0 ; i < 2 0 0 0 ; i + + ) f o r ( j = 0 ; j < T O P M A X ; j + + ) g r i d [ i ] [ j ] = 0 ; / * I N I T I A L I Z E T H E L A Y O U T P A R A M E T E R S * / h o r z = 1 ; g a p = 0 ; g a p 2 = 0 . 0 ; / * P L A C E T H E F I R S T P L A T E O F E A C H C A P A C I T O R * / f o r ( i = l ; i < = t o t a l ; i + + ) / * I N I T I A L I Z E T H E F I R S T P L A T E C O - O R D S * / { c a p a c [ i ] . p n t = 1 ; c a p a c [ i ] . h o r [ 0 ] = h o r z ; c a p a c [ i ] . v e r [ 0 ] = 1 ; / * F I N D T H E P L A T E S I Z E * / c a p a c [ i ] . v a l = c a p a c [ i ] . v 2 ; f r a c t i o n = ( ( c a p a c [ i ] . v a l < l . 0 ) ? c a p a c [ i ] . v a l : 1 . 0 ) ; c a p a c [ i ] . t i p f l a g = ( ( f r a c t i o n < l . 0 ) ? 1 : 0) ; c a p a c [ i ] . v a l = c a p a c [ i ] . v a l - 1 . 0 ; / * F I L L T H E A R R A Y * / f o r ( j = h o r z ; j < h o r z + E D G E ; j + + ) g r i d [ j ] [ l ] = i ; / * A T T A C H T H E P L A T E * / a t t a c h l ( h o r z , 0 , 0 , 1 , f r a c t i o n , f d t o , 0 ) ; / * I N C R E M E N T T O T H E N E X T P L A T E * / g a p 2 = g a p 2 + s p a c e - g a p ; g a p = ( ( g a p 2 > = E D G E ) ? E D G E : 0) ; h o r z = h o r z + c a p a c [ i ] . n e x t * E D G E + C A P G A P + g a p ; , } / * P L A C E T H E B O U N D A R I E S O F T H E A R R A Y * / h o r z = h o r z - C A P G A P ; f o r ( i = 0 ; i < = h o r z ; i + + ) f o r ( j = 0 ; j < T O P M A X ; j + + ) i f ( i = = 0 | | i = = h o r z | | j = = 0 | | j = = t o p p e r + 2 ) g r i d [ i ] [ j ] = M A X C A P - 1 ; / * P L A C E T H E R E S T O F T H E C A P A C I T O R P L A T E S * / f i n i s h = 0 ; w h i l e ( ! f i n i s h ) { f i n i s h = 1 ; / * C H E C K E A C H C A P A C I T O R I N T U R N * / 1 8 3 f o r ( n u m b = l ; n u m b < = t o t a l ; numb++) / * T R Y E A C H D I R E C T I O N * / { f l a g = 0 ; f o r ( j = 0 ; (j<4 && I f l a g ) ; / * C H E C K E A C H P R E V I O U S P L A T E * / f o r ( i n d e x = 0 ; ( i n d e x < c a p a c [ n u m b ] . p n t && " f l a g ) ; i n d e x / * F I N D T H E P L A T E L O C A T I O N * / { x d i r = d i r [ c a p a c [ n u m b ] . l a y ] [ j ] [ 0 ] ; y d i r = d i r [ c a p a c [ n u m b ] . l a y ] [ j ] [ 1 ] ; x = c a p a c [ n u m b ] . h o r [ i n d e x ] ; y = c a p a c [ n u m b ] . v e r [ i n d e x ] ; / * D E C I D E I F T H E R E I S ROOM F O R T H E P L A T E * / i f ( c a p a c [ n u m b ] . v a l > 0 && ! f l a g && d o p e ( x , x d i r , y , y d i r , n u m b , n o r z ) ) / * F I N D T H E P L A T E S I Z E * / { f r a c t i o n = ( ( c a p a c [ n u m b ] . v a l > = l ) ? 1 . 0 : c a p a i f ( f r a c t i o n < l . 0 && y d i r = = l ) c a p a c [ n u m b ] . t i p f l a g = 1 ; / * F I L L T H E A R R A Y O N L Y I F N E C C E S S A R Y * / i f ( f r a c t i o n * F E D G E + C A P G A P + 2 > E D G E && ! x d i r | | ( l e f t = x + x d i r * E D G E ; f o r ( i = l e f t ; i < l e f t + E D G E ; i + + ) g r i d [ i ] [ y + y d i r ] = n u m b ; } / * U P D A T E T H E C A P A C I T O R P A R A M E T E R S * / c a p a c [ n u m b ] . h o r [ c a p a c [ n u m b ] . p n t ] = x + x d i r * E D G c a p a c [ n u m b ] . v e r [ c a p a c [ n u m b ] . p n t ] = y + y d i r ; c a p a c [ n u m b ] . v a l = c a p a c [ n u m b ] . v a l - 1 . 0 ; c a p a c [ n u m b ] . p n t = c a p a c [ n u m b ] . p n t + 1 ; / * P L A C E T H E P L A T E A S A P P R O P R I A T E * / i f ( f r a c t i o n < L I M I T ) a t t a c h 2 ( x , y , x d i r , y d i r , f r a c t i o n , f d t o , 1 ) ; e l s e i f ( f r a c t i o n < 1 . 0 ) a t t a c h . 3 ( x , y , x d i r , y d i r , f r a c t i o n , f d t o , 1) ; e l s e a t t a c h l ( x , y , x d i r , y d i r , f r a c t i o n , f d t o , 1 ) ; / . * S E T T H E F L A G S * / f l a g = 1 ; i f ( c a p a c [ n u m b ] . v a l > 0) f i n i s h = 0 ; } } } ) / * S E E I F T H E A L L C A P A C I T O R S W E R E C O M P L E T E D * / j = f l a g = 0 ; 1 8 4 > w h i l e ( j <= t o t a l ) { i f ( c a p a c [ j ] . v a l > 0 ) / * A L L O C A T E M O R E S P A C E * / { c a p a c [ j + + ] . n e x t += 1 ; / * S K I P N E X T O N E * / f l a g = 1 ; } j = j + 1 ; ) / * DO I T A G A I N I F N E C C E S S A R Y * / i f ( f l a g ) { p r i n t f ( " % s \ n " , " I T E R A T I O N F A I L U R E " ) ; l a y o u t ( f d t o , s p a c e ) ; } /********************************^ / * V / * T E R M O N A T E F U N C T I O N — P l a c e a T i p o n t h e C a p a c i t o r * / /* */ / * T h e t e r m o n a t e f u n c t i o n p l a c e s a t i p o n t h e c a p s n o t * / / * y e t h a v i n g o n e . T h e t i p e n s u r e s p r o p e r a r e a r a t i o s a n d * / / * i m m u n i t y t o P 1 - P 2 m a s k s h i f t s . * / /* */ /***********************************************************/ t e r m o n a t e ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / { i n t i , j ; / * I N D E X V A R I A B L E S * / i n t x t o p , y t o p ; / * H I G H E S T C O - O R D S * / i n t x c , y c ; / * T I P L O C A T I O N * / / * C H E C K E A C H C A P A C I T O R F O R P R E V I O U S T I P P L A C E M E N T * / f o r ( i = l ; i < = t o t a l ; i + + ) i f ( ! c a p a c [ i ] . t i p f l a g ) / * F I N D T H E H I G H E S T P L A T E O F T H E C A P A C I T O R * / { y t o p = - 1 0 0 0 ; f o r ( j = 0 ; j < c a p a c [ i ] . p n t ; j ++ ) i f ( c a p a c [ i ] , v e r [ j ] > y t o p ) { y t o p = c a p a c [ i ] . v e r [ j ] ; x t o p = c a p a c [ i ] . h o r [ j ] ; } / * I N C R E M E N T T O T H E T O P O F T H A T P L A T E * / X C = ( X t o p + E D G E / 2 . 0 ) * U ; y c = ( y t o p * E D G E + 1 ) * U ; / * P L A C E T H E T I P * / B O X ( f d t o , P 2 B , 2 * U , 2 * U , x c , y c ) ; } 1 8 5 /*************************************************** /* •*/ / * W I R E l F U N C T I O N — C o n n e c t I n p u t N o d e s * / / * V / * T h e w i r e l f u n c t i o n c o n n e c t s a l l t h e o p - a m p i n p u t * / / * n o d e s t o t h e a p p r o p r i a t e c a p a c i t o r s . * / /* */ /***********************************************************/ w i r e l ( f d t o ) F I L E * f d t o / * O U T P U T F I L E * / { i n t i , k ; i n t j ; i n t l e a s t [ 2 ] ; i n t m o s t [ 2 ] ; i n t x c [ 3 ] , y c [ 3 ] / * I N D E X V A R I A B L E S * / / * W I R I N G L E V E L * / / * L E F T M O S T P O I N T O F W I R E * / / * R I G H T M O S T P O I N T O F W I R E * / / * W I R I N G C E N T E R C O - O R D S * / / * I N I T I A L I Z E T H E V E R T I C A L C O - O R D S * / yc[13 = level[33 = U ; / * E M P T Y T H E W I R I N G A R R A Y * / f o r ( i = 0 ; i < 1 0 ; i ++ ) f o r ( j = 0 ; j < 3 0 0 ; j + + ) path[ i][J3 = 0 ; / * W I R E U P T H E O P - A M P I N P U T N O D E S * / f o r ( i = s t a r t ; t a b l e [ 2 ] [ i 3 [ 0 ] ! = E O W ; i + = 2 ) / * I N I T I A L I Z E T H E W I R E E N D - P O I N T S * / { least[03 = 3 * ( t o t a l + l ) ; most[03 = 0 ; / * C H E C K A L L C A P A C I T O R S F O R A C O N N E C T I O N * / f o r ( j = 0 ; j < = t o t a l ; { xc[03 = ( c a p a c [ j ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; x c [ 2 ] = x c [ 0 ] - 1 6 * U ; / * I G N O R E S W I T C H E D C A P A C I T O R S * / i f ( c a p a c [ j ] . t y p = = ' S ' ) ; / * I F T H E F I R S T N O D E I S T H E S A M E . . . * / e l s e i f ( s a m e ( & t a b l e [ 2 ] [ i ] [ 0 ] , & c a p a c [ j ] . f s t [ 0 ] ) ) { i f ( 3 * j < l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j ; l e a s t [ l ] = x c [ 2 ] ; } e l s e i f ( 3 * j > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j ; m o s t [ l ] = x c [ 2 ] ; ) ) 1 8 6 > / * I F T H E S E C O N D N O D E I S T H E S A M E . . . * / e l s e i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , & c a p a c [ j ] . s e c [ 0 ] ) ) { i f ( 3 * j + 2 < l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j + 2 ; l e a s t [ l ] - x c [ 0 ] ; } e l s e i f ( 2 * j + l > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j + 2 ; m o s t [ l ] = x c [ 0 ] ; } } } i f ( m o s t [ 0 ] > l e a s t [ 0 ] ) { / * F I N D W I R E L E V E L A N D P L A C E W I R E * / j = w i r e s l o t ( l e a s t , m o s t ) ; y c [ 0 ] = ( - 5 * j - 3 ) * U ; W I R E ( f d t o , M l W , w , l e a s t [ 1 ] , y c [ 0 ] , m o s t [ l ] , y c [ 0 ] ) ; } / * C H E C K A L L C A P A C I T O R S * / f o r ( k = 0 ; k < = t o t a l ; k++) { x c [ 0 ] = ( c a p a c [ k ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; x c [ 2 ] = x c [ 0 ] - 1 6 * U ; / * C O N N E C T N O D E S * / i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . f s t [ 0 ] ) | | s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . s e c [ 0 ] ) ) / * P L A C E C A P A C I T O R C O N N E C T I O N S * / { i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . f s t [ 0 ] ) ) / * S A V E V E R T I C A L C O - O R D F O R S W I T C H C O N N E C T I O N * / { c a p a c [ k ] . v e r [ 2 ] = ( ( m o s t [ 0 ] > l e a s t [ 0 ] ) ? y c [ 0 ] / x c [ l ] = x c [ 2 ] ; } e l s e x c [ l ] = x c [ 0 ] ; i f ( c a p a c [ k ] . t y p ! = ' S 1 S S m o s t [ 0 ] > l e a s t [ 0 ] ) { W I R E ( f d t o , P 2 W , w , x c [ l ] , y c [ l ] , x c [ l ] , y c [ 0 ] ) ; m p 2 ( x c [ l ] , y c [ 0 ] , f d t o ) ; } } ) } /*************************************** /* */ / * W I R E 2 F U N C T I O N — C o n n e c t O u t p u t N o d e s * / /* */ / * T h e w i r e 2 f u n c t i o n c o n n e c t s t h e o p - a m p o u t p u t * / / * n o d e s t o s w i t c h e d c a p a c i t o r s w i t c h e s . * / /* */ /************************************************** w i r e 2 ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / { i n t i , k ; / * I N D E X V A R I A B L E S * / 1 8 7 i n t j ; i n t l e a s t [ 2 ] ; i n t m o s t [ 2 ] ; i n t x c [ 4 ] , y c [ 3 ] / * W I R I N G L E V E L * / / * L E F T M O S T P O I N T O F W I R E * / / * R I G H T M O S T P O I N T O F W I R E * / / * W I R I N G C E N T R E C O - O R D S * / / * I N I T I A L I Z E T H E W I R I N G L E V E L S * / y c [ l ] = U ; / * C O N N E C T T H E O P - A M P O U T P U T N O D E S * / f o r ( i = l + s t a r t ; t a b l e [ 2 ] [ i ] [ 0 ] 1 = E O W ; i + = 2 ) / * I N I T I A L I Z E T H E W I R E B O U N D S * / { l e a s t [ 0 ] = 3 * ( t o t a l + l ) ; m o s t [ 0 ] = 0 ; / * C H E C K E A C H C A P F O R T H E N O D E * / f o r ( j = 0 ; j < = t o t a l ; j + + ) { x c [ 0 ] = ( c a p a c [ j ] . n o r [ 0 ] + E D G E / 2 + 8 ) * U ; x c [ 2 ] = x c [ 0 ] - 1 6 * U ; x c [ 3 ] = ( c a p a c f t o t a l ] . h o r [ 0 ] + c a p a c [ t o t a l ] . n e x t * E D G E ) * U / * C H E C K T H E F I R S T N O D E * / i f ( c a p a c [ k ] . t y p ! = ' S ' && s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ j ] . f s t [ 0 ] ) ) { i f ( 3 * j < l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j ; l e a s t [ l ] = x c [ 2 ] ; } e l s e i f ( 3 * j > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j ; m o s t [ l ] = x c [ 2 ] ; } } / * C H E C K T H E S E C O N D N O D E * / e l s e i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , & c a p a c [ j ] . s e c [ 0 ] ) ) ( i f ( ( c a p a c [ j ] . t y p = = ' S f && c a p a c [ j ] . u s e d = = l ) | | c a p a c [ j ] . t y p ! = , S * ) ( i f ( 3 * j + 2 < l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j + 2 ; l e a s t [ l ] = x c [ 0 ] ; } e l s e i f ( 3 * j + 2 > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j + 2 ; m o s t [ l ] = x c [ 0 ] ; } } / * E X T E N D O U T P U T N O D E T O T H E F A R R I G H T * / i f ( s a m e ( S t a b l e [ 0 ] [ 1 ] [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ) ( m o s t [ 0 ] = 3 * t o t a l + 2 ; m o s t [ l ] = x c [ 3 ] ; } } / * C A L C U L A T E W I R E L E V E L * / j = w i r e s l o t ( l e a s t , m o s t ) ; y c [ 0 ] = ( - 5 * j - 3 ) * U ; W I R E ( f d t o , M l w , w , l e a s t [ 1 ] , y c [ 0 ] , m o s t [ l ] , y c [ 0 ] ) ; / * S A V E T H E O U T P U T W I R I N G L E V E L * / i f ( s a m e ( S t a b l e [ 0 ] [ 1 ] [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ) l e v e l [ 9 ] = y c [ 0 ] ; 1 8 8 > / * C O N N E C T T H E A P P R O P R I A T E C A P S * / f o r ( k = 0 ; k < = t o t a l ; k++) { x c [ 0 ] = ( c a p a c [ k ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; x c [ 2 ] = x c [ 0 ] - 1 6 * U ; / * C O N N E C T N O D E S * / i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . f s t [ 0 ] ) | | s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . s e c [ 0 ] ) ) / * F I R S T N O D E * / ( i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . f s t [ 0 ] ) ) x c [ l ] = x c [ 2 ] ; e l s e x c [ l ] = x c [ 0 ] ; / * S A V E L E V E L F O R S W I T C H C O N N E C T I O N * / i f ( c a p a c [ k ] . t y p = = ' S ' ) c a p a c [ k ] . v e r [ l ] = y c [ 0 ] / 1 0 ; / * E L S E P L A C E C O N T A C T S A N D C O N N E C T T H E M * / e l s e ( m p ( x c [ l ] , y c [ 0 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ l ] , y c [ l ] , x c [ l ] , y c [ 0 ] ) ; } } } /*************************************** /* */ / * W I R E 4 F U N C T I O N — C o n n e c t S h a r e d O u t p u t N o d e s * / / * * / / * T h e w i r e 4 f u n c t i o n c o n n e c t s t h e o p - a m p o u t p u t * / / * n o d e s t o s w i t c h e d c a p a c i t o r s w i t c h e s . * / /* */ /************************************** w i r e 4 ( f d t o , t h e o n e ) F I L E * f d t o ; / * O U T P U T F I L E * / i n t t h e o n e ; { i n t i , k ; / * I N D E X V A R I A B L E S * / i n t j ; / * W I R I N G L E V E L * / i n t l e a s t [ 2 ] ; / * L E F T M O S T P O I N T O F W I R E * / i n t m o s t [ 2 ] ; / * R I G H T M O S T P O I N T O F W I R E * / i n t X C [ 3 ] , y c [ 3 ] ; / * W I R I N G C E N T R E C O - O R D S * / / * I N I T I A L I Z E T H E W I R I N G L E V E L S * / y c [ l ] = U ; / * C O N N E C T T H E O P - A M P O U T P U T N O D E S * / f o r ( i = l + s t a r t ; t a b l e [ 2 ] [ i ] [ 0 ] ! = E O W ; i + = 2 ) 1 8 9 } / * I N I T I A L I Z E T H E W I R E B O U N D S * / { l e a s t [ 0 ] = 3 * ( t o t a l + l ) ; m o s t [ 0 ] = 0 ; / * C H E C K E A C H C A P F O R T H E N O D E * / f o r ( j = 0 ; j < = t o t a l ; j + + ) { x c [ 0 ] = ( c a p a c [ j ] . n o r [ 0 ] + E D G E / 2 ) * U ; / * C H E C K T H E F I R S T N O D E * / i f ( c a p a c [ j ] . t y p = = l S ' && s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ j ] . s e c [ 0 ] ) ) i f ( c a p a c [ j ] . s w t c h = = t h e o n e ) { i f ( 3 * j + K l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j + l ; l e a s t [ l ] = x c [ 0 ] ; } e l s e i f ( 3 * j + l > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j + l ; m o s t [ l ] = x c [ 0 ] ; } } i f ( m o s t [ 0 ] > l e a s t [ 0 ] ) { / * F I N D W I R E L E V E L A N D P L A C E W I R E * / j = w i r e s l o t ( l e a s t , m o s t ) ; y c [ 0 ] = ( - 5 * j - 3 ) * U ; W I R E ( f d t o , M l W , w , l e a s t [ 1 ] , y c [ 0 ] , m o s t [ l ] , y c [ 0 ] ) ; / * C O N N E C T T H E A P P R O P R I A T E C A P S * / f o r ( k = 0 ; k < = t o t a l ; k++) { x c [ 0 ] = ( c a p a c [ k ] . h o r [ 0 ] + E D G E / 2 ) * U ; / * C O N N E C T N O D E S * / i f ( c a p a c [ k ] . t y p = = ' S ' S S s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . s e c [ 0 ] ) ) i f ( c a p a c [ k ] . s w t c h = = t h e o n e ) / * P L A C E C O N T A C T S A N D C O N N E C T T H E M * / { m p 2 ( x c [ 0 ] , y c [ 0 ] , f d t o ) ; c a p a c [ k ] . n o r [ 2 ] = y c [ 0 ] / 1 0 ; W I R E ( f d t o , P 2 W , w , x c [ 0 ] , y c [ l ] , x c [ 0 ] , y c [ 0 ] ) /********************************************* /* */ / * W I R E 3 F U N C T I O N — C o n n e c t H i d d e n N o d e s * / / * V / * T h e w i r e 3 f u n c t i o n c o n n e c t s t h e h i d d e n n o d e s * / / * b e t w e e n i n t e g r a t i n g a n d s w i t c h e d c a p a c i t o r s . * / /* */ /********************************************************* w i r e 3 ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / 1 9 0 i n t i , k ; i n t j ; i n t l e a s t [ 2 ] ; i n t m o s t [ 2 ] ; i n t x c [ 3 ] , y c [ 3 ] / * I N D E X V A R I A B L E S * / / * W I R E L E V E L * / / * L E F T M O S T P O I N T O F W I R E * / / * R I G H T M O S T P O I N T O F W I R E * / / * W I R E C O N N E C T I O N P O I N T S * / / * I N I T I A L I Z E T H E W I R I N G L E V E L S * / y c [ l ] = U ; / * C O N N E C T T H E H I D D E N N O D E S * / f o r ( i = s t a r t ; t a b l e [ 2 ] [ i ] [ 0 ] ! = E O W ; i + = 2 ) / * I N I T I A L I Z E T H E W I R E B O U N D S * / { l e a s t [ 0 ] = 3 * ( t o t a l + l ) ; m o s t [ 0 ] = o ; / * C H E C K E V E R Y C A P A C I T O R * / f o r ( j = 0 ; j < = t o t a l ; j + + ) { x c [ l ] = ( c a p a c [ j ] . h o r [ 0 ] + E D G E / 2 ) * U ; x c [ 2 ] = x c [ l ] - 8 * U ; / * F I R S T N O D E O N S W I T C H E D C A P S * / i f ( c a p a c [ j ] . t y p = = , S l && s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ j ] . f s t [ 0 ] ) ) { i f ( 3 * j < l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j ; l e a s t [ l ] = x c [ 2 ] ; } e l s e i f ( 3 * j > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j ; m o s t [ l ] = x c [ 2 ] ; } } / * F I R S T N O D E ON I N T E G R A T I N G C A P S * / e l s e i f ( c a p a c [ j ] . t y p = = l I ' && s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ j ] . f s t [ 0 ] ) ) { i f ( 3 * j + K l e a s t [ 0 ] ) { l e a s t [ 0 ] = 3 * j + l ; l e a s t [ l ] = x c [ l ] ; } e l s e i f ( 3 * j + l > m o s t [ 0 ] ) { m o s t [ 0 ] = 3 * j + l ; m o s t [ l ] = x c [ l ] ; } } / * F I N D T H E W I R E L E V E L * / j = w i r e s l o t ( l e a s t , m o s t ) ; y c [ 0 ] = ( - 5 * j - 3 ) * U ; W I R E ( f d t o , M l W , w , l e a s t [ 1 ] , y c [ 0 ] , m o s t [ l ] , y c [ 0 ] ) ; / * C O N N E C T T H E C A P A C I T O R S T O T H E W I R E * / f o r ( k = 0 ; k < = t o t a l ; k++) { x c [ l ] = ( c a p a c [ k ] . h o r [ 0 ] + E D G E / 2 ) * U ; x c [ 2 ] = x c [ l ] - 8 * U ; / * F I R S T N O D E C O N N E C T I O N S O N L Y * / i f ( s a m e ( S t a b l e [ 2 ] [ i ] [ 0 ] , S c a p a c [ k ] . f s t [ 0 ] ) ) 1 9 1 / * C O N N E C T S W I T C H E D C A P S * / { i f ( c a p a c [ k ] . t y p = = , S ' ) / * P L A C E A N D C O N N E C T C O N T A C T S * / { m p ( x c [ 2 ] , y c [ 0 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ 2 ] , y c [ l ] , x c [ 2 ] , y c [ 0 ] ) / * P L A C E C O N T A C T S F O R I N T E G R A T I N G C A P S * / e l s e i f ( c a p a c [ k ] . t y p = = ' I ' ) c a p a c [ k ] . v e r [ l ] = y c [ 0 ] / 1 0 ; } } } } /it*********************************** / * * / / * S T R E A K F U N C T I O N — C o n n e c t t h e S w i t c h e s * / / * * / / * T h e s t r e a k f u n c t i o n p l a c e s a n d c o n n e c t s t h e * / / * s w i t c h e s t o t h e p r e v i o u s w i r i n g . * / /* */ /*************************************** s t r e a k ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / ( i n t i ; / * I N D E X V A R I A B L E * / i n t x c , x m , x p ; / * H O R I Z . W I R I N G P O I N T S * / i n t y c [ 8 ] ; / * V E R T I C A L W I R I N G L E V E L S * / y c [ 0 ] = l e v e l [ 1 ] ; / * T O P O F S W I T C H * / y c [ l ] = U ; / * C O N T A C T F O R C A P A C I T O R * / y c [ 3 ] = l e v e l [ 1 ] - 1 6 * U ; / * B O T T O M O F S W I T C H * / y c [ 4 ] = l e v e l [ l ] - 3 3 * U ; / * G R O U N D L I N E * / y c [ 2 ] = l e v e l [ 1 ] + 1 2 * U ; / * T O P C O N N E C T I O N L E V E L * / / * P L A C E A N D C O N N E C T T H E S W I T C H E S * / f o r ( i = 0 ; i < = t o t a l ; i + + ) / * I N I T I A L I Z E T H E C O N N E C T I O N P O I N T S * / { x c = ( c a p a c [ i ] . h o r [ 0 ] + E D G E / 2 ) * U ; xm = x c - 8 * U ; x p = x c + 8 * U ; y c [ 5 ] = 1 0 * c a p a c [ i ] . v e r [ l ] y c [ 6 ] = 1 0 * c a p a c [ i ] . v e r [ 2 ] y c [ 7 ] = 1 0 * c a p a c [ i ] . h o r [ 2 ] / * S W I T C H E D C A P A C I T O R * / i f ( c a p a c [ i ] . t y p == ' S ' ) ( i f ( c a p a c [ i ] . u s e d = = l ) 192 > { s w i t c h p l a c e ( x c , l e v e l [ 1 ] , i , f d t o ) ; W I R E ( f d t o , M l W , w , x m , y c [ 3 ] , x m , y c [ 4 ] ) ; i f ( y c [ 7 ] = = l e v e l [ l ] + 1 7 * U ) { W I R E ( f d t o , P 2 W , w , x c , y c [ l ] , x c , y c [ 7 ] ) ; W I R E ( f d t o , M l W , w , x c , y c [ 7 ] , x c , y c [ 0 ] ) ; } e l s e ( m p 2 ( x c , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , P 2 W , w , x c , y c [ l ] , x c , y c [ 2 ] ) ; W I R E ( f d t o , M l W , w , x c , y c [ 2 ] , x c , y c [ 0 ] ) ; ) } i f ( c a p a c [ i ] . f l a g && c a p a c [ i ] . u s e d ) { i f ( y c [ 5 ] ! = y c [ 2 ] + 5 * U ) ( m p ( x p , y c [ 5 ] , f d t o ) ; m p ( x p , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x p , y c [ 2 ] , x p , y c [ 0 ] ) ; W I R E ( f d t o , P l W , w , x p , y c [ 5 ] , x p , y c [ 2 ] ) ; ) e l s e W I R E ( f d t o , M l W , w , x p , y c [ 5 ] , x p , y c [ 0 ] ) ; ) } / * INTEGRATING CAPACITOR * / e l s e i f ( c a p a c [ i ] . t y p = = ' I ' ) { s w i t c h p l a c e ( x c , l e v e l [ 1 ] , i , f d t o ) ; W I R E ( f d t o , M l W , w , x p , y c [ 3 ] , x p , y c [ 4 ] ) ; i f ( y c [ 5 ] ! = y c [ 2 ] + 5 * U ) { m p ( x c , y c [ 5 ] , f d t o ) ; m p ( x c , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c , y c [ 2 ] , x c , y c [ 0 ] ) ; W I R E ( f d t o , P l w , w , x c , y c [ 5 ] , x c , y c [ 2 ] ) ; ) e l s e W I R E ( f d t o , M l W , w , x c , y c [ 5 ] , x c , y c [ 0 ] ) ; m p 2 ( x m , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x m , y c [ 2 ] , x m , y c [ 0 ] ) ; i f ( y c [ 6 ] = = ( - 1 0 ) ) W I R E ( f d t o , P 2 W , w , x m , y c [ l ] , x m , y c [ 2 ] ) ; e l s e W I R E ( f d t o , P 2 W , w , x n i , y c [ 6 ] , x m , y c [ 2 ] ) ; ) ) /************************************************* /* */ / * PREOP FUNCTION — I n i t i a l i z e OP-AMP D a t a * / /* */ / * T h e p r e o p f u n c t i o n i n i t i a l i z e s t h e op -amp d a t a * / / * a n d d e c i d e s w h e r e t h e op - amps a r e t o b e c o n n e c t e d t o * / / * t h e s w i t c h e s . I t a l s o d e c i d e s w h i c h o p - a m p s t o m i r r o r . * / / * V / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / 1 9 3 p r e o p ( f d t o ) F I L E * f d t o ; /* O U T P U T F I L E * / { i n t l e n g t h ; /* L E N G T H O F C A P A R R A Y * / i n t g a p ; /* G A P B E T W E E N O P - A M P S * / i n t c l o c k ; /* S C C L O C K * / i n t s t o x ; /* I N D E X * / i n t f l a g ; /* F O U N D F L A G * / i n t c o u n t ; /* N U M B E R O F S C ' S F O R C O N N E C T I O N * / i n t m i d d l e ; /* M I D P O I N T O F O P - A M P C O N N E C T S * / i n t m a s t e r ; /* C L O S E S T S C C O N T A C T * / i n t s t o r e ; /* S C C O N N E C T I O N P O I N T * / i n t /* I N D E X V A R I A B L E S * / i n t x ; /* O P - A M P P L A C E M E N T P O I N T * / f l o a t g a p 2 ; /* R E Q U I R E D G A P B E T W E E N O P - A M P S * / f l o a t i n c ; /* G A P I N C R E M E N T * / / * F I N D A N Y E X T R A S P A C I N G R E Q U I R E D B E T W E E N T H E O P - A M P S * / l e n g t h = c a p a c [ t o t a l ] . h o r [ 0 ] + c a p a c [ t o t a l ] . n e x t * E D G E + 4 ; i n c = ( l e n g t h - s t a g e s * o p a m p . w i d t h ) / ( s t a g e s - 1) ; i f ( i n c < 0) i n c = 0 ; / * I N I T I A L I Z E T H E P L A C E M E N T * / X = - 1 ; g a p = 0 ; g a p 2 = 0 . 0 ; / * I N I T I A L I Z E T H E I N P U T S T A G E O P - A M P F O R S E D R A * / i f ( s t a r t = = 2 ) { w h i p [ 0 ] . o u t = x + o p a m p . c o n [ 0 ] ; w h i p [ 1 ] . o u t = x + o p a m p . c o n [ 2 ] ; w h i p [ 0 ] . c a p = ( c a p a c [ 1 ] . h o r [ 0 ] + E D G E / 2 ) * U ; w h i p [ l ] . c a p = ( c a p a c [ 2 ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; w h i p [ 0 ] . b a s e = x ; w h i p [ 0 ] . g n d = x + o p a m p . c o n [ l ] ; w h i p [ 0 ] . m i r r o r = 0 ; x = x + o p a m p . w i d t h + i n c ; } / * P R O C E S S T H E R E S T O F T H E F I L T E R * / f o r ( i = s t a r t ; i < s t a g e s + s t a g e s ; i + + ) { w h i p [ i ] . b a s e = x ; / * O P - A M P I N P U T N O D E * / i f ( ! ( i % 2 ) ) / * L O O K F O R A N I N T E G R A T I N G C A P A C I T O R * / { f o r ( j = l ; j < = t o t a l ; j + + ) i f ( c a p a c [ j ] . t y p = = ' 1 1 && 1 9 4 s a m e ( & c a p a c [ j ] . f s t [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ) { w h i p [ i ] . c a p = c a p a c [ j ] . h o r [ 0 ] + E D G E / 2 - 8 ; w h i p [ i ] . o u t = x + o p a m p . c o n [ 0 ] ; w h i p [ i ] . g n d = x + o p a m p . c o n [ 1 ] ; } } / * O P - A M P O U T P U T N O D E * / e l s e { m a s t e r = 2 0 0 0 0 ; w h i p [ i ] , o u t = x + o p a m p . c o n [ 2 ] ; w h i p [ i ] . g n d = x + o p a m p . c o n [ l ] ; m i d d l e = ( w h i p [ i ] . o u t + w h i p [ i - 1 ] . o u t ) / 2 ; / * P I C K C L O S E S T S C C O N N E C T I O N P O I N T * / f o r ( j = l ; j < = t o t a l ; j ++ ) i f ( c a p a c [ j ] . t y p = = ' S 1 && s a m e ( S c a p a c [ j ] . s e c [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ) { s t o r e = a b s ( m i d d l e - ( c a p a c [ j ] . h o r [ 0 ] + E D G E / 2 + 8 ) ) i f ( s t o r e < m a s t e r ) { w h i p [ i ] . c a p = ( c a p a c [ j ] . h o r [ 0 ] + E D G E / 2 + 8 ) ; c l o c k = c a p a c [ j ] . s w t c h ; s t o x = j ; m a s t e r = s t o r e ; } ) / * P I C K R E V E R S E C L O C K I N G S C * / f l a g = 1 ; c a p a c [ s t o x ] . u s e d = 1 ; f o r ( j = l ; j < = t o t a l && f l a g ; j + + ) i f ( c a p a c [ j ] . t y p = = ' S • && s a m e ( S c a p a c [ j ] . s e c [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ) i f ( c a p a c [ j ] . s w t c h ! = c l o c k ) ( c a p a c [ j ] . u s e d = 1 ; f l a g = 0 ; } / * M I R R O R O P - A M P I F N E C C E S S A R Y * / i f ( t u r n ( i - 1 ) ) ( w h i p [ i - l ] . o u t = w h i p [ i - l ] . o u t + o p a m p . w i d t h - 2 * o p a w h i p [ i ] . o u t = w h i p [ i ] . o u t + o p a m p . w i d t h - 2 * o p a m p . c w h i p [ i - l ] . g n d = w h i p [ i - l ] . g n d + o p a m p . w i d t h - 2 * o p a w h i p [ i - 1 ] . m i r r o r = 1 ; } / * I N C R E M E N T T H E P L A C E M E N T * / g a p 2 = g a p 2 + i n c - g a p ; g a p = g a p 2 ; x = x + o p a m p . w i d t h + g a p ; } } > /******************************************************* /* */ / * W I R E 5 F U N C T I O N — C o n n e c t O p - A m p I n p u t s / O u t p u t s * / /* */ / * T h e w i r e 5 f u n c t i o n c o n n e c t s t h e - i n p u t s a n d t h e * / 1 9 5 w i r e 5 ( f d t o ) F I L E * f d t o /* O U T P U T F I L E * / { i n t y c 2 , y c 3 , y c 4 , y c 5 ; i n t x a , x b , x c , a , b ; i n t d i r ; i n t a d j ; i n t f l a g , f 2 ; i n t i , j , m ; i n t k ; /* /* /* /* /* /* /* V E R T I C A L C O N N E C T S * / H O R I Z O N T A L C O N N E C T S * / C O N N E C T I O N D I R E C T I O N * / C A P C O N T A C T A D J U S T * / W I R I N G P L A C E M E N T F L A G S * / I N D E X V A R I A B L E S * / W I R I N G L E V E L * / / * E M P T Y T H E W I R I N G G R I D * / f o r ( i = 0 ; i < 5 ; i ++ ) f o r ( j = 0 ; j < 5 0 0 0 ; j + + ) p a t h 2 [ i ] [ j ] = 0 ; / * I N I T I A L I Z E T H E V E R T I C A L C O N N E C T I O N L E V E L S * / y c 2 = l e v e l [ 1 ] - 3 3 * U ; y c 3 = l e v e l [ 1 ] - 2 7 * U ; y c 4 = l e v e l [ 1 ] - 1 8 * U ; l e v e l [ 6 ] = 0 ; / * P R O C E S S O N E O P - A M P C O N N E C T I O N A T A T I M E * / f o r ( i = s t a r t ; i < s t a g e s + s t a g e s ; i ++ ) / * S T O R E T H E C O N N E C T I O N P O I N T S * / ( x a = w h i p [ i ] . o u t * U ; x b = w h i p [ i ] . c a p * U ; / * A D J U S T M E N T D I S T A N C E F O R C A P C O N T A C T S * / a d j = ( ( i % 2 ) ? - 1 2 : 1 2 ) ; / * F I N D L E F T A N D R I G H T C O N N E C T I O N P O I N T S * / i f ( w h i p [ i ] . o u t > w h i p [ i ] . c a p ) ( a = w h i p [ i ] . c a p ; b = w h i p [ i ] . o u t ; d i r = - 1 ; } e l s e ( a - w h i p [ i ] . o u t ; b = w h i p [ i ] . c a p ; d i r = 1 ; } / * S E E I F W I R E C A N B E DRAWN B E L O W T H E S W I T C H E S * / f l a g = 1 ; f o r ( j = s t a r t ; j < s t a g e s + s t a g e s ; j + + ) { i f ( i ! = j && w h i p [ j ] . c a p > a - 5 && w h i p [ j ] . c a p < b+5 ) f l a g = 0 / * S E E I F NO O T H E R W I R E I S T H E R E * / 1 9 6 i f ( f l a g ) f o r ( k = a - 3 ; k < = b + 3 ; k++) i f ( p a t h 2 [ 0 ] [ k ] ! = 0 ) f l a g = 0 ; / * P L A C E W I R E B E L O W T H E S W I T C H E S * / i f ( f l a g ) / * O N L Y DRAW H O R I Z O N T A L W I R E I F N E C C E S S A R Y * / { i f ( a b s ( x a - x b ) > 2 * U ) W I R E ( f d t o , P l W , w , x a , y c 3 , x b , y c 3 ) ; / * P L A C E C O N T A C T O N T H E S W I T C H * / m p ( x b , y c 3 , f d t o ) ; W I R E ( f d t o , M l W , w , x b , y c 3 , x b , y c 4 ) ; / * F I L L T H E G R I D * / f o r ( k = a ; k < = b ; k++) p a t h 2 [ 0 ] [ k ] = 1 ; / * S A V E W I R E P A R A M E T E R S F O R O P - A M P C O N N E C T I O N * / w h i p [ i ] . c r o s s = w h i p [ i ] , o u t ; w h i p [ i ] . l e v e l = y c 3 ; } / * DRAW T H E W I R E B E L O W T H E V S S L I N E * / e l s e { w h i p [ i ] . c r o s s = w h i p [ i ] . c a p ; / * D E C I D E I F T H E C R O S S I N G P O I N T S H O U L D B E M O V E D * / f o r ( k = s t a r t ; k < s t a g e s + s t a g e s ; k++) i f ( a b s ( w h i p [ i ] . c a p - w h i p [ k ] . g n d ) < 5 | | a b s ( w h i p [ i ] . c a p - w h i p [ k ] . o u t ) < 5 ) w h i p [ i ] . c r o s s = w h i p [ i ] . c a p + a d j ; / * F I N D L E F T A N D R I G H T P O I N T S * / i f ( w h i p [ i ] . c r o s s > w h i p [ i ] . o u t ) { a = w h i p [ i ] . o u t ; b = w h i p [ i ] . c r o s s ; } e l s e { a = w h i p [ i ] . c r o s s ; b = w h i p [ i ] . o u t ; } / * F I N D A W I R E S L O T * / f 2 = 1 ; f o r ( k = l ; f 2 ; k++) { f l a g = 1 ; f o r ( m = a - 3 ; m < = b + 3 ; m++) i f ( p a t h 2 [ k ] [ m ] ! = 0 ) f l a g = 0 ; i f ( f l a g ) f 2 = 0 ; } k — ; / * C A L C U L A T E T H E W I R E L E V E L * / y c 5 = l e v e l [ 1 ] - ( 4 5 + 6 * ( k - 1 ) ) * U ; 1 9 7 } i f ( k - l > l e v e l [ 6 ] ) l e v e l [ 6 ] = k - 1 ; / * F I L L T H E G R I D * / f o r ( m = a - 2 ; m<=b+2; m++) p a t h 2 [ k ] [ m ] = 1 ; / * I F NO A D J U S T M E N T * / i f ( w h i p [ i ] . c r o s s = = w h i p [ i ] . c a p ) / * P L A C E S W I T C H C O N T A C T A N D C R O S S B U S L I N E S * / { m p ( x b , y c 3 , f d t o ) ; W I R E ( f d t o , M 1 W , w , x b , y c 3 , x b , y c 4 ) ; W I R E ^ f d t O j P l W ^ x b j y c S j X ^ y c S ) ; x c - x a ; } / * W I R E C R O S S I N G H A S B E E N M O V E D * / e l s e { x a = w h i p [ i ] , c a p * U ; x b = w h i p [ i ] . c r o s s * U ; x c = w h i p [ i ] . o u t * U ; / * C O N N E C T S W I T C H A N D W I R E I T * / m p ( x a , y c 3 , f d t o ) ; W I R E ( f d t o , M l W , w , x a , y c 3 , x a , y c 4 ) ; W I R E ( f d t o , P l W , w , x b , y c 5 , x b , y c 3 ) ; W I R E ( f d t o , P l W , w , x a , y c 3 , x b , y c 3 ) ; } / * P L A C E M E T A L W I R E W I T H C O N T A C T S I F R E Q U I R E D * / i f ( a b s ( x c - x b ) > 6 * U ) { m p ( x b , y c 5 , f d t o ) ; m p ( x c , y c 5 , f d t o ) ; W I R E ( f d t o , M l W / w , x b , y c 5 , x c , y c 5 ) ; } / * OR DRAW A S H O R T P O L Y L I N K I N G W I R E * / e l s e W I R E ( f d t o , P l W , w , x b , y c 5 , x c , y c 5 ) ; / * S A V E W I R I N G P A R A M E T E R S F O R O P - A M P C O N N E C T I O N * / w h i p [ i ] . l e v e l = y c 5 ; } } /************************************ /* */ / * W I R E 6 F U N C T I O N — W i r e t h e G r o u n d C o n n e c t i o n s * / /* */ / * T h e w i r e 6 f u n c t i o n c o n n e c t s t h e + i n p u t o f t h e * / / * o p - a m p s t o t h e g r o u n d w i r e . I t w i l l c u r v e a r o u n d a n y * / / * o b s t a c l e s . * / /* */ /************************************* w i r e 6 ( f d t o ) 1 9 8 F I L E * f d t O / * O U T P U T F I L E * / { i n t y c [ 6 ] ; i n t x a , x b , x b 2 , a , b ; i n t d i r ; i n t f l a g ; i n t j ; i n t i , k , m ; / * V E R T I C A L C O N N E C T S * / / * H O R I Z O N T A L C O N N E C T S * / / * W I R I N G D I R E C T I O N * / / * W I R I N G F L A G * / / * W I R I N G L E V E L * / / * I N D E X V A R I A B L E S * / / * I N I T I A L I Z E T H E V E R T I C A L C O N N E C T L E V E L S * / y c [ 2 ] = l e v e l [ l ] - 3 3 * U ; y c [ 3 ] = l e v e l [ l ] - 2 7 * U ; y c [ 4 ] = l e v e l [ 1 ] - 1 8 * U ; / * S E T T H E S E D R A C R O S S I N G P O I N T S F O R T H E F I R S T O P - A M P * / i f ( s t a r t = = 2 ) { w h i p [ 0 ] . c r o s s = c a p a c [ 2 ] . h o r [ 0 ] + E D G E / 2 + 8 ; w h i p [ 1 ] . c r o s s = c a p a c [ 2 ] , h o r [ 0 ] + E D G E / 2 + 8 ; w h i p [ 0 ] . g n d c r o s s = o p a m p . c o n [ l ] - 1 ; } / * P R O C E S S O N E G R O U N D C O N N E C T I O N A T A T I M E * / f o r ( i = s t a r t / 2 ; i < s t a g e s ; i + + ) / * F I N D W I R E D I R E C T I O N * / { d i r = ( ( w h i p [ 2 * i ] . g n d < w h i p [ 2 * i ] . o u t ) ? - 1 : 1) ; / * T R Y T O W I R E T H E G R O U N D C O N N E C T I O N * / f l a g = 1 ; f o r ( k = 0 ; f l a g ; k = k + d i r ) { f l a g = 0 ; / * L O O K F O R A N Y O B S T A C L E S * / f o r ( j = s t a r t ; j < s t a g e s + s t a g e s ; j + + ) { i f ( w h i p [ j ] . l e v e l ! = y c [ 3 ] ) i f ( a b s ( w h i p [ 2 * i ] , g n d + k - w h i p [ j ] . c r o s s ) < 5) / * F I N A L C R O S S I N G P O I N T * / x b = w h i p [ 2 * i ] . g n d * U ; k = k - d i r ; w h i p [ 2 * i ] . g n d c r o s s = w h i p [ 2 * i ] . g n d + k ; / * P L A C E T H E D I S P L A C E D W I R E * / i f ( k ! = 0 ) { x b 2 = x b + k * U ; / * F I N D L E F T A N D R I G H T P O I N T S * / i f ( k > 0) { a = w h i p [ 2 * i ] . g n d ; b = a + k ; ) f l a g = 1 1 9 9 } e l s e { b = w h i p [ 2 * i ] . g n d ; a = b + k ; } / * C H E C K F O R S P A C E I N T H E G R I D * / f l a g = 1 ; f o r ( m = a - 2 ; m < = b + 2 ; m++) i f ( p a t h 2 [ l e v e l [ 6 ] ] [ m ] ! = 0 ) f l a g = 0 ; / * M O V E T O L O W E S T L E V E L I F N E C C E S S A R Y * / i f ( ! f l a g ) l e v e l [ 6 ] += 1 ; / * C A L C U L A T E W I R I N G L E V E L * / y c [ 5 ] = l e v e l [ 1 ] - ( 4 5 + 6 * l e v e l [ 6 ] ) * U ; w h i p [ 2 * i ] . g n d l e v e l = y c [ 5 ] ; / * C O N N E C T T H E G R O U N D W I R E T O T H E I N P U T * / m p ( x b 2 , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x b 2 , y c [ 5 ] , x b 2 , y c [ 2 ] ) ; W I R E ( f d t o , P l W , w , x b , y c [ 5 ] , x b 2 , y c [ 5 ] ) ; } / * DRAW S T R A I G H T W I R E A N D C O N T A C T O T H E R W I S E * / e l s e { m p ( x b , y c [ 2 ] , f d t o ) ; w h i p [ 2 * i ] . g n d l e v e l = y c [ 2 ] ; } } /***********************************************************/ / * * / / * A M P S O N F U N C T I O N — I n s e r t t h e O p - A m p s * / / * * / / * T h e a m p s o n f u n c t i o n p l a c e s a n d c o n n e c t s t h e o p - a m p s * / / * t o t h e p r e v i o u s l y p l a c e d w i r e s . * / /* */ /************************************** a m p s o n ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / { i n t i ; / * I N D E X V A R I A B L E * / i n t y c [ 2 ] ; / * V E R T I C A L C O N N E C T S * / i n t x a ; / * H O R I Z O N T A L C O N N E C T S * / c h a r * n o r m ; / * C E L L P L A C E M E N T COMMAND * / / * I N I T I A L I Z E T H E W I R I N G L E V E L S * / y c [ 0 ] = l e v e l [ 1 ] - ( 4 9 + 6 * l e v e l [ 6 ] + o p a m p . l e v e l ) * U ; y c [ l ] = y c [ 0 ] + o p a m p . l e v e l * U ; l e v e l [ 2 ] = y c [ 0 ] ; / * C O N N E C T T H E - I N P U T S A N D O U T P U T S * / f o r ( i = s t a r t ; i < s t a g e s + s t a g e s ; i + + ) 2 0 0 { x a = w h i p [ i ] . o u t * U ; W I R E ( f d t o , P 1 W , w , x a , y c [ 1 ] , x a , w h i p [ i ] . l e v e l ) ; ) / * P L A C E T H E O P - A M P S * / f o r ( i = 0 ; i < s t a g e s ; i + + ) / * C O N N E C T T H E + I N P U T S * / { i f ( i > = s t a r t / 2 ) ( x a = w h i p [ 2 * i ] . g n d * U ; W I R E ( f d t o , P l W , w , x a , y c [ l ] , x a , w h i p [ 2 * i ] . g n d l e v e l ) ; ) / * M I R R O R E D O P - A M P * / i f ( J w h i p [ 2 * i ] . m i r r o r ) ( x a = ( w h i p [ 2 * i ] . b a s e - o p a m p . x o r g ) * U ; n o r m = " C 2 T " ; } / * N O R M A L O P - A M P * / e l s e { x a = ( w h i p [ 2 * i ] . b a s e + o p a m p . w i d t h + o p a m p . x o r g ) * U ; n o r m = " C 2 MX T 1 1 ; ) / * P L A C E T H E O P - A M P * / c e l l p l a c e ( f d t o , n o r m , x a , y c [ 0 ] ) ; } /***********************************************************/ /* */ / * W R A P U P F U N C T I O N — L a y o u t G l o b a l F e a t u r e s * / /* */ / * T h e w r a p u p f u n c t i o n p l a c e s t h e p - w e l l s , t h e c l o c k s , * / / * t h e b u s l i n e s , a n d t h e s u b s t r a t e c o n t a c t s . * / /* */ /************************************* w r a p u p ( f d t o ) F I L E * f d t o / * O U T P U T F I L E * / { i n t i , j ; i n t w l ; i n t x a , x b ; i n t y c l , y c 2 ; i n t x c , y c ; i n t x e d g e , y e d g e / * I N D E X V A R I A B L E S * / / * W I R E W I D T H * / / * H O R I Z O N T A L C O N N E C T S * / / * V E R T I C A L C O N N E C T S * / / * B O X C E N T R E * / / * B O X E D G E S * / / * S U B S T R A T E C O N T A C T C H E C K S * / / * S U B S T R A T E C O N T A C T P L A C E M E N T * / / * H O R I Z O N T A L L A Y O U T B O U N D S * / i n t h [ 3 ] ; i n t f l a g ; i n t x l , x r ; / * S E T T H E H O R I Z O N T A L B O U N D S O F T H E L A Y O U T * / X l = - 5 * U ; x a = ( c a p a c [ t o t a l ] . h o r [ 0 ] + c a p a c [ t o t a l ] . n e x t * E D G E ) * U ; i f ( x a + 2 * U > ( w h i p [ 2 * s t a g e s - 2 ] . b a s e + o p a m p . w i d t h ) * U ) x r = x a + 6 * U ; e l s e x r = ( w h i p [ 2 * s t a g e s - 2 ] . b a s e + o p a m p . w i d t h + 4 ) * U / * P L A C E T H E O U T P U T C O N T A C T * / i f ( x a < x r - 8 * U ) W I R E ( f d t o , M l W , w , x a , l e v e l [ 9 ] , x r - 8 * U , l e v e l [ 9 ] ) ; W I R E ( f d t o , P l W , w , x r - 8 * U , l e v e l [ 9 ] , x r + 6 * U , l e v e l [ 9 ] ) ; m p ( x r + 6 * U , l e v e l [ 9 ] , f d t o ) ; m p ( x r - 8 * U , l e v e l [ 9 ] , f d t o ) ; / * C O N N E C T C L 0 C K 1 L I N E * / y c = l e v e l [ 1 ] + 6 * U ; W I R E ( f d t o , P 1 W , w , x l , y c , x r + 6 * U , y c ) ; m p ( x r + 6 * U , y c - U , f d t o ) ; m p ( x l , y c - U , f d t o ) ; / * C O N N E C T C L 0 C K 2 L I N E * / y c = l e v e l [ 1 ] - 6 * U ; W I R E ( f d t o , P 1 W , w , x l , y c , x r + 6 * U , y c ) ; m p ( x r + 6 * U , y c + U , f d t o ) ; m p ( x l , y c + U , f d t o ) ; / * C O N N E C T C L O C K 3 L I N E * / y c = l e v e l [ 1 ] - 1 0 * U ; W I R E ( f d t o , P 1 W , w , x l , y c , x r + 6 * U , y c ) ; m p ( x r + 6 * U , y c - U , f d t o ) ; m p ( x l , y c - U , f d t o ) ; / * C O N N E C T C L 0 C K 4 L I N E * / y c = l e v e l [ 1 ] - 2 2 * U ; W I R E ( f d t o , P 1 W , w , x l , y c , x r + 6 * U , y c ) ; m p ( x r + 6 * U , y c + u , f d t o ) ; m p ( x l , y c + U , f d t o ) ; / * P L A C E T H E G R O U N D L I N E * / y c = l e v e l [ 1 ] - 3 3 * U ; W I R E ( f d t o , M 1 W , 2 * w , x l + 6 * U , y c , x r , y c ) ; / * P L A C E T H E V S S L I N E * / y c = l e v e l [ 1 ] - 3 9 * U ; W I R E ( f d t o , M 1 W , 2 * w , x l + 6 * U , y c , x r , y c ) ; / * P L A C E T H E O P - A M P V S S L I N E * / y c = l e v e l [ 2 ] + o p a m p . v o s [ 0 ] * U ; w l = o p a m p . w i d [ 0 ] * U ; W I R E ( f d t o , M 1 W , w l , x l + 4 * U + w l / 2 , y c , x r - w l / 2 , y c ) ; / * P L A C E T H E O P - A M P B I A S L I N E * / y c = l e v e l [ 2 ] + o p a m p . v o s [ 1 ] * U ; w l = o p a m p . w i d [ l ] * U ; W I R E ( f d t o , M 1 W , w l , x l + 4 * U + w 1 / 2 , y c , x r - 4 * U - w l / 2 , y c ) ; / * P L A C E T H E O P - A M P V D D L I N E * / y c = l e v e l [ 2 ] + o p a m p . v o s [ 2 ] * U ; w l = o p a m p . w i d [ 2 ] * U ; W I R E ( f d t o , M 1 W , w l , x l + 4 * U + w l / 2 , y c , x r - 4 * U - w l / 2 , y c ) ; / * P L A C E T H E S W I T C H P - W E L L * / x c = ( x l + x r ) / 2 ; x e d g e = x r - x l - 8 * U ; y c = l e v e l [ 1 ] - 5 5 * U / 2 ; B O X ( f d t o , P W B , x e d g e , 3 1 * U , x c , y c ) ; / * P L A C E T H E N+ * / y c = l e v e l [ 1 ] - 1 6 * U ; B O X ( f d t o , N P B , x e d g e , 8 * U , x c , y c ) ; / * P L A C E T H E P+ * / y c = l e v e l [ 1 ] ; B O X ( f d t o , P P B , x e d g e , 8 * U , x c , y c ) ; / * P L A C E T H E P - W E L L F O R T H E C A P S * / x e d g e = x r - x l + 6 * U ; y e d g e = l e v e l [ 0 ] - l e v e l [ 1 ] + ( E D G E / 2 + 1 ) * U ; y c = ( l e v e l [ 0 ] + ( 1 7 + E D G E / 2 ) * U + l e v e l [ 1 ] ) / 2 ; B O X ( f d t o , P W B , x e d g e , y e d g e , x c + U , y c ) ; / * I N I T I A L I Z E T H E V E R T I C A L L E V E L S F O R T H E S U B C O N T A C T S y c = l e v e l [ 3 ] + 6 * U ; y c l = l e v e l [ 0 ] + ( 5 + E D G E / 2 ) * U ; y c 2 = l e v e l [ 2 ] + o p a m p . v o s [ 0 ] * U ; / * P L A C E G R O U N D W I R E S A N D S U B C O N T A C T S F O R C A P P - W E L L W I R E ( f d t o , M 1 W , 2 * w , x l + 2 * U , y c , x l + 2 * U , y c l ) ; W I R E ( f d t o , M l W , 2 * w , x r , y c 2 , x r , l e v e l [ l ] - 3 9 * U ) ; W I R E ( f d t o , M l W , 2 * w , x r , l e v e l [ l ] - 3 3 * U , x r , y c l ) ; f o r ( i = 0 ; i * 4 0 * U < = y c l - y c ; i + + ) { m p s ( x l + 2 * U , y c + i * 4 0 * U , f d t o ) ; m p s ( x r , y c + i * 4 0 * U , f d t o ) ; } W I R E ( f d t o , M 1 W , 2 * w , x l + 2 * U , y c l , x r , y c l ) ; f o r ( i = 0 ; x l + ( 1 5 + i * 4 0 ) * U < = x r - 1 5 * U ; i + + ) m p s ( x l + ( 1 5 + i * 4 0 ) * U , y c l , f d t o ) ; / * P L A C E T H E S U B C O N T A C T S B E L O W T H E C A P S * / f o r ( i = l ; i < = t o t a l ; i ++ ) { i f ( c a p a c [ i ] . t y p = = ' C ) { x c = ( c a p a c [ i ] . h o r [ 0 ] + E D G E / 2 ) * U ; 2 0 3 > m p s ( x c , l e v e l [ 1 ] + 1 2 * U , f d t o ) ; W I R E ( f d t o , M l W , w , x c , l e v e l [ l ] + 1 2 * U , x c , l e v e l [ 1 ] - 3 3 * U ) ; } i f ( c a p a c [ i ] . t y p = = ' S l && ! c a p a c [ i ] . u s e d ) { y c = 1 0 * c a p a c [ i ] . h o r [ 2 ] ; i f ( y c l = l e v e l [ l ] + 1 7 * U ) { x c = ( c a p a c [ i ] . h o r [ 0 ] + E D G E / 2 ) * U ; m p s ( x c , l e v e l [ 1 ] + 1 2 * U , f d t o ) ; W I R E ( f d t o , M 1 W , w , x c , l e v e l [ 1 ] + 1 2 * U , x c , l e v e l [ 1 ] - 3 3 *U) / * P L A C E T H E S U B C O N T A C T S A L O N G T H E V S S L I N E * / x c = x l + 8 * U ; y c = l e v e l [ 1 ] - 3 9 * U ; w h i l e ( x c < x r - 8 * U ) { f l a g = 1 ; f o r ( j = 0 ; j < s t a g e s ; j + + ) / * G E T T H E C R O S S I N G P O I N T S * / { h [ 0 ] = w h i p [ 2 * j ] . c r o s s * U ; h [ l ] = w h i p [ 2 * j + l ] . c r o s s * U ; h [ 2 ] - w h i p [ 2 * j ] , g n d c r o s s * U ; / * L O O K F O R A C R O S S I N G * / f o r ( i = 0 ; i < 3 ; i + + ) i f ( a b s ( h [ i ] - x c ) < 6 * U ) f l a g = 0 ; ) / * I F NO C R O S S I N G , P L A C E A C O N T A C T * / i f ( f l a g ) { m p s ( x c , y c , f d t o ) ; x c = x c + 4 0 * U ; } / * E L S E I N C R E M E N T T H E L O C A T I O N A N D T R Y A G A I N * / e l s e x c = x c + U ; } /***************************^ / * * / / * I N P U T 1 F U N C T I O N — H a r d - W i r e t h e I n p u t ( L E E ) * / / * * / / * T h e i n p u t 1 f u n c t i o n c o n n e c t s t h e i n p u t s w i t c h e d * / / * c a p a c i t o r t o t h e f i l t e r . * / /* */ /************************************* i n p u t 1 ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / { i n t X C [ 3 ] ; / * H O R I Z O N T A L C O N N E C T I O N S * / 2 0 4 } i n t y c [ 8 ] ; / * V E R T I C A L C O N N E C T I O N S * / o r [ 0 ] + E D G E / 2 ) * U ; / * F I R S T C A P * / o r [ 0 ] + E D G E / 2 ) * U ; / * S E C O N D C A P * / / * I N P U T N O D E * / / * C A P C O N T A C T * / / * S W I T C H T O P * / / * F I R S T W I R I N G L E V E L * / / * S E C O N D W I R I N G L E V E L * / 3 3 * U ; / * G R O U N D W I R E * / X C [ 0 ] = ( c a p a c [ l ] X C [ 1 ] = ( c a p a c [ 2 ] X C [ 2 ] — - 5 * U ; y c [ l ] = U ; y c [ 2 ] = - 1 3 * U ; y c [ 3 ] l e v e l [ 1 ] y c [ 4 ] = - 3 * U ; y c [ 5 ] = - 8 * U ; y c [ 6 ] = l e v e l [ 1 ] y c [ 7 ] = l e v e l [ 1 ] / * P L A C E T H E I N P U T S W I T C H A N D C O N N E C T I T T O T H E F I L T E R * / s w i t c h p l a c e ( x c [ l ] , y c [ 3 ] , c a p a c [ 2 ] . s w t c h , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ l ] + 8 * U , y c [ 3 ] , x c [ l ] + 8 * U , y c [ 4 ] ) ; / * C O N N E C T T H E S E C O N D C A P T O T H E S W I T C H * / m p 2 ( x c [ l ] , y c [ 7 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ l ] , y c [ 3 ] , x c [ l ] , y c [ 7 ] ) ; W I R E ( f d t o , P 2 W , w , x c [ l ] , y c [ l ] , x c [ l ] , y c [ 7 ] ) ; / * C O N N E C T T H E I N P U T N O D E * / m p ( x c [ 2 ] , y c [ 2 ] , f d t o ) ; m p ( x c [ l ] - 8 * U , y c [ 2 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ 2 ] , y c [ 2 ] , x c [ l ] - 8 * U , y c [ 2 ] ) ; W I R E ( f d t o , P l W , w , x c [ 0 ] - 8 * U , y c [ 2 ] , x c [ 0 ] - 8 * U , y c [ l ] ) ; W I R E ( f d t o , M l W , w , x c [ l ] - 8 * U , y c [ 2 ] , x c [ l ] - 8 * U , y c [ 3 ] ) ; / * G R O U N D T H E B O T T O M P L A T E O F T H E S E C O N D C A P * / m p ( x c [ 0 ] , y c [ 5 ] , f d t o ) ; W I R E ( f d t o , P l w , w , x c [ l ] - 8 * U , y c [ 5 ] , x c [ 0 ] , y c [ 5 ] ) ; W I R E ( f d t o , P l W , w , x c [ l ] - 8 * U , y c [ l ] , x c [ l ] - 8 * U , y c [ 5 ] ) ; W I R E ( f d t o , M l W , w , x c [ 0 ] , y c [ 5 ] , x c [ 0 ] , y c [ 6 ] ) ; /******************************************* / * * / / * I N P U T 2 F U N C T I O N — H a r d - W i r e t h e I n p u t ( M A R T I N ) * / / * V / * T h e i n p u t 2 f u n c t i o n c o n n e c t s t h e i n p u t n o d e t o t h e * / / * f i r s t s w i t c h e d c a p a c i t o r o f t h e f i l t e r . * / /* */ /********************************************** i n p u t 2 ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / 2 0 5 i n t x c l , x c 2 ; /* H O R I Z O N T A L C O N N E C T S * / i n t y c l , y c 2 ; /* V E R T I C A L C O N N E C T S * / x c l = - 5 * U ; /* I N P U T C O N N E C T I O N * / x c 2 = ( c a p a c [ l ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; /* F I R S T C A P * / y c l = l e v e l [ 1 ] ; /* S W I T C H L E V E L * / y c 2 = l e v e l [ 1 ] + 1 7 * U ; /* W I R E L E V E L * / } / * C O N N E C T T H E I N P U T N O D E T O T H E S W I T C H * / m p ( x c l , y c 2 , f d t o ) ; W I R E ( f d t o , M 1 W , w , x c 2 , y c l , x c 2 , y c 2 ) ; W I R E ( f d t o , M 1 W , w , x c l , y c 2 , x c 2 , y c 2 ) ; /***********************************************************/ / * * / / * I N P U T 3 F U N C T I O N — H a r d - W i r e t h e I n p u t ( S E D R A ) * / /* */ /*************************************** i n p u t 3 ( f d t o ) F I L E * f d t o ; ( i n t x c [ 1 5 ] i n t y c [ 1 5 ] / * O U T P U T F I L E * / / * H O R I Z O N T A L C O N N E C T S * / / * V E R T I C A L C O N N E C T S * / x c [ 0 ] = - 5 * U ; x c [ l ] = ( c a p a c [ l ] . h o r [ 0 ] + E D G E / 2 ) * U ; X C [ 2 ] = ( c a p a c [ 1 ] . h o r [ 0 ] + E D G E + E D G E / 2 ) * U • X C [ 3 ] = ( c a p a c [ 2 ] . h o r [ 0 ] + E D G E / 2 - 8 ) * U ; X C [ 4 ] • ( c a p a c [ 2 ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; X C [ 5 ] • ( c a p a c [ 3 ] . h o r [ 0 ] + E D G E / 2 + 8 ) * U ; X C [ 6 ] = ( c a p a c [ 4 ] . h o r [ 0 ] + E D G E / 2 - 8 ) * U ; x c [ 1 0 ] = = ( o p a m p . c o n [ 1 ] - 1 ) * U ; x c [ l l ] = • ( o p a m p . c o n [ 0 ] - 1 ) * U ; X C [ 1 2 ] = = ( o p a m p . c o n [ 2 ] - 1 ) * U ; y c [ 0 ] = U ; /* y c [ l ] = l e v e l [ 1 ] • /* y c [ 2 ] = l e v e l [ 1 ] - 1 6 * U ; /* y c [ 3 ] = l e v e l [ 1 ] - 3 3 * U ; /* y c [ 5 ] = - 3 * U ; /* y c [ 6 ] - - 8 * U ; /* y c [ 7 ] = - 1 3 * U ; /* y c [ 8 ] - l e v e l [ 1 ] + 1 7 * U ; y c [ l 0 ] = = l e v e l [ 2 ] + o p a m p . l e v e l * U ; y c [ l l ] = = l e v e l [ 1 ] - 2 7 * U ; y c [ 1 2 ] = = l e v e l [ 2 ] + ( o p a m p . l e v e l + 4 ) * U • 9 /* I N P U T N O D E */ /* F I R S T C A P */ /* E X T E N S I O N */ /* S E C O N D C A P */ /* S E C O N D C A P */ /* T H I R D C A P */ /* F O U R T H C A P */ /* + I N P U T * / /* - I N P U T * / /* O U T P U T * / P L A T E L E V E L * / T O P O F S W I T C H * / B O T T O M O F S W I T C H * / G R O U N D W I R E * / C A P C O N N E C T * / F I R S T W I R I N G L E V E L * S E C O N D W I R I N G L E V E L / * T O P W I R E L E V E L * / / * O P - A M P T O P * / / * G A P B E L O W S W I T C H / * C O N N E C T L E V E L * / 2 0 6 / * P L A C E E X T R A S W I T C H G R O U P A N D C O N N E C T I T * / s w i t c h p l a c e ( x c [ 2 ] , y c [ l ] , c a p a c [ 2 ] . s w t c h , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ 2 ] + 8 * U , y c [ 2 ] , x c [ 2 ] + 8 * U , y c [ 3 ] ) ; W I R E ( f d t o , M l W , w , x c [ 2 ] - 8 * U , y c [ 5 ] , x c [ 6 ] , y c [ 5 ] ) ; W I R E ( f d t o , M l W , w , x c [ 2 ] - 8 * U , y c [ 5 ] , x c [ 2 ] - 8 * U , y c [ l ] ) ; / * G R O U N D B O T T O M P L A T E O F I N P U T C A P A C I T O R * / m p ( x c [ l ] + 6 * U , y c [ 5 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ l ] + 6 * U , y c [ 0 ] , x c [ l ] + 6 * U , y c [ 5 ] ) ; W I R E ( f d t o , M l W , w , x c [ l ] + 6 * U , y c [ 5 ] , x c [ l ] + 6 * U , y c [ 3 ] ) ; / * C O N N E C T S E C O N D C A P T O E X T R A S W I T C H G R O U P * / m p ( x c [ 3 ] , y c [ 7 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ 3 ] , y c [ 0 ] , x c [ 3 ] , y c [ 7 ] ) ; W I R E ( f d t o , M l W , w , x c [ 2 ] , y c [ 7 ] , x c [ 3 ] , y c [ 7 ] ) j W I R E ( f d t o , M l W , w , x c [ 2 ] , y c [ 7 ] , x c [ 2 ] , y c [ l ] ) ; / * C O N N E C T S W I T C H G R O U P S * / w l R E ( f d t o , M l w , w , x c [ 5 ] , y c [ 8 ] , x c [ 5 ] , y c [ l ] ) ; W I R E ( f d t o , M l W , w , x c [ 4 ] , y c [ 8 ] , x c [ 4 ] , y c [ l ] ) ; W I R E ( f d t o , M l W , w , x c [ 4 ] , y c [ 8 ] , x c [ 5 ] , y c [ 8 ] ) ; / * C O N N E C T S E C O N D C A P T O I T S S W I T C H G R O U P * / m p 2 ( x c [ l ] , y c [ 5 ] , f d t o ) ; W I R E ( f d t o , P 2 W , w , x c [ l ] , y c [ 5 ] , x c [ l ] , y c [ 0 ] ) ; W I R E ( f d t o , M l W , w , x c [ l ] , y c [ 5 ] , x c [ l ] , y c [ l ] ) ; / * C O N N E C T I N P U T N O D E T O I N P U T S W I T C H * / m p ( x c [ 0 ] , y c [ 6 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ 0 ] , y c [ 6 ] , x c [ l ] - 8 * U , y c [ 6 ] ) ; W I R E ( f d t o , M l w , w , x c [ l ] - 8 * U , y c [ 6 ] , x c [ l ] - 8 * u , y c [ l ] ) ; / * P L A C E M E T A L - A C T I V E C O N T A C T S * / m a ( x c [ l ] - 8 * U , y c [ l ] , f d t o ) ; m a ( x c [ l ] , y c [ l ] , f d t o ) ; m a ( x c [ l ] - 8 * U , y c [ l ] - 1 6 * U , f d t o ) ; m a ( x c [ l ] , y c [ l ] - 1 6 * U , f d t o ) ; / * P L A C E M E T A L A N D A C T I V E A R E A S * / B O X ( f d t o , M l B , 2 * U , 1 2 * U , x c [ l ] - 8 * U , y c [ l ] - 8 * U ) ; B O X ( f d t o , M l B , 2 * U , 1 2 * U , x c [ l ] , y c [ l ] - 8 * U ) ; W I R E ( f d t o , A C W , w , x c [ l ] , y c [ l ] , x c [ l ] - 8 * U , y c [ l ] ) ; W I R E ( f d t o , A C W , w , x c [ l ] , y c [ l ] - 1 6 * U , x c [ l ] - 8 * U , y c [ l ] - 1 6 * U ) ; / * D E C I D E ON T H E C L O C K I N G S C H E M E * / i f ( c a p a c [ 1 ] , s w t c h = = l ) { y c [ 1 3 ] = l e v e l [ l ] + U ; y c [ 1 4 ] = l e v e l [ l ] - 1 7 * U ; ) e l s e { y c [ 1 3 ] = l e v e l [ l ] - U ; y c [ 1 4 ] = l e v e l [ l ] - 1 5 * U ; ) / * I N S E R T C L O C K S * / 2 0 7 B O X ( f d t o , P l B , 2 * U , 8 * U , X C [ l ] - 4 * U , y c [ 1 3 ] ) ; B O X ( f d t o , P l B , 2 * U , 8 * U , X C [ l ] - 4 * U , y c [ 1 4 ] ) ; / * C O N N E C T + I N P U T T O I N P U T S W I T C H * / m p ( x c [ l ] , y c [ l l ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ l ] , y c [ l l ] , x c [ l ] , y c [ 2 ] ) ; W I R E ( f d t o , P l W , w , x c [ l ] , y c [ l l ] , x c [ 1 0 ] , y c [ l l ] ) ; w i R E ( f d t o , P l w , w , x c [ l 0 ] , y c [ l l ] , x c [ l 0 ] , y c [ l 0 ] ) ; / * C O N N E C T O P - A M P O U T P U T F R O M S W I T C H * / m p ( x c [ 4 ] , y c [ l l ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ 4 ] , y c [ l l ] , x c [ 4 ] , y c [ 2 ] ) ; W I R E ( f d t o , P l W , w , x c [ 4 ] , y c [ 1 2 ] , x c [ 4 ] , y c [ l l ] ) ; / * C O N N E C T O U T P U T T O - I N P U T * / m p ( x c [ l l ] , y c [ 1 2 ] , f d t o ) ; m p ( x c [ 1 2 ] , y c [ 1 2 ] , f d t o ) ; m p ( x c [ 4 ] , y c [ 1 2 ] , f d t o ) ; W I R E ( f d t o , P l W , w , x c [ l l ] , y c [ 1 0 ] , x c [ l l ] , y c [ 1 2 ] ) ; W I R E ( f d t o , P l W , w , x c [ 1 2 ] , y c [ 1 0 ] , x c [ 1 2 ] , y c [ 1 2 ] ) ; W I R E ( f d t o , M l W , w , x c [ l l ] , y c [ 1 2 ] , x c [ 1 2 ] , y c [ 1 2 ] ) ; } /****************************************************** / * V / * I N P U T 4 F U N C T I O N — H a r d - W i r e t h e I n p u t ( A R O M A ) * / /* */ / * T h e i n p u t 2 f u n c t i o n c o n n e c t s t h e i n p u t n o d e t o t h e * / / * f i r s t s w i t c h e d c a p a c i t o r o f t h e f i l t e r , a n d t o a * / / * s e c o n d o n e w i t h c o m p l e m e n t a r y c l o c k s i f i t e x i s t s . A * / / * c o n n e c t e d t o t h e f i r s t o n e i f i t e x i s t s . * / /* */ /************************************^ i n p u t 4 ( f d t o ) F I L E * f d t o ; / * O U T P U T F I L E * / ( i n t x c [ 5 ] , y c [ 5 ] ; / * C O N N E C T S * / i n t i ; / * I N D E X V A R I A B L E * / i n t s c o n e , s c t w o ; / * C A P L O C A T I O N S * / i n t l e a s t [ 2 ] , m o s t [ 2 ] ; / * W I R E B O U N D S * / x c [ l ] = - 5 * U ; / * I N P U T C O N N E C T I O N x c [ 2 ] = ( c a p a c [ 1 ] . h o r [ 0 ] + E D G E / 2 ) * U ; / * F I R S T C A P * / y c [ l ] = - 3 * U ; / * F I R S T W I R I N G L E V E L y c [ 2 ] = l e v e l [ 1 ] ; / * T O P O F S W I T C H * / y c [ 3 ] = l e v e l [ 1 ] + 1 2 * U ; / * C O N T A C T L E V E L * / 2 0 8 y c [ 4 ] = l e v e l [ 1 ] + 17*U ; / * T O P W I R E L E V E L * / s c o n e = s c t w o = 0 ; f o r ( i = 2 ; i < = t o t a l ; i + + ) i f ( s a m e ( & c a p a c [ i ] . s e c [ 0 ] , S t a b l e [ 0 ] [ 0 ] [ 0 ] ) S S c a p a c [ i ] . t y p = = 1 S • ) ( i f ( c a p a c [ i ] . s w t c h ! = c a p a c [ l ] . s w t c h ) s c o n e = i ; e l s e s c t w o = i ; } x c [ 3 ] = ( c a p a c [ s c o n e ] . h o r [ 0 ] + E D G E / 2 ) * U ; x c [ 4 ] = ( c a p a c [ s c t w o ] . h o r [ 0 ] + E D G E / 2 ) * U ; i f ( s c o n e ! = 0 S S s c t w o ! = 0 ) { m p ( x c [ l ] , y c [ 4 ] , f d t o ) ; W I R E ( f d t o , M l W , w , x c [ l ] , y c [ 4 ] , x c [ 3 ] + 8 * U , y c [ 4 ] ) ; W I R E ( f d t o , M l w , w , x c [ 3 ] + 8 * U , y c [ 2 ] , x c [ 3 ] + 8 * U , y c [ 4 ] ) ; W I R E ( f d t o , M l W , w , x c [ 2 ] + 8 * U , y c [ 2 ] , x c [ 2 ] + 8 * U , y c [ 4 ] ) ; l e a s t [ 0 ] = 4 ; m o s t [ 0 ] = 3 * s c t w o + 1 ; y c [ 0 ] = ( - 5 * w i r e s l o t ( l e a s t , m o s t ) - 3 ) * U ; W I R E ( f d t o , M i w , w , x c [ 4 ] , y c [ 0 ] , x c [ 2 ] , y c [ 0 ] ) ; W I R E ( f d t o , P 2 W , w , x c [ 4 ] , y c [ 0 ] , X C [ 4 ] , U ) ; m p 2 ( x c [ 4 ] , y c [ 0 ] , f d t o ) ; m p 2 ( x c [ 2 ] , y c [ 0 ] , f d t o ) ; } e l s e ( W I R E ( f d t o , M l W , w , x c [ l ] , y c [ 4 ] , x c [ 2 ] + 8 * U , y c [ 4 ] ) ; W I R E ( f d t o , P 2 W , w , x c [ 2 ] + 8 * U , y c [ 2 ] , x c [ 2 ] + 8 * U , y c [ 4 ] ) ; m p ( x c [ l ] , y c [ 4 ] , f d t o ) ; } ) /************************************************* /* */ / * A T T A C H 1 F U N C T I O N ~ A t t a c h C a p a c i t o r P l a t e * / /* */ / * T h e a t t a c h l f u n c t i o n p l a c e s a p l a t e w i t h a b a s e * / / * w i d t h o f E D G E . T h e h e i g h t i s s m a l l e r i f a f r a c t i o n o f * / / * l e s s t h a n o n e i s g i v e n . * / /* */ /*************************************************** a t t a c h l ( a , b , x d i r , y d i r , f r a c t i o n , f d t o , f l a g ) i n t a , b ; / * B A S E C O - O R D S * / i n t x d i r , y d i r ; / * P L A T E D I R E C T I O N * / i n t f l a g ; / * L I N K I N G B O X F L A G * / f l o a t f r a c t i o n ; / * P L A T E S I Z E * / F I L E * f d t o ; / * O U T P U T F I L E * / 2 0 9 } i n t x c , y c ; / * C E N T E R O F P L A T E * / i n t x p , y p ; / * C E N T E R O F L I N K I N G B O X * / i n t t e m p ; / * S T O R A G E V A R I A B L E * / i n t x e d l , y e d l ; / * P L A T E E D G E S * / . f l o a t t r e t = E D G E ; t e m p = 2 + t r e t + f r a c t i o n * ( t r e t - 2 ) ; / * I F T H E D I R E C T I O N I S L E F T OR R I G H T . . . * / i f ( y d i r == 0) { x c = ( 2 * a + E D G E + x d i r * t e m p ) * U / 2 ; y c = ( 2 * b - l ) * E D G E * U / 2 + U ; y e d l = ( E D G E - 2 ) * U ; x e d l = f r a c t i o n * ( E D G E - 2 ) * U ; x p = ( 2 * a + E D G E * ( 1 + x d i r ) ) * U / 2 ; y p = y c ; } / * I F T H E D I R E C T I O N I S U P O R D O W N . . . * / e l s e ( y c = ( 2 * E D G E * b - E D G E + y d i r * t e m p ) * U / 2 + U x c - ( 2 * a + E D G E ) * U / 2 ; x e d l = ( E D G E - 2 ) * U ; y e d l = f r a c t i o n * ( E D G E - 2 ) * U ; y p = ( 2 * b - l + y d i r ) * E D G E * U / 2 + U ; x p = x c ; } / * S A V E T H E H I G H E S T P L A T E L E V E L * / i f ( y c > l e v e l [ 0 ] ) l e v e l [ 0 ] = y c ; / * P L A C E T H E P L A T E * / B O X ( f d t o , P 2 B , x e d l , y e d l , x c , y c ) ; B O X ( f d t o , P 1 B , x e d l + 2 * U , y e d l + 2 * U , x c , y c ) ; / * P L A C E A L I N K I F N E C C E S S A R Y * / i f ( f l a g ) B O X ( f d t o , P 2 B , 2 * U , 2 * U , x p , y p ) ; / * P L A C E T H E T I P I F P O S S I B L E * / i f ( f r a c t i o n < l . 0 && y d i r = = l ) B O X ( f d t o , P 2 B , 2 * U , 2 * U , x c , y c + U + y e d l / 2 ) ; /************************************** /* */ / * A T T A C H 2 F U N C T I O N — A t t a c h C a p a c i t o r P l a t e * / /* */ / * T h e a t t a c h 2 f u n c t i o n p l a c e s a p l a t e i f i t s s i z e i s * / / * l e s s t h a n L I M I T . A r e c t a n g l e i s p l a c e d o n t o p o f t h e * / / * p r e v i o u s p l a t e t o m a i n t a i n t h e p e r i m e t e r t o a r e a * / / * r a t i o . * / 210 /* */ /****************************************** a t t a c h 2 ( a , b , x d i r , y d i r , f r a c t i o n , f d t o , f l a g ) i n t a , b ; / * S T A R T I N G C O - O R D S * / i n t x d i r , y d i r ; / * P L A T E D I R E C T I O N * / i n t f l a g ; / * ! ! N O T U S E D ! ! * / f l o a t f r a c t i o n ; / * P L A T E S I Z E * / F I L E * f d t o ; / * O U T P U T F I L E * / { i n t x c , y c ; / * C E N T E R O F P L A T E * / i n t x e d l , y e d l ; / * P L A T E E D G E S * / f l o a t a a ; / * R E C T A N G L E H E I G H T * / f l o a t b b ; / * R E C T A N G L E W I D T H * / f l o a t t r e t = E D G E ; / * F I N D T H E R E C T A N G L E S I D E S * / a a = 2 . 0 * U * f r a c t i o n * t r e t ; b b = t r e t * U / 2 . 0 + 2 . 0 * U / t r e t ; / * I F T H E P L A T E D I R E C T I O N I S L E F T OR R I G H T . . . * / i f ( yd i r = = 0 ) { x e d l = a a ; y e d l = b b ; x c = ( 2 * a + E D G E + x d i r * ( E D G E - 2 ) ) * U / 2 + x d i r * a a / 2 ; y c = ( 2 * b - l ) * E D G E * U / 2 + U ; } / * I F T H E P L A T E D I R E C T I O N I S U P OR D O W N . . . * / e l s e { x e d l = b b ; y e d l = a a ; y c - ( ( 2 * b - l ) * E D G E + y d i r * ( E D G E - 2 ) ) * U / 2 + y d i r * a a / 2 + U ; x c = ( 2 * a + E D G E ) * U / 2 ; } / * S A V E T H E H I G H E S T P L A T E C O - O R D * / i f ( y c > l e v e l [ 0 ] ) l e v e l [ 0 ] = y c ; / * P L A C E T H E R E C T A N G L E * / B O X ( f d t o , P 2 B , x e d l , y e d l , x c , y c ) ; B O X ( f d t o , P 1 B , x e d l + 2 * U , y e d l + 2 * U , x c , y c ) ; / * A D D T H E T I P I F P O S S I B L E * / i f ( y d i r = = l ) B O X ( f d t o , P 2 B , 2 * U , 2 * U , x c , y c + U + y e d l / 2 ) ; } /********************************************* /* */ / * A T T A C H 3 F U N C T I O N — A t t a c h C a p a c i t o r P l a t e * / /* / * T h e a t t a c h 3 f u n c t i o n p l a c e s a p l a t e t h a t i s l e s s / * t h a n t h e f u l l s i z e b u f l a r g e r t h a n L I M I T . I t s p r e a d s / * t h e l i n k w i d t h t o m a i n t a i n t h e p e r i m e t e r / a r e a r a t i o . / * /*************************************** a t t a c h 3 ( a , b , x d i r , y d i r , f r a c t i o n , f d t o , f l a g ) i n t a , b ; /* S T A R T I N G C O - O R D S * / i n t x d i r , y d i r ; /* P L A T E D I R E C T I O N * / i n t f l a g ; /* ! ! N O T U S E D ! ! * / f l o a t f r a c t i o n ; /* P L A T E S I Z E * / F I L E * f d t o ; /* O U T P U T F I L E * / { i n t x c , y c ; /* P L A T E C E N T E R * / i n t x p , y p ; /* L I N K C E N T E R * / i n t x l , y l ; /* L I N K S I D E S * / i n t x e d l , y e d l ; /* P L A T E S I D E S * / f l o a t a a , b b ; /* P L A T E V A R I A B L E S * / f l o a t t r e t = E D G E ; / * C A L C U L A T E T H E P L A T E S I Z E */ a a = f r a c t i o n * ( t r e t + 2.0) - 2. 0 ; b b = t r e t - f r a c t i o n * ( t r e t - 2. o) ; / * I F T H E P L A T E D I R E C T I O N I S L E F T O R R I G H T . . . * / i f ( y d i r==0) ( x c - ( 2 * a + E D G E + x d i r * ( 2 + E D G E + a a ) ) * U / 2 ; y c = ( 2 * b - l ) * E D G E * U / 2 + U ; y e d l « ( E D G E - 2 ) * U ; x e d l = a a * U ; x p = ( 2 * a + E D G E * ( 1 + x d i r ) ) * U / 2 ; y p = y c ; y l = b b * U ; x l = 2 * U ; } / * I F T H E P L A T E D I R E C T I O N I S U P O R DOWN * / e l s e { y c = ( ( 2 * b - l ) * E D G E + y d i r * ( 2 + E D G E + a a ) ) * U / 2 + U x c = ( 2 * a + E D G E ) * U / 2 ; x e d l = ( E D G E - 2 ) * U ; y e d l = a a * U ; y p = ( 2 * b - l + y d i r ) * E D G E * U / 2 + U ; x p = x c ; x l = b b * U ; y l = 2 * U ; } / * S A V E T H E H I G H E S T P L A T E L E V E L * / 212 } i f ( y c > l e v e l [ 0 ] ) l e v e l [ 0 ] = y c ; / * P L A C E T H E P L A T E A N D L I N K * / B O X ( f d t o , P 2 B , x e d l , y e d l , x c , y c ) ; B O X ( f d t o , P 2 B , x l , y l , x p , y p ) ; B O X ( f d t o , P 1 B , x e d l + 2 * U , y e d l + 2 * U , x c , y c ) ; / * P L A C E T H E T I P I F N E C C E S S A R Y * / i f ( y d i r = = l ) B O X ( f d t o , P 2 B , 2 * U , 2 * U , x c , y c + U + y e d l / 2 ) ; /***********************************************************/ / * * / / * B O X F U N C T I O N ~ W r i t e a B o x t o t h e C I F F i l e * / / * * / / * T h e b o x f u n c t i o n w r i t e s a b o x c o m m a n d t o t h e o u t p u t * / / * f i l e . T h e c e n t e r a n d e d g e s o f t h e b o x a r e u s e d . * / /* */ /******************************^ B O X ( f d t o , s t , x e d , y e d , x c , y c ) F I L E * f d t o ; / * O U T P U T F I L E * / c h a r * s t ; / * B O X L A Y E R * / i n t x e d , y e d ; / * B O X E D G E S * / i n t x c , y c ; / * B O X C E N T E R * / { c h a r * B O X C O M = " % s %d %d %d %d % s " ; / * B O X F O R M A T * / Char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / / * W R I T E T H E B O X * / s p r i n t f ( b u f , B O X C O M , s t , x e d , y e d , X B A S E + x c , Y B A S E + y c , " ; \ n " ) ; w r i t e l i n e ( f d t o , b u f ) ; } /****************************^ / * * / / * C E L L P L A C E F U N C T I O N — P l a c e a C e l l * / / * * / / * T h e c e l l p l a c e f u n c t i o n p l a c e s a c e l l a t t h e g i v e n * / / * l o c a t i o n . * / /* */ /**************************************** c e l l p l a c e ( f d t o , s t , x c , y c ) F I L E * f d t o ; / * O U T P U T F I L E * / c h a r * s t ; / * C E L L C A L L * / 2 1 3 i n t x c , y c ; / * C E L L P O S I T I O N * / { i n t x , y ; / * A C T U A L C E L L P L A C E M E N T * / c h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / c h a r * C E L L = " % s %d %d % s " ; / * F O R M A T * / / * C O M P U T E A C T U A L P L A C E M E N T * / X = X B A S E + XC 7 y = Y B A S E + y c - o p a m p . y o r g * U ; / * P L A C E T H E C E L L * / s p r i n t f ( b u f , C E L L , s t , x , y , " ; \ n " ) ; w r i t e l i n e ( f d t o , b u f ) ; } /***********************************************************/ / * * / / * C L O C K P H A S E F U N C T I O N — C h e c k P h a s e o f a C l o c k * / /* */ / * T h e c l o c k p h a s e f u n c t i o n c h e c k s t h e p h a s e o f t h e * / / * s p e c i f i e d c l o c k . T h i s i s o n l y v a l i d f o r S C a n d B S * / / * e l e m e n t s a n d t h e c l o c k s m u s t b e C o r # C . * / /* */ /*************************^ c l o c k p h a s e ( b u f , s p o t ) C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / i n t s p o t ,* / * C L O C K P O S I T I O N * / { i n t i , j ; / * I N D E X V A R A I B L E S * / / * M O V E T O T H E B E G I N N I N G O F T H E F I R S T C L O C K * / j = 0 ; w h i l e ( b u f [ j + + ] ! = ' ) • ) ; w h i l e ( b u f [ j ] = = ' ' ) j + + ; / * A D V A N C E T O T H E D E S I R E D C L O C K * / f o r ( i = l ; i < = s p o t ; i ++ ) { w h i l e ( b u f [ j ] ! = « ' ) j + + ; w h i l e ( b u f [ j ] = = ' ' ) j + + ; } / * R E T U R N 0 I F #C I S F O U N D * / r e t u r n ( ( b u f [ j ] = = ' # ' ) ? 0 : 1) ; } /******************************************** / * * / / * C O P Y F U N C T I O N — S t r i n g C o p y * / /* */ 2 1 4 / * T h e c o p y f u n c t i o n c o p i e s s t r i n g l t o s t r i n g 2 . T h e * / / * f i r s t s t r i n g m u s t b e t e r m i n a t e d b y a n E O W . * / /* */ /*************************************** c o p y ( s t r 1 , s t r 2 ) c h a r * s t r l ; / * I N P U T S T R I N G * / c h a r * s t r 2 ; / * O U T P U T S T R I N G * / { i n t i = 0 ; / * I N D E X V A R I A B L E * / / * C O P Y S T R I N G 1 T O S T R I N G 2 * / d o { * ( s t r 2 + i ) = * ( s t r l + i ) ; } w h i l e ( * ( s t r l + i + + ) ! = E O W && * ( s t r l + i - 1 ) ! = E O L ) ; / * A L W A Y S T E R M I N A T E W I T H EOW * / i f ( * ( S t r l + i - l ) = = E O L ) * ( s t r 2 + i - l ) = E 0 W ; /********************************^ / * * / / * D O P E F U N C T I O N — C h e c k F o r A r r a y S p a c e * / / * * / / * T h e d o p e f u n c t i o n d e c i d e s i f t h e r e i s e n o u g h s p a c e * / / * t o i n s e r t a p l a t e i n t o t h e g r i d . * / /* */ /***************************^ d o p e ( x , x d i r , y , y d i r , c o u n t , m a x ) i n t x , y ; / * S T A R T I N G C O - O R D S * / i n t x d i r , y d i r ; / * P L A T E D I R E C T I O N * / i n t c o u n t ; / * C U R R E N T C A P A C I T O R * / i n t m a x ; / * R I G H T E D G E O F T H E G R I D * / { i n t X 2 , y 2 ; / * P L A T E C E N T E R * / i n t i , j ; / * I N D E X V A R I A B L E S * / i n t r i g h t ; / * R I G H T B O U N D A R Y O F C H E C K * / i n t l e f t ; / * L E F T B O U N D A R Y O F C H E C K * / i n t a , b ; / * A R R A Y C H E C K C O - O R D S * / / * F I N D T H E B O T T O M C O R N E R O F T H E P L A T E * / x 2 = x + x d i r * E D G E ; y 2 = y + y d i r ; / * F I N D T H E L I M I T S O F T H E P L A T E * / r i g h t = x 2 + E D G E + C A P G A P ; 2 1 5 } l e f t = x 2 - C A P G A P ; / * S E A R C H F O R ROOM F O R T H E P L A T E * / f o r ( i = x 2 ; i < x 2 + E D G E ; i + + ) i f ( g r i d [ i ] [ y 2 ] ! = 0 ) r e t u r n ( 0 ) ; / * S E A R C H F O R E N O U G H G A P A R O U N D T H E P L A T E * / f o r ( j = y 2 - l ; j < = y 2 + l ; j + + ) f o r ( i = l e f t ; i < r i g h t ; i + + ) / * O N L Y C H E C K W I T H I N T H E G R I D * / { a = i ; b = j ; i f ( i < l ) a = 1 ; i f ( i > m a x - l ) a = m a x - 1 ; i f ( j < l ) b = 1 ; i f ( j > T O P M A X ) b = T O P M A X ; i f ( g r i d [ a ] [ b ] ! = 0 && g r i d [ a ] [ b ] ! = c o u n t ) r e t u r n ( 0 ) ; } r e t u r n ( 1 ) ; /*********************************** / * V / * E M P T Y F U N C T I O N — C l e a r s a C o l u m n o f T A B L E * / / * * / / * T h e e m p t y f u n c t i o n i n i t i a l i z e s o n e c o l u m n o f T A B L E * / / * t o E O W . * / /* */ /*************************************** e m p t y ( c o l ) i n t C O l ; / * T A B L E C O L U M N * / { i n t b ; / * I N D E X V A R I A B L E * / / * I N I T I A L I Z E T H E C O L U M N * / f o r ( b = 0 ; b < 5 0 ; b++) t a b l e [ c o l ] [ b ] [ 0 ] = EOW ; } /****************************************** / * V / * G E T N O D E F U N C T I O N — G e t O n e N o d e o f a L i n e * / / * V / * T h e g e t n o d e f u n c t i o n r e t u r n s t h e r e q u e s t e d n o d e * / / * f r o m t h e g i v e n l i n e . * / /* */ 216 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / g e t n o d e ( b u f , p o s , v e r t x ) C h a r b u f [ L E N G T H ] ; / * L I N E B U F F E R * / i n t p o s ; / * N O D E P O S I T I O N * / c h a r v e r t x [ W O R D ] ; / * N O D E B U F F E R * / { i n t q , i , k ; / * I N D E X V A R I A B L E S * / q = i = 0 ; w h i l e ( b u f [ i + + ] ! = ' ( • ) / * S T O R E T H E R E Q U E S T E D N O D E * / f o r ( k = l ; k < = p o s ; k++) { w h i l e ( b u f [ i ] == • •) i + + ; w h i l e ( b u f [ i ] ! = ' • & & b u f [ i ] != ' ) ' ) { i f ( k == p o s ) v e r t x [ q + + ] = b u f [ i + + ] ; e l s e i + + ; } } v e r t x [ q ] = EOW ; } /********************************************* / * V / * MA F U N C T I O N — M e t a l - A c t i v e C o n t a c t * / / * * / / * T h e ma f u n c t i o n p l a c e s a m e t a l - a c t i v e c o n t a c t a t * / / * t h e g i v e n l o c a t i o n . * / / * V / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / m a ( x c , y c , f d t o ) i n t x c , y c ; / * L O C A T I O N * / F I L E * f d t o ; / * O U T P U T F I L E * / { / * P L A C E T H E C O N T A C T * / B O X ( f d t o , M l B , 4 * U , 4 * U , x c , y c ) ; B O X ( f d t o , C l B f 2 * U , 2 * U f x c f y c ) ; B O X ( f d t o , A C B , 4 * U , 4 * U , x c , y c ) ; } /************************************** / * * / / * M P F U N C T I O N — M e t a l - P o l y l C o n t a c t * / / * * / 2 1 7 / * T h e mp f u n c t i o n p l a c e s a m e t a l - p o l y l c o n t a c t a t t h e * / / * g i v e n l o c a t i o n . * / /* */ /************************************** m p ( x c , y c , f d t o ) i n t x c , y c ; / * L O C A T I O N * / F I L E * f d t o ; / * O U T P U T F I L E * / { / * P L A C E T H E C O N T A C T * / B O X ( f d t o , M l B , 4 * U , 4 * U , x c , y c ) ; B O X ( f d t o , C l B , 2 * U , 2 * U , x c , y c ) ; B O X ( f d t o , P l B , 4 * U , 4 * U , x c , y c ) ; > /***********************************************************/ / * * / / * M P 2 F U N C T I O N — M e t a l - P o l y 2 C o n t a c t * / /* */ / * T h e mp2 f u n c t i o n p l a c e s a m e t a l - p o l y 2 c o n t a c t a t * / / * t h e g i v e n l o c a t i o n . * / /* */ m p 2 ( x c , y c , f d t o ) i n t x c , y c ; / * L O C A T I O N * / F I L E * f d t o ; / * O U T P U T F I L E * / { / * P L A C E T H E C O N T A C T * / B O X ( f d t o , M l B , 4 * U , 4 * U , X C , y c ) ; B O X ( f d t o , C l B , 2 * U , 2 * U , x c , y c ) ; B O X ( f d t O , P 2 B , 5 * U , 5 * U , X C , y c ) ; } /*********************************** /* */ / * M P S F U N C T I O N — S u b s t r a t e C o n t a c t t o P - w e l l * / / * * / / * T h e m p s f u n c t i o n p l a c e s a p - w e l l s u b s t r a t e c o n t a c t * / / * a t t h e g i v e n l o c a t i o n . * / /* */ /********************************** m p s ( x c , y c , f d t o ) i n t x c , y c ; / * L O C A T I O N * / F I L E * f d t o ; / * O U T P U T F I L E * / 2 1 8 { / * P L A C E T H E C O N T A C T * / B O X ( f d t o , M l B , 4 * U , 4 * U , x c , y c ) ; B O X ( f d t o , C l B , 2 * U , 2 * U , x c , y c ) ; B O X ( f d t O , A C B , 4 * U , 4 * U , X C , y c ) B O X ( f d t o f P P B f 8 * U f 8 * U f x c f y c ) ; } /****************************************** / * V / * R E A D C O M F U N C T I O N — R e a d I n p u t D a t a * / /* */ / * T h e r e a d c o m f u n c t i o n r e a d s t h e i n p u t p a r a m e t e r s * / / * f r o m t h e . c o m f i l e . * / /* */ /**********************************^ r e a d c o m ( f d c o m ) F I L E * f d c o m ; / * . C O M F I L E * / { / * I N I T I A L I Z E T H E N O D E T A B L E * / e m p t y ( O ) ; e m p t y ( l ) ; e m p t y ( 2 ) ; / * R E A D T H E I N P U T P A R A M E T E R S * / f s c a n f ( f d c o m , " % f %d % d " , & L A M B D A , S t o p p e r , & s w a p ) ; f s c a n f ( f d c o m , " % d % d " , & o p a m p . x o r g , S o p a m p . y o r g ) ; f s c a n f ( f d c o m , 1 1 %d %d % d " , & o p a m p . w i d t h , & o p a m p . h e i g h t , & o p a m p . l e v e l ) f s c a n f ( f d c o m , " % d %d % d " , & o p a m p . c o n [ 0 ] , & o p a m p . c o n [ l ] , & o p a m p . c o n [ 2 f s c a n f ( f d c o m , " % d %d % d " , & o p a m p . v o s [ 0 ] , & o p a m p . v o s [ 1 ] , & o p a m p . v o s [ 2 f s c a n f ( f d c o m , " % d %d % d " , & o p a m p . w i d [ 0 ] , & o p a m p . w i d [ l ] , & o p a m p . w i d [ 2 / * I N I T I A L I Z E T H E C I F U N I T S * / U = 1 0 0 * L A M B D A ; W = 2 0 0 * L A M B D A 7 /* */ / * R E A D N D F U N C T I O N — R e a d N o d a l D a t a * / /* */ / * T h e r e a d n d f u n c t i o n r e a d s t h e i n p u t p a r a m e t e r s f r o m * / / * t h e . n d f i l e . * / /* */ / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * r e a d n d ( f d n d , h e a d ) F I L E * f d n d ; / * . N D F I L E * / c h a r h e a d ; / * I N P U T S E C T I O N S T Y L E * / 2 1 9 { Char l i n e [ L E N G T H ] ; / * L I N E B U F F E R * / i n t i ; / * I N D E X V A R I A B L E * / / * I N I T I A L I Z E T H E N O D E T A B L E * / r e a d l i n e ( f d n d , l i n e ) ; c o p y ( & 1 i n e [ 0 ] , S t a b l e [ 0 ] [ 0 ] [ 0 ] ) ; r e a d l i n e ( f d n d , l i n e ) ; c o p y ( & l i n e [ 0 ] , & t a b l e [ 0 ] [ 1 ] [ 0 ] ) ; r e a d l i n e ( f d n d , l i n e ) ; r e a d l i n e ( f d n d , l i n e ) ; / * R E A D T H E I N P U T S E C T I O N N O D E S * / i f ( h e a d = = ' L ' | | h e a d = = ' M l ) { c o p y ( & l i n e [ 0 ] , & t a b l e [ l ] [ 0 ] [ 0 ] ) ; s t a r t = 0 ; } i f ( h e a d = = ' S ' ) { c o p y ( & l i n e [ 0 ] , & t a b l e [ l ] [ 0 ] [ 0 ] ) ; r e a d l i n e ( f d n d , l i n e ) ; c o p y ( & l i n e [ 0 ] , S t a b l e [ l ] [ 1 ] [ 0 ] ) ; c o p y ( S t a b l e [ 1 ] [ 0 ] [ 0 ] , & t a b l e [ 2 ] [ 0 ] [ 0 ] ) ; c o p y ( S t a b l e [ 1 ] [ 1 ] [ 0 ] , S t a b l e [ 2 ] [ 1 ] [ 0 ] ) ; s t a r t = 2 ; } / * R E A D T H E I N T E G R A T O R N O D E S * / r e a d l i n e ( f d n d , l i n e ) ; r e a d l i n e ( f d n d , l i n e ) ; f o r ( i = s t a r t ; l i n e [ 0 ] ! = E O F ; i ++ ) { c o p y ( S l i n e [ 0 ] , S t a b l e [ 2 ] [ i ] [ 0 ] ) ; r e a d l i n e ( f d n d , l i n e ) ; } /*****************************^ /* */ / * R E A D L I N E F U N C T I O N — R e a d a L i n e F r o m F i l e * / /* */ / * T h e r e a d l i n e f u n c t i o n r e a d s a l i n e t e r m i n a t e d b y a n * / / * E O L o r a n E O F f r o m t h e g i v e n i n p u t f i l e . * / /* */ /*************************************** readline(fdfrom,buf) F I L E * f d f r o m ; / * I N P U T F I L E * / Char b u f [ L E N G T H ] ; / * L I N E B U F F E R * / { i n t q = 0 ; / * I N D E X V A R I A B L E * / Uoa =i ((uioajpj)o^e6 = up)) aixu* A s n a Adoo A a n a indNI SHJi N3d0 */ A NoiiONna N3do a n a * / • ()uadoj ¥ a n a A a n a i n d N i * / uiojjpj* a n a A naaana H3IDYHVHO */ wo w } A a n a indino */ •' O 4 P J * a n a (oq.pj)uosAoxis /¥¥*¥¥¥**¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥/ A * / A *9TT3 ^rioABi sujq. oq.ux */ A 9T T? aiO dure-do eirq. sexdoo uox^ounj UOSAOUJS em */ A * ' * / A ®TTa aio dutv-do Adoo — NoiiiONna NO3AOHS */ A * / A¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥/ { .' (T)uari4ea .' (M03=I [T-Xlljnq 95 M03=i [T-X]2Jnq) aTTUA { • (0) uin^aa ([++X]2?nq=| [*.]Tjnq) jx } op /¥ H3I0YHYH0 A9 H310VHYH0 S9NIHIS 3Hi 3HYdW0D */ A siaivaYA xaaNi */ i 0 = X 4UX } A ONIHIS aNooas */ '. zim* « q o /¥ ONIHI.S OLSHia ¥/ Tjnq* JBUO (Zjnq'ijnqJeuiBS A¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥/ A * / A *Moa 4 S B I * / A au.q. oq. dn sBuxaqs O M 4 seaeduioo uoxqounj eui.es e m ¥/ A ' * / /¥ A+XTenbs 6uxa 4s syp9u;D — NOIIONfia 3WYS ¥/ A * / / ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ / { (303 =i [T-b]jnq 55 103 =i [T-bljnq) 9TXUM { .' (uioajpj) o 4 a 6 = [++b]jnq } op /¥ a n a indNi am, wona SHSIIOYHYHO QYSH * / QZZ 2 2 1 p u t c ( c h , f d t o ) / * C L O S E I N P U T F I L E * / f c l o s e ( f d f r o m ) ; ***/ / * T h e s w i t c h p l a c e f u n c t i o n p l a c e s t h e s w i t c h g r o u p / * w i t h t h e a p p r o p r i a t e c l o c k i n g s c h e m e . /* /******************************************** */ */ */ */ */ */ ***/ s w i t c h p l a c e ( x , y , i n d e x , f d t o ) i n t x , y ; i n t i n d e x F I L E * f d t o / * S W I T C H C O - O R D S * / / * C L O C K I N G S C H E M E * / / * O U T P U T F I L E * / { i n t i , j ; i n t x c , y c ; i n t y c l , y c 2 , y c 3 , y c 4 / * I N D E X V A R I A B L E S * / / * S W I T C H P L A C E M E N T P O I N T S * / / * W I R I N G L E V E L S * / / * P L A C E T H E M E T A L - A C T I V E C O N T A C T S * / f o r ( i = 0 - l ; i < 2 ; i + + ) f o r ( j = 0 ; j < 2 ; j ++ ) m a ( x + i * 8 * U , y - j * 1 6 * U , f d t o ) ; / * DRAW T H E M E T A L L I N E S * / f o r ( i = 0 - l ; i < 2 ; i + + ) { x c = x + i * 8 * U ; y c = y - 8 * U ; B O X ( f d t o , M l B , 2 * U , 1 2 * U , x c , y c ) ; } / * P U T I N T H E A C T I V E L I N E S * / B O X ( f d t o , A C B , 1 2 * U , 2 * U , x , y ) ; B O X ( f d t o , A C B , 1 2 * U , 2 * U , x , y - 1 6 * U ) ; / * C L O C K I N G S C H E M E * / i f ( c a p a c [ i n d e x ] . s w t c h = = l ) { y c l = l e v e l [ 1 ] - U ; y c 2 = l e v e l [ 1 ] - 1 5 * U ; y c 3 = l e v e l [ 1 ] + U ; y c 4 = l e v e l [ 1 ] - 1 7 * U ; } e l s e { y c l = l e v e l [ 1 ] + U ; y c 2 = l e v e l [ 1 ] - 1 7 * U ; y c 3 = l e v e l [ 1 ] - U ; y c 4 = l e v e l [ 1 ] - 1 5 * U ; } / * I N S E R T T H E P l T I P S ON T H E C L O C K L I N E S * / B O X ( f d t O , P l B , 2 * U , 8 * U , X + 4 * U , y c l ) ; 222 B O X ( f d t o , P 1 B , 2 * U , 8 *U,X+4 * U , y c 2 ) ; B O X ( f d t o , P 1 B , 2 * U , 8 *U,X - 4 * U , y c 3 ) ; B O X ( f d t o , P 1 B , 2 * U , 8 * U , x - 4 * U , y c 4 ) ; } /*********************************** /* */ / * TURN FUNCTION — C h e c k s f o r Op-Amp M i r r o r i n g * / /* */ / * T h e t u r n f u n c t i o n d e c i d e s i f a n opamp s h o u l d b e * / / * i m a g e d . I t c h e c k s f o r a n i n t e r s e c t i o n o f two l i n e s * / / * c o n n e c t i n g t h e opamp n o d e s t o t h e i r s w i t c h * / / * c o n n e c t i o n s . * / / * V /*************************^ t u r n ( i ) i n t i ; / * OP-AMP INDEX * / { i n t d e l x , d e l a ; / * HORIZONTAL BOUNDS * / i n t x i n ; / * INTERCEPT CO-ORD * / i n t x m i n / x m i n l , x m i n 2 ; / * L INE MINIMA * / i n t x m a x , x m a x l , x m a x 2 ; / * L INE MAXIMA * / / * F IND HORIZONTAL LENGTHS OF CONNECTIONS * / d e l x = w h i p [ i ] . c a p - w h i p [ i ] . o u t ; d e l a = w h i p [ i + l ] . c a p - w h i p [ i + l ] . o u t ; / * FAULTY CROSSING CHECK * / i f ( w h i p [ i + 1 ] . c a p > w h i p [ i + 1 ] . o u t && w h i p [ i ] . o u t > w h i p [ i ] . c a p ) r e t u r n ( 0 ) ; / * FAULTY CROSSING CHECK * / i f ( w h i p [ i + 1 ] . o u t > w h i p [ i + 1 ] . c a p && w h i p [ i + 1 ] . c a p > w h i p [ i ] . c a p ) i f ( w h i p [ i ] . c a p > w h i p [ i ] . o u t ) r e t u r n ( 0 ) ; / * F IND MAX AND MIN OF F I R S T L INE * / i f ( d e l x > 0) { x m a x l = w h i p [ i ] . c a p ; x m i n l = w h i p [ i ] . o u t ; } e l s e { x m a x l = w h i p [ i ] . o u t ; x m i n l = w h i p [ i ] . c a p ; } / * F IND MAX AND MIN OF SECOND L INE * / i f ( d e l a > 0) { xmax2 = w h i p [ i + l ] . c a p ; xmin2 = w h i p [ i + l ] . o u t ; } e l s e { xmax2 = w h i p [ i + l ] . o u t ; xmin2 = w h i p [ i + l ] . c a p ; } / * F IND OVERALL MIN * / i f ( x m i n l < xmin2 ) 223 } xmin = xminl ; else xmin = xmin2 ; /* FIND OVERALL MAX */ i f (xmaxl > xmax2) xmax = xmaxl ; else xmax = xmax2 ; /* COMPUTE INTERSECTION POINT */ i f (delx!=dela) { xin = (whip[i].cap*dela - whip[i+l].cap*delx)/(dela-delx) i f (xin > xmin && xin < xmax) return(1) ; } return(0) ; /************************************** /* */ /* WIRE FUNCTION — Write a Wire to the CIF F i l e */ /* */ /* The wire function writes a wire command to the */ /* output f i l e . The width and end-points of the wire are */ /* used. */ /* */ /********************************^ WIRE(fdto,st,width,xl,y1,x2,y2) FILE *fdto ; /* OUTPUT FILE */ char * s t ; /* BOX LAYER */ i n t width ; /* WIRE WIDTH */ i n t x l , y l ; /* WIRE START */ i n t x2,y2 ; /* WIRE FINISH */ { char *WC = "%s %d %d %d %d %d %s" ; /* WIRE FORMAT */ C h a r buf[LENGTH] ; /* LINE BUFFER */ /* WRITE THE WIRE */ sprintf(buf,WC,st,width,XBASE+Xl,YBASE+y1,XBASE+X2,YBASE+y2 , " writeline(fdto,buf) ; } /******************************************* / * V /* WIRESLOT FUNCTION — Find Wire Level */ /* */ /* The wireslot function finds the f i r s t a vailable */ /* l e v e l for a wire to inserted into the g r i d . The */ 224 w i r e s l o t ( l e a s t , m o s t ) i n t l e a s t [ 2 ] i n t most[2] /* LEFT END-POINT */ /* RIGHT END-POINT */ { i n t i , k ; i n t f l a g , f 2 i n t j ; /* INDEX VARIABLES */ /* SEARCH FLAGS */ /* WIRE LEVEL */ /* FIND A HOLE IN THE ARRAY LONG ENOUGH FOR THE WIRE */ f2 = 1 ; f o r (j=0; f 2 ; { f l a g = 1 ; f o r ( k = l e a s t [ 0 ] ; k<=most[0]; k++) i f ( path[j][k]!=0) f l a g = 0 ; i f ( f l a g ) f2 = 0 ; } /* F I L L THE HOLE */ f o r ( k = l e a s t [ 0 ] ; k<=most[0]; k++) p a t h [ j ] [ k ] = 1 ; /* UPDATE THE HIGHEST WIRING LEVEL */ i f ( l e v e l [ l ] > (-5*j-20)*U) l e v e l [ 1 ] = (-5*j-20)*U ; r e t u r n ( j ) ; } /************************************** /* */ /* WRITELINE FUNCTION — Wri t e a L i n e To F i l e */ /* */ /* The w r i t e l i n e f u n c t i o n w r i t e s a l i n e t e r m i n a t e d by */ /* an EOL or an EOF t o the output f i l e . */ j - w r i t e l i n e ( f d t o , b u f ) FILE * f d t o ; char buf[LENGTH] /* OUTPUT FILE */ /* LINE BUFFER */ { i n t q = 0 /* INDEX VARIABLE */ 2 2 5 / * W R I T E T H E L I N E T O T H E O U T P U T F I L E * / do { putc(buf[q++],fdto) ; } while (buf[q-l] ! = E O L && buf[q-l] ! = E O F && buf[q-l] != EOW) ;

Cite

Citation Scheme:

    

Usage Statistics

Country Views Downloads
Thailand 2 0
United States 2 0
Japan 2 0
China 1 6
City Views Downloads
Unknown 2 1
Tokyo 2 0
Mountain View 1 0
Beijing 1 0
Ashburn 1 0

{[{ mDataHeader[type] }]} {[{ month[type] }]} {[{ tData[type] }]}

Share

Share to:

Comment

Related Items