Analysis, Design, and Optimization of RF CMOS Polyphase Filters Vom Fachbereich Ingenieurwissenschaften der Universität Duisburg-Essen zur Erlangung des akademischen Grades eines Doktors der Ingenieurwissenschaften genehmigte Dissertation von Zisan Zhang aus Guoyang, Anhui Province, China Referent: Prof. Dr.-Ing. habil. Peter Jung Korreferent: Prof. Dr.-Ing. Horst Fiedler Tag der mündlichen Prüfung: 29. September 2005 To my wife, Hongjin and my son, Berkeley Abstract Polyphase filters (PPFs) are an efficient solution for high accuracy quadrature generation in radio frequency (RF) CMOS design. Although there are some guidelines for design of RF CMOS PPFs, they give too much freedom. With layout considerations, optimization of RF CMOS PPFs cannot be reached by using analytical calculations because of many constraints and tradeoffs in the design. Thus, in design of RF CMOS PPFs, intensive trials and several design iterations are needed to reach given specifications. In this situation, a computer-aided analysis and design optimization tool for RF CMOS PPFs is of great help to the community of RF CMOS PPFs designers, especially for industrial projects that are under time-to-market pressures. However, such a dedicated tool has not been available until now, to the author’s best knowledge. Focusing on computer-aided analysis and design optimization tools for RF CMOS PPFs, this dissertation has the following scientific contributions: • PPFANA, a dedicated computer-aided software tool for analysis of the influences from the nonideal effects, namely, process tolerance, components mismatch on the quadrature accuracy of the RF CMOS PPFs, was developed by the author and presented in this dissertation. • Physical design considerations for RF CMOS PPFs in system-on-a-chip (SoC) solution were proposed by the author through the analysis on the influences from parasitic effects in RF SoC. • Silicon success of an RF CMOS PPF designed by the author for a low-IF Bluetooth receiver using Fraunhofer-IMS 0.6 µm CMOS process was achieved. • PPFOPTIMA, a computer-aided synthesis and optimization tool for RF CMOS PPFs with dedicated worst-case simulation and Monte Carlo simulation toolboxes for verification of the performance of RF CMOS PPFs, was developed by the author and presented in this dissertation. Zusammenfassung Polyphasenfilter (PPF) sind eine leistungsfähige Lösung für die hochgenaue Quadraturerzeugung im Hochfrequenz (HF)-CMOS-Entwurf. Obgleich es einige Richtlinien für den Entwurf von HF-CMOS-PPF gibt, erlauben diese zu viele Freiheiten. Eine Optimierung der Schaltung und der Layout kann mit Rücksicht auf viele technisch und wirtschaftlich vorgegebene Randbedingungen und der daraus resultierenden Kompromisse mit analytischen Methoden alleine nicht erreichen werden. Es werden aufwändige Versuche und mehrere Entwurfsverbesserungen benötigt, um einen zufriedenstellenden Entwurf zu erreichen. Deshalb ist ein computerbasiertes Werkzeug zur Analyse und Optimierung des Entwurfs von HF-CMOS-PPF besonders für den industriellen Anwendungsbereich wünschenswert. Nach bestem Wissen des Autors gab es bislang ein solches Werkzeug nicht. Im Hinblick auf computerbasierte Werkzeuge zur Analyse und Optimierung des Entwurfs von HF-CMOS-PPF bringt die vorliegende Dissertation folgende wissenschaftliche Beiträge: • PPFANA, ein spezielles Entwurfswerkzeug für die Simulation der Einflüsse von den nichtidealen Effekten wie beispielsweise von Prozesstoleranzen, von Fehlanpassungen der Komponenten und der Quadraturgenauigkeit, wurde vom Autor entwickelt und vorgestellt. • Richtlinien für den Entwurf von HF-CMOS-PPF auf „System-on-a-Chip“Lösungen werden vom Autor unter Berücksichtigung parasitärer Effekte erarbeitet und vorgeschlagen. • Die erfolgreiche Realisierung eines HF-CMOS-PPF für einen BluetoothEmpfänger mit niedriger Zwischenfrequenz wurde mit dem Fraunhofer-IMS 0.6 µm CMOS Prozeß nachgewiesen. • PPFOPTIMA, ein Synthese- und Optimierungswerkzeug für HF-CMOS-PPF auf Basis von Worst-Case- und Monte-Carlo-Simulationen wurde vom Autor entwickelt und vorgestellt. Acknowledgements Time really flies; four years have passed. Looking back to the time I arrived at Duisburg, the first colleague I met was Dr. Dieter Greifendorf, who picked my wife and me up at the railway station of Duisburg in the middle of the night. In the last few years, he has been the most important person who has given me countless helps in both my academic works and daily life. My life here in Germany could not have been so easy if there had not been a warm-hearted friend like him. Hereby I would like to give my special thanks to him. This dissertation would not have been completed; if there had not been continuous supervisions and encouragements from my Ph.D supervisor, Professor Dr.-Ing. habil. Peter Jung. His brilliance and solid academic foundations have given me invaluable helps in the development of this dissertation. Dr. Rainer Kokozinski, an expert in analog circuit design, has given me many comments and suggestions in my research work. I cannot imagine how many difficulties I should have had met, if there had not been his timely helps. My group leaders Dr. Stephan Kolnsberg and Dr. Jörg Stammen have given me many helps and supports. And I have enjoyed working under their supervision very much. I can never forget Dr. Thomas Kaiser, who accepted my application and gave me the opportunity to working in Fraunhofer IMS. And he has given me countless support in my academic development during the last four years. My colleagues in the department of Wireless Chips and Systems (WCS), Fraunhofer-Institute of Microelectronics Circuits and Systems have given me many warm-hearted helps during my stay in Germany. Hereby I would like to give them my sincere thanks. Zisan Zhang October, 2005 Duisburg, Germany Table of Contents List of Figures………………………………………………………..…………………………….V List of Tables………………………………………………………….…………………………..IX List of Abbreviations……………………………………………..…………………………….X List of Symbols…………………………………………………………………………………XII Chapter 1 Introduction……………………………………………...………………………1 1.1 Wireless communications with single chip transceivers………..……………………1 1.2 Analog conversion and complex mixing……………...……………...………………… 2 1.3 State-of-the-art of wireless transceiver architectures ………….…..…………………5 1.3.1 Introduction …….……………….……...………….…….………….……….…………5 1.3.2 Conventional heterodyne receiver architecture …………………………………6 1.3.3 Direct-conversion receiver architecture………………………………..………….8 1.3.4 Wideband IF double-conversion receiver architecture……………………….11 1.3.5 Low-IF receiver architecture………………………………………………...…….13 1.3.6 Selection of transceiver architecture in this work……………………….…….14 1.4 Analysis of RF quadrature generation techniques…………...…………………...….16 1.4.1 Introduction………………………………………………………………………...….16 1.4.2 Haven’s technique………………………………………………………………...….16 1.4.3 Frequency division……………………………………………………………….…..17 1.4.4 RC-CR network………………………………………………………………………18 1.4.5 RC polyphase filter…………………………………………………………………..19 1.5 Limitations of previous works …………………...……………………………………...23 1.6 Objectives and contributions of this dissertation …………………..………………..25 1.7 Outline of this dissertation …………………………………………...…………………..26 I Chapter 2 Analysis of Nonidealities in RF CMOS Polyphase Filters …………………….……………………………..………….29 2.1 Introduction………………………………….……………………………………………….29 2.2 Vector analysis of polyphase filters…………………………..………………………...31 2.3 PPFANA, a software tool for RF CMOS PPFs…………………..…………………..38 2.3.1 Overview………..……….…..…………..……..………..………………..………….38 2.3.2 Explicit transfer function of RF CMOS PPFs…………..……...…………….38 2.3.3 Development of PPFANA………………………………………………………..40 2.4 Analysis of quadrature accuracy in ideal PPFs……………………………….……....42 2.5 Analysis of quadrature accuracy influenced by process tolerances……………....46 2.6 Analysis of quadrature accuracy influenced by component mismatch….……….51 2.7 Analysis of influences from parasitic effects…….….………………………………...54 2.7.1 Simplified RF models of resistors and capacitors…………..……………….54 2.7.2 Substrate noise coupling………………………………………………………….58 2.8 Summary………………………….…………………………………………………………..62 Chapter 3 Design of an RF CMOS Polyphase Filter………..………………64 3.1 Overview…………………………………………….…………………………64 3.2 Schematic design………………...………………………………………………………….65 3.2.1 Derivation of specifications…………………………………..………………….65 3.2.2 Design guidelines………………………….………………………………………66 3.2.3 Tolerance design………………………………..………………………………….68 3.2.4 Analytical calculations……………………...…………….………………………69 3.2.5 Schematic simulation……………………………….……………………………..72 3.3 Physical layout design………………………………………...……………...……………73 3.3.1 Layout techniques……………………………….…………………………………73 3.3.2 On-chip noise isolation techniques………….…………………………...…….76 II 3.3.3 Layout and post-layout simulation……………………………………………..77 3.3.4 Chip photo…………………………………………………………………………...79 3.4 Measurement……………………...…………………………………………………………80 3.4.1 Introductory remarks……………………………………………………...…….…80 3.4.2 Modeling of test pads and bonding wires……………………………………..80 3.4.3 Design of the test PCB……………………………………………………………81 3.4.4 Measurement setup………………………………………………………………...83 3.4.5 Measurement results……………………………………………………………….84 3.5 Analysis of simulation and measurement results…………………...………………..88 3.6 Summary…………………………………...…………………………………………………88 Chapter 4 Optimization of RF CMOS Polyphase Filters…………………90 4.1 Introduction………………..………………………………………………………………...90 4.2 Design considerations and design flow…………………………….…………………..91 4.3 Problem formulation for RF CMOS PPFs optimization……………..…………….96 4.4 Analysis of possible optimization methods…………….…………..………………..100 4.4.1 Limitations of conventional optimization methods……………………..…100 4.4.2 Simulated annealing……………………………………………………………...102 4.4.3 Genetic algorithms……………………………………………………………….103 4.5 MATLAB implementation of genetic algorithms…………………………………105 4.5.1 Overview…………………………………………………...………………………105 4.5.2 Chromosome representation…...…………...………………………....105 4.5.3 Genetic operation……………………...……………………………....107 4.5.4 Initialization, termination and fitness functions.....…………………....111 4.6 Implementation of PPFOPTIMA………………………………..…………………….114 4.6.1 Introduction……………………………...……………………………………...…114 III 4.6.2 Construction of fitness functions…………………………………………...…116 4.6.3 Graphic user interface………………………………………………………...…116 4.6.4 Verification toolboxes……………………………………………...…...……….118 4.7 Experimental results…………………..…………………………………………….....…123 4.7.1 Overview…………………..………….………………………………………...….123 4.7.2 Experiments on RF CMOS PPFs for a Bluetooth receiver……………124 4.7.3 Automated synthesis and verification of RF CMOS PPFs for different communication standards………………………………………135 4.8 Summary……………………………………..……………………………………………..146 Chapter 5 Summary and Outlook………………………………………………….149 5.1 Summary…..………………………………………..………………………………………..149 5.2 Outlook………………………………………….…………………………………………...151 References………………………………………………………………………………………...153 Appendix 1 Publications From the Author…………..…………………………..163 Appendix 2 Transfer Functions of Multi-Stage RF CMOS PPFs…….165 Appendix 3 Source Code of PPFANA ………………………………………...……167 Appendix 4 Source Code of PPFOPTIMA……………………………………… 222 IV List of Figures Figure 1.1 Mixing a real signal with a real sinusoid. ………………….….……………….…3 Figure 1.2 Mixing a real signal with a complex exponential. ……….….……………….…4 Figure 1.3 A practical implementation of the complex mixer. …………...…………….… 5 Figure 1.4 A generic heterodyne receiver……………………………………...…………….…6 Figure 1.5 A generic homodyne receiver…………………………………….…..………….… 8 Figure 1.6 Self-mixing of the LO and/or of an interfere in homodyne receiver frontend ……………………………………………….9 Figure 1.7 A wideband double-conversion receiver……………………….….…………….12 Figure 1.8 A generic low-IF receiver architecture………………………….…….………....14 Figure 1.9 Schematic of Haven’s technique. ………………………..……….………………17 Figure 1.10 A frequency divider as a quadrature generator. ……………………………...18 Figure 1.11 RC-CR networks as a quadrature generator. …………………………………19 Figure 1.12 Polyphase filter as a quadrature generator…………………………………… 20 Figure 2.1 One phase of a generalized N-phase PPFN………..……………………….…….32 Figure 2.2 One-stage RC sequence asymmetric PPFN……………………………...……....33 Figure 2.3 Quadrature signal generation using four-phase network. (a) Circuit diagram. (b) Decomposition of the two-phase input sequence into two four-phase symmetric sequences………………..…35 Figure 2.4 Graphic user interface of PPFANA for 4-stage RF CMOS PPF……….……41 Figure 2.5 Gain mismatch in ideal multi-stage RF CMOS PPFs tailored to the Bluetooth frequency range 2.4GHz-2.48GHz...………………….……....43 Figure 2.6 Phase difference in ideal multi-stage RF PPFs tailored to the Bluetooth frequency range 2.4GHz-2.48GHz..………...................…...…44 Figure 2.7 Gain mismatch influenced by process tolerance in a 2-stage V RF CMOS PPF (2.4GHz-2.48GHz) with regular design…………..…………48 Figure 2.8 Phase mismatch influenced by process tolerance in a 2-stage RF CMOS PPF (2.4GHz-2.48GHz) with regular design….…………………48 Figure 2.9 Gain mismatch influenced by process tolerance in a 2-stage RF CMOS PPF (2.4GHz-2.48GHz) with tolerance design. …………………50 Figure 2.10 Simplified RF model of a polysilicon resistor……….……….…………..……55 Figure 2.11 Simplified RF model of a capacitor……..……..…………………..…..………...56 Figure 2.12 Principle of substrate noise coupling in system-on-a-chip……………………...……………………..……………..……58 Figure 2.13 Simplified model of substrate noise coupling model in RF CMOS PPFs…………………………………………..……………………...59 Figure 3.1 Schematic of a 3-stage RF CMOS PPF for a low-IF Bluetooth receiver…………………..………………………………..71 Figure 3.2 Simulation results of a 3-stage RF CMOS PPFs obtained by using SpectreRF………………...…………………….…….....72 Figure 3.3 Simulation results of a 3-stage RF CMOS PPFs obtained by using PPFANA……………………………………………………..…72 Figure 3.4 Layout of the four resistors in one-stage of RF CMOS PPF ……...………74 Figure 3.5 Layout of the four capacitors and wires in one-stage of an RF CMOS PPF……….…..……………………….…………..75 Figure 3.6 Layout of a 3-stage RF CMOS PPF with test pads…………………....………78 Figure 3.7 Chip photo of an RF CMOS PPF for a low-IF Bluetooth receiver……………………………………..…...………..79 VI Figure 3.8 Model of test pads and bonding wires…………………………………….....…...81 Figure 3.9 Schematic of the printed circuit board (PCB) for test of the RF CMOS PPF…………..……………………..……………....…...82 Figure 3.10 Photo of the fabricated test PCB…………………………….…….………...…...83 Figure 3.11 Diagram of the measurement setup for test of the RF CMOS PPF ….…....84 Figure 3.12 Time domain measurement results of the RF CMOS PPF ……….….….….85 Figure 3.13 Gain mismatch of the RF CMOS PPF measured in frequency domain…..86 Figure 3.14 Phase difference of the RF CMOS PPF measured in frequency domain…………………………………………………….87 Figure 4.1 A design flow for specification-driven automated synthesis of RF CMOS PPFs………..…………………………….…95 Figure 4.2 A three-dimensional plot of the amplitude mismatch in a 2-stage RF CMOS PPF, expressed in the equation (4.20)…..…..……100 Figure 4.3 Mapping variables into chromosomes……………………..…...……………….106 Figure 4.4 Roulette wheel selection……………………………………….………………….109 Figure 4.5 Flowchart of the genetic algorithm implemented in PPFOPTIMA……....113 Figure 4.6 Framework of PPFOPTIMA…………………………………………….…….....115 Figure 4.7 Graphic user interface of PPFOPTIMA……..…………………………..……..117 Figure 4.8 Flowchart of Monte Carlo simulation option in PPFOPTIMA….….…….121 Figure 4.9 Flowchart of the novel worst-case simulation methodology in PPFOPTIMA…………………………………………………..122 Figure 4.10 Synthesis result of a 2-stage RF CMOS PPF for a Bluetooth receiver….125 Figure 4.11 Worst-case simulation results of a 2-stage RF CMOS PPF for a Bluetooth receiver…..………..………………………………………………….126 Figure 4.12 Monte Carlo simulation results of a 2-stage RF CMOS PPF for a Bluetooth receiver……………………….……………………..…………...127 VII Figure 4.13 Synthesis results of a 3-stage RF CMOS PPF for a Bluetooth receiver...29 Figure 4.14 Worst-case simulation results of a 3-stage RF CMOS PPF for a Bluetooth receiver…….....…………………………...………...…………...130 Figure 4.15 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a Bluetooth receiver…..…..………………….……………….……………....131 Figure 4.16 Synthesis results of a 4-stage RF CMOS PPF for a Bluetooth receiver...132 Figure 4.17 Worst-case simulation results of a 4-stage RF CMOS PPF for a Bluetooth receiver…………….…….………………………………..……..133 Figure 4.18 Monte Carlo simulation results of a 4-stage RF CMOS PPF for a Bluetooth receiver…….…………………………..……………………......134 Figure 4.19 Graphic user interfaces of PPFOPTIMA for automated synthesis of RF CMOS PPFs. ……………………………….136 Figure 4.20 Synthesis results of a 3-stage RF CMOS PPF for a GSM receiver….....137 Figure 4.21 Worst-case simulation results of a 3-stage RF CMOS PPF for a GSM receiver…………………………...….138 Figure 4.22 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a GSM receiver..………………………….....139 Figure 4.23 Synthesis results of a 2-stage RF CMOS PPF for a DECT receiver….…140 Figure 4.24 Worst-case simulation results of a 2-stage RF CMOS PPF for a DECT receiver………………………....…141 Figure 4.25 Monte Carlo simulation results of a 2-stage RF CMOS PPF for a DECT receiver……………………………..42 Figure 4.26 Synthesis results of a 3-stage-RF CMOS PPF for a WCDMA receiver..144 Figure 4.27 Worst-case simulation results of a 3-stage RF CMOS PPF for a WCDMA receiver……………………….145 Figure 4.28 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a WCDMA receiver………………………..146 VIII List of Tables Table 1.1 Advantages and disadvantages of different receiver architectures. …….……15 Table 2.1 Quadrature accuracy of ideal RF CMOS PPFs (2.4GHz-2.48GHz), obtained by using PPFANA and SpectreRF……….…………………………….45 Table 2.2 Quadrature accuracy of RF CMOS PPFs (2.4GHz-2.48GHz) with process tolerance, obtained by PPFANA and SpectreRF……….………50 Table 2.3 Quadrature accuracy influenced by component mismatch in multi-stage RF CMOS PPFs (2.4GHz-2.48GHz). ……………..………………53 Table 3.1 Specification of RF CMOS PPF for a low-IF Bluetooth receiver……..…..…66 Table 3.2 Dimension of a 3-stage RF CMOS PPF for a low-IF Bluetooth receiver………………………………….……………..….71 Table 3.3 Simulation results of a 3-stage RF CMOS PPFs obtained by using PPFANA and SpectreRF……………………………..………………..…73 Table 3.4 Simulation results obtained by using Cadence post-layout simulation and PPFANA……….…………………..……………..….78 Table 4.1 Main functions used in the optimization engine of PPFOPTIMA………….114 IX List of Abbreviations ABBREVIATION FULL EXPRESSION AM Amplitude mismatch BALUN Balance unbalance converter BiCMOS Bipolar CMOS C Capacitor CDMA Code division multiple access CEC Compression and error correction CM Component mismatch CMOS Complementary metal oxide semiconductor CPU Central processing unit DC Direct current DCR Direct-down conversion receiver DECT Digitally enhanced cordless telephony ESD Electro static discharge FM Frequency modulation GA Genetic algorithms GaAs Gallium arsenide GM Gain mismatch GSM Global system for mobile communications GUI Graphical user interface IC Integrated circuit IF Intermediate frequency IMS Institut für Mikroelektronische Schaltungen und Systeme I/O Input / output I/Q In phase/quadrature phase IRF Image reject filter IRM Image reject mixer IRR Image reject ratio ISM Industrial, scientific and medical X LNA Low noise amplifier LO Local oscillator LPF Low pass filter MC Monte Carlo MIM Metal insulator metal MLR Maximum length of resistors NF Noise figure PA Power amplifier PC Personal computer PCB Printed circuit board PD Phase difference PDF Probability density function PM Phase mismatching PPF Polyphase filter PPFANA Polyphase filter analysis toolbox PPFN Polyphase filter network PPFOPTIMA Polyphase filter optimization toolbox PS Postlayout simulation PT Process tolerances QAM Quadrature amplitude modulation QM Quadrature modulation QPSK Quadrature phase shift keying RC Resistance capacitance RF Radio frequency SA Simulated annealing SiGe Silicon germanium SoC System on a chip VCO Voltage controlled oscillator WLAN Wireless local area network WCDMA Wideband code division multiple access XI List of Symbols AI Amplitude of the I path output signal in RF CMOS PPFs AQ Amplitude of the Q path output signal in RF CMOS PPFs AR e Fitting parameter for the standard deviation of σ R e AR sh Fitting parameter for the standard deviation of σ R sh A∆w Fitting parameter for the standard deviation of σ ∆w CC Parasitic capacitance between back plate of the capacitor and the substrate Ci Capacitor of the ith stage in the RF CMOS PPFs Ci , CM Capacitor of the ith stage with component mismatch between I path and Q path in the RF CMOS PPFs Ci , PT Capacitor of the ith stage with process tolerance in the RF CMOS PPFs CI , i Capacitor of the ith stage in the I path of the RF CMOS PPFs Cpara Parasitic capacitance CQ, i Capacitor of the ith stage in the Q path of the RF CMOS PPFs CR Parasitic capacitance between polysilicon resistor and the substrate Csum Sum of parasitic capacitance between RF CMOS PPFs and the substrate CuaC Parasitic capacitance between unit area capacitor and the substrate CuaCi Parasitic capacitance between the capacitors in the ith stage and the substrate CuaRi Parasitic capacitance between the resistors in the ith stage and the substrate XII Cunit Unit capacitance of the capacitor d phase Phase difference between I path and Q path in PPFs f Frequency of a signal fa Constant describing influences of area on mismatch fp Constant describing influences of periphery on mismatch fd Constant describing influences of distance on mismatch Fi Fitness of the individual i H(jω) Transfer function of polyphase filters H I (jω) Imaginary part of the transfer function of polyphase filters H R (jω) Real part of the transfer function of polyphase filters Iin Input current in RF CMOS PPFs I k , in The k th input current in RF CMOS PPFs I k , out The k th output current in RF CMOS PPFs I out Output current in RF CMOS PPFs Lmax,Res Maximum length of the resistor LR Length of the resistor MC Mismatch between the neighboring capacitors M CMC Component mismatch of the capacitors M CMR Component mismatch of the resistors MR Mismatch between the neighboring resistors mgain,CM Gain mismatch in RF CMOS PPFs with component mismatch mgain,ideal Gain mismatch in the ideal RF CMOS PPFs mgain, PT Gain mismatch in RF CMOS PPFs with process tolerances mphase Phase mismatch in RF CMOS PPFs mphase,CM Phase mismatch in RF CMOS PPFs with component mismatch XIII mphase,ideal Phase mismatch in the ideal RF CMOS PPFs mphase,PT Phase mismatch in RF CMOS PPFs with process tolerances N unit Number of unit capacitor Pj Probability of selection of the j population PR Process tolerance of the resistors Q Quality factor Re End resistance of a resistor Ri Resistor of the ith stage in the RF CMOS PPFs Ri , CM Resistor of the ith stage with component mismatch between I path and Q path in the RF CMOS PPFs RI, i Resistors of the ith stage in the I path of the RF CMOS PPFs Ri , PT Resistor of the ith stage with process tolerance in the RF CMOS PPFs RIR Image reject ratio RQ, i Resistors of the ith stage in the Q path of the RF CMOS PPFs Rsh Sheet resistance of resistor Rsub Resistivity of the substrate RUIR Ultimately obtainable image reject ratio S Ci Area of the capacitor in the ith stage in RF CMOS PPFs S Ri Area of the resistor in the ith stage in RF CMOS PPFs SR Area of a resistor Vin Input voltage in RF CMOS PPFs Vk , in The k th input voltage in RF CMOS PPFs Vk , out The k th output voltage in RF CMOS PPFs VI, in Real part of the input signal in RF CMOS PPFs VI, mid Intermediate I path signal XIV VQ, mid Intermediate Q path signal VIout I path output signal in RF CMOS PPFs Vout Output voltage in RF CMOS PPFs VQ, in Imaginary part of the input signal in RF CMOS PPFs VQout Q path output signal in RF CMOS PPFs WR Width of a resistor wi Weight of the ith item Y Admittances ω Angular frequency ωIF Angular frequency of the intermediate frequency signal ωimage Angular frequency of the image ωLO Angular frequency of the signal from the local oscillator ωRF Angular frequency of the radio frequency signal ωsignal Angular frequency of the signal σa Standard deviation of mismatch caused by area variation σ component Standard deviation of component mismatch σd Standard deviation of mismatch caused by distance σp Standard deviation of mismatch caused by periphery σ Re Standard deviation of the end resistance σ R sh Standard deviation of the sheet resistance σ ∆w Standard deviation of the width of a resistor φ Phase of a signal θ Relative phase difference in RF CMOS PPFs ∆A Amplitude mismatch in volts ∆φ Phase mismatch in degrees XV Chapter 1 Introduction Chapter 1 Introduction 1.1 Wireless Communications With Single Chip Transceivers The wireless communications market has grown substantially during the last decades; there has always been pressure to reduce both the size and the cost of wireless products. However, nowadays, in most designs, the analog part of receivers use multiple packages and/or multiple integrated circuits (ICs) which are implemented in gallium arsenide (GaAs) or silicon germanium (SiGe) bipolar processes, while baseband components are fabricated in low-cost complementary metal oxide semiconductor (CMOS) processes [1]. Since analog and digital components are designed for different processes, it is cumbersome to integrate RF, analog and baseband in a single chip and cost cannot be easily lowered. Since a couple of decades ago, there have been tremendous endeavors in developing CMOS wireless single chip transceivers, i.e., integrated transmitter and receiver. Some pioneers, just name a few, Abidi [6, 8, 9] at University of California at Los Angeles, Steyaert [23, 32] at Katholiek Universiteit Leuven, and Lee [2, 3] at Stanford University, have contributed by both theoretical studies and practical system implementations. Since the middle of the 1990s, more efforts have been put in developing CMOS single chip transceivers with applications to various standards, for example, global system for mobile communications (GSM), digitally enhanced cordless telephony (DECT), Bluetooth, wireless local area network (WLAN), etc. 1 Chapter 1 Introduction Even though there are a lot of GaAs, SiGe, bipolar circuits available, it is still quite a challenge to implement similar circuits in CMOS processes. Oriented for digital circuit design, a standard CMOS process has poor analog, and especially radio frequency (RF) performance because of its process tolerances, parasitic effects, and low quality (Q) factor passive components [2]. Thus, insights into transceiver architectures which are integrateble and capable of providing good CMOS transceiver performances become essential. 1.2 Analog Conversion and Complex Mixing In RF receivers, frequency downconversion is an essential operation. Typically, frequency downconversion of a passband signal is performed by multiplying, i.e., mixing, the signal with a sinusoid such as cos(2 πf LOt ) . In Figure 1.1 [24], case 1, f LO is not equal to the center frequency of the desired signal. This setup is used in a heterodyne receiver. Figure 1.1 case 2 shows the situation for f LO equals to the center frequency of the desired signal. This principle is used in the homodyne receiver. In the next section, we will discuss the architecture of heterodyne and homodyne receivers in more details. The spectra of the inputs of the mixer and the corresponding spectrum of the output of the mixer are shown in Figure 1.1 to help understanding the frequency response. For a real signal, the negative and positive Fourier components are complex conjugates of each other. A multiplication in the time domain is equivalent to a convolution in the frequency domain. Since the Fourier transform of a sinusoid contains two equal-amplitude impulses symmetrically placed around zero on the frequency axis, the spectrum of the mixer output signal is the superposition of the positive and negative 2 Chapter 1 Introduction shifted versions of the spectrum of the input signal. From Figure 1.1, we can see that, two frequency bands symmetric around the multiplying frequency are downconverted to the same output band. The undesired input signal band, which will be superimposed on the desired signal band after mixing, is called the ‘image band’. This is an important issue in the design of a heterodyne receiver. It is necessary to suppress any signal in the image band prior to the mixing operation. This is the task of the image reject (IR) filter which usually precedes the mixer. In the special case where the multiplying frequency is equal to the center frequency of the incoming signal, the image band is the same as the signal band, and the image cannot be eliminated by filtering. x(t ) Spectra of the signals in the image band y (t ) cos(2 πf LOt ) Case2 Case1 Amplitude Amplitude f f - f LO - f LO f LO f Spectra of the desired signals Figure 1.1 Mixing a real signal with a real sinusoid. 3 f LO f Chapter 1 Introduction The image problem arises due to the fact that the frequency spectrum of a real sinusoid contains impulses at both positive and negative frequencies. One way to avoid this problem is to mix the signal with a complex exponential which can be expressed as: e − j2π fLOt = cos(2π f LOt ) - jsin(2π f LO t ) . (1.1) Mixing a real signal with this negative frequency complex exponential gives a complex signal whose spectrum is a shifted version of the real signal spectrum. Theoretically, this eliminates the image problem associated with frequency shifting when mixing with a real sinusoid. The realization of a multiplier for mixing a real signal with a complex exponential requires two real multipliers as shown in Figure 1. 2. yr (t ) cos(2 πf LOt ) xr (t ) 0° 90° cos(2 πf LOt ) sin ( 2πf LOt) yi (t ) Figure 1.2 Mixing a real signal with a complex exponential [24]. Now, consider the mixing process shown in the above figure in a general way. Mixing two complex signals x(t ) and z (t ) generates: y (t ) = x(t ).z (t ) = ( xr (t ).zr (t ) - xi (t ).zi (t )) + j ( xr (t ).zi (t ) + xi (t ).zr (t )) , (1.2) yr (t ) = xr (t ).zr (t ) - xi (t ).zi (t ) , (1.3) yi (t ) = xr (t ).zi (t ) + xi (t ).zr (t ) . (1.4) 4 Chapter 1 Introduction A practical realization of this complex mixer using four real mixers and two adders is shown in Figure 1.3. This realization is used in the wideband doubleconversion receiver discussed in the next section. cos(2 πf LOt ) Adder xr (t ) yr (t ) sin( 2 πf LOt ) xi (t ) yi (t ) Adder cos( 2 πf LOt ) Figure 1.3 A practical implementation of the complex mixer [24]. 1.3 State-of-the-Art of Wireless Transceiver Architectures 1.3.1 Introduction In this section, we briefly review state-of-the-art receiver topologies and discuss their advantages and disadvantages. For a given receiver architecture, there exists a corresponding transmitter architecture with essentially the same fundamental building blocks. Therefore, we focus on receiver structures. 5 Chapter 1 Introduction 1.3.2 Conventional Heterodyne Receiver Architecture Most of today’s commercially available RF transceivers utilize some variant of the conventional heterodyne architecture. In a heterodyne receiver, as shown in Figure 1.4, the RF front-end preselection filter serves to remove out-of band signal energy as well as partially reject image band signals. After this prefiltering, the received signal is amplified by a low-noise amplifier (LNA). The IR filter following the LNA further attenuates the undesired signals at the image band frequencies. The desired signal at the output of the IR filter is then downconverted from the carrier frequency to a fixed intermediate frequency (IF) by mixing with the output of a local oscillator (LO). Low-pass Filter Mixer RF ADC Bandpass Bandpass LNA Mixer PGA IR Filter Filter I 0° 90° Preselection Bandpass (RF) Filter D S P LO 2 Q LO1 ADC Mixer Low-pass Filter Figure 1.4 A generic heterodyne receiver. In conventional heterodyne receivers, high performance, low phase noise voltagecontrolled oscillators (VCOs) employed as LOs are realized with discrete components such as high quality (Q) factor inductors, varactors and diodes [3]. At the output of the 6 Chapter 1 Introduction mixer, an IF filter, typically followed by an IF programmable-gain amplifier (PGA), selects the desired channel and reduces the distortion and dynamic range requirements of the subsequent receiver blocks [3]. The signal can be shifted to baseband and demodulated or alternatively further downconverted to lower IFs, and then shifted to baseband and demodulated. Since, at the carrier frequency the desired band and image band are separated by twice the IF, it is desirable to choose a high IF to reduce the requirements on the IR filter. In fact, if the IF is chosen high enough that the RF filter can sufficiently attenuate the image band; it might be possible to directly connect the output of the LNA to the mixer without including an IR filter [24]. On the other hand, since channel selection in a heterodyne system is done at the IF, a low IF allows the employment of higher quality channel-select filters. Therefore, the choice of the IF depends on the trade-off between image rejection and channel selection. Conventionally, all the filters used in the heterodyne system are high-Q discrete component filters, such as surface acoustic wave (SAW) or ceramic filters. Compared to other receiver architectures discussed below, the heterodyne receiver has superior performance with respect to selectivity, a measure of a receiver’s ability to separate the desired band around the carrier frequency from signals received at other frequencies, and sensitivity, the minimal signal level at the receiver input for which there is sufficient signal-to-noise ratio (SNR) at the receiver output. This is achieved with the use of high-Q discrete components [3], which mainstream CMOS processes do not have. Thus, the conventional heterodyne receiver is not well suited to be integrated onto a CMOS single chip. 7 Chapter 1 Introduction 1.3.3 Direct-Conversion Receiver Architecture Direct-conversion receiver (DCR), also known as homodyne receiver or zero-IF receiver [84], is a natural approach to convert an RF signal directly down to baseband. This architecture, shown in Figure 1.5, employs low-pass filtering in the baseband to suppress nearby interferers and select the desired channel. The homodyne architecture has several fundamental advantages over its heterodyne counterpart [8]. The IF stages and the IR filters are removed, furthermore, the absence of the bulky off-chip IR filters removes the requirement on the LNA to drive a low impedance load. The functions of channel selection and subsequent amplification at a nonzero IF are replaced by low-pass filtering and baseband amplification, amenable to monolithic integration [8]. Despite this suitability for higher levels of integration, a homodyne receiver has the following issues that either do not exist or are not as serious in a heterodyne receiver. Mixer PGA Low-pass Filter ADC RF LNA I 0° 90° Bandpass RF Filter D S P LO Q ADC Mixer PGA Low-pass Filter Figure 1.5 A generic homodyne receiver [8]. 8 Chapter 1 Introduction DC-Offsets — Perhaps the most serious problem is that of direct current (DC) offsets in the baseband section of the homodyne receiver [4]. These extraneous offset voltages can corrupt the desired signal and/or saturate the following stages. They arise due to the self-mixing phenomenon of the local oscillator or the in-band interferer, aside from the usual element mismatch in the signal path circuitry. RF Filter LNA Mixer IF LO Self - mixing Figure 1.6 Self-mixing of the LO and/or of an interfere in homodyne receiver frontend. To better understand the origin of these offsets, consider the received signal path shown in Figure 1.6. First, the isolation between the LO port and the inputs of the mixer and the LNA is not perfect, and a finite amount of feedthrough exists from the LO port to the other mixer input and to the input of the LNA. Known as LO leakage, this effect arises from capacitive and substrate coupling and, if the LO signal is provided externally, through bond-wire coupling [21]. The leakage signal appearing at the inputs of the LNA and the mixer is now mixed with the original LO signal, thus producing a DC component at the output of the mixer [21]. This LO self-mixing can be quite severe, and a time-varying DC-offset occurs when the LO signal leaks out through the antenna, and is radiated and reflected from nearby objects back to the receiver [21]. A similar 9 Chapter 1 Introduction effect occurs if a large interferer in the passband of the RF filter leaks from the LNA output to the mixer LO port and gets multiplied by itself [24]. From the above discussion, we can see that direct-conversion receivers require appropriate methods to remove undesired DC offsets. A simple approach is to use alternate current (AC) coupling in the downconverted signal path [21]. However, the spectra of all the spectrally efficient modulation schemes currently used exhibit significant energy at and around DC, this kind of signals are corrupted by AC coupling filters [4]. A better method is the use of baseband analog and/or digital signal processing (DSP) techniques for offset estimation and cancellation [3][24]. However, these techniques add complexity and do not solve the problems associated with 1/f noise at low frequencies in CMOS implementations, another significant issue. I/Q Mismatch — For most currently used modulation schemes, a homodyne receiver must incorporate quadrature downconversion to avoid loss of information. This requires shifting either the RF signal or the LO output by 90°, generating an in-phase (I) path and a quadrature-phase (Q) path. Since phase-shifting the RF signal generally entails severe noise, power, gain trade-offs [2] and is especially difficult for the wideband signals used in high data-rate systems, it is often desirable to shift the LO output. In either case, the errors in the nominally 90° phase shift and mismatches between the amplitudes of the I and Q signal paths corrupt the downconverted signal constellation, thereby increasing the bit error ratio (BER). To gain more insight into the effect of I/Q mismatch, and show the versatility and convenience of using complex formulation, consider the practical case where the quadrature LO generates the complex signal: xLO (t ) = cos(ωLO t ) - j(1 + ∆A) sin(ωLO t + ∆φ ) 10 (1.5) Chapter 1 Introduction Here ∆A and ∆φ represent LO gain and phase errors. One can rewrite the quadrature LO output as: 1 1 xLO (t ) = [1-(1 + ∆A)e j∆φ ]e jωLOt + [1+(1 + ∆A)e- j∆φ ]e- jωLOt 2 2 (1.6) Ideally, the complex LO output should contain only the negative frequency. However, from the above expression, it is apparent that, due to gain and phase errors, there is a positive frequency component with a magnitude of |1 − (1 + ∆A)e j∆φ | / 2 . This component causes interfering images and, if not compensated, can deteriorate the sensitivity of the receiver. Aside from the problems mentioned above, direct-conversion receivers are sensitive to even order distortions. Also, since the downconverted spectrum is located around zero frequency, the flicker (1/f) noise of the devices, a severe problem in CMOS implementations [2], has a profound effect on the signal-to-noise ratio (SNR). Furthermore, integrating the high-frequency low-phase-noise channel select frequency synthesizer is difficult to achieve with low-Q VCOs available in integrated circuits [3]. 1.3.4 Wideband IF Double-Conversion Receiver Architecture Shown in Figure 1.7 is the wideband double-conversion receiver [23]. In this receiver, after filtering and amplification, all potential RF channels are complex mixed and downconverted to IF. A second complex mixing is done from IF to baseband, using a tunable channel-select frequency-synthesizer. In this complex mixer, by properly adding the outputs of the real multipliers in pairs, the image frequencies are canceled while the desired channels add constructively. If the IF is chosen high enough, additional image rejection may be obtained from the RF frontend filter [3]. 11 Chapter 1 Introduction Comparing the homodyne receiver and the wideband IF double-conversion receiver, we can see that channel selection is performed in the baseband in both architectures, allowing the possibility of a programmable integrated channel-select filter for multi-standard receiver applications. 1st Mixing Stage 2nd Mixing Stage Low-pass Low-pass cos(2 πf LO2t ) Mixer Filter PGA Filter Adder ADC RF I LNA 0° 90° Bandpass Filter D S P sin(2 πf LO2t ) LO1 Q ADC Low-pass Adder PGA Low-pass Mixer Filter cos(2 πf LO2t ) Filter Figure 1.7 A wideband IF double-conversion receiver [23]. However, the wideband IF double-conversion receiver architecture has some advantages over its homodyne counterpart [21]. Due to the fact that channel tuning is performed using the IF LO, the RF LO can be implemented as a fixed-frequency crystal-controlled oscillator [25]. Several techniques may be utilized to realize a lowphase-noise fixed LO with low-Q on-chip components [3]. Also, since tuning is performed with the IF LO operating at a lower frequency, the phase-noise performance 12 Chapter 1 Introduction of this oscillator can be significantly better than that of the tunable RF oscillator employed in a homodyne receiver. Furthermore, since in the wideband IF system there is no LO operating at the same frequency as the incoming RF carrier, the potential problems associated with LO leakage and time-varying DC offsets are minimized [24]. Although in the wideband IF double-conversion receiver the second LO is at the same frequency as the desired IF channel, the DC offset which results at the baseband from self-mixing is relatively constant and may be cancelled using adaptive signal processing methods [3]. The limitations of wideband IF double-conversion receivers are the following: Since the first LO is fixed in frequency, all channels must pass through the IF stage. The desired frequency channel is selected using the second LO. This has two problematic implications: First, as a result of moving the channel selection to a lower frequency, the IF synthesizer requires a VCO with the capability of tuning across a broader frequency range than a small percentage of the nominal operating frequency. Second, by removing the channel-select filter from the first mixing stage, strong adjacent channel interferers are now a concern for the second mixer stage as well as the baseband blocks. This implies a higher dynamic range requirement for these latter receiver stages [25]. Also, I/Q phase and gain mismatch degrade the performance of the receiver [3]. 1.3.5 Low-IF Receiver Architecture The idea behind low-IF topologies is to combine the advantages of both heterodyne and homodyne receivers [23]. Figure 1.8 shows a low-IF receiver architecture [84], in which the IF is usually chosen at a low frequency, typically at a few hundred KHz. Low-IF architectures are suitable for the integration since they provide 13 Chapter 1 Introduction on-chip image rejection, and the channel selection can be done by using a low-Q filter following the mixer. Unlike the zero-IF architecture, a low-IF receiver is not sensitive to the parasitic DC offset, LO leakage, and even-order distortion [3]. Low-IF architectures also provide flexibility for processing the signal in multiple ways. One of the drawbacks of this architecture is its limited image rejection (~40 dB) due to the on-chip matching between I and Q generators [84]. Without proper pre-filtering, the dynamic range and resolution requirement on an analog-to-digital (A/D) converter can substantially increase. Also, an increase in current consumption results when this topology is used for wide-channel bandwidth application. PGA Mixer RF Phase Shifter 90° LNA I 0° 90° Adder LO Mixer D S P Low-pass Filter Q Band-pass Filter ADC PGA Figure 1.8 A generic low-IF receiver architecture [84]. 1.3.6 Selection of Transceiver Architecture in This Work In order to select a well suited transceiver architecture for this work on multistandard CMOS single-chip transceivers, based on the above analysis, the aforementioned receiver architectures, namely, heterodyne, homodyne, wideband IF 14 Chapter 1 Introduction double-conversion, and low-IF, were compared by using following Table 1.1. In this table, eight important aspects in the receiver design are ranked as ‘+’ and ‘++’, which -’ and ‘--’, which stands for stands for ‘advantage’ and ‘outstanding advantage’, ‘ ‘disadvantage’ and ‘severe disadvantage’, or ‘NO’, which stands for ‘no need to consider’. From Table 1.1, we can see that the low-IF receiver architecture has the most advantages. Thus, the low-IF receiver architecture is chosen in this work. Wideband Dual Architecture Heterodyne Homodyne Low-IF Conversion Items Sensitivity ++ - ++ + Image reject ++ NO + + DC offset NO NO NO Flicker noise NO IQ mismatch - -- -- -- - - - -- -- ++ ++ ++ ++ ++ ++ ++ -- + Multi-standard compatibility Integratebility Simplicity -- -- Table 1.1 Advantages and disadvantages of different receiver architectures. 15 Chapter 1 Introduction 1.4 Analysis of RF Quadrature Generation Techniques 1.4.1 Introduction As discussed in section 1.2, quadrature conversion is dominant in modern wireless transceiver design, because frequency modulation and phase modulation are deployed in most digital communication systems. In the low-IF receiver architecture we chose, quadrature signal generation is an important function block, because quadrature accuracy, that is the accuracy of 90° phase-shifted signal, directly determines the image reject ratio (IRR), an important specification determining the sensitivity of the receiver [23]. Generally, there are four quadrature generation techniques; namely, Havens’ technique, Frequency division, RC-CR networks and RC polyphase filters (PPFs). Although RC PPFs are cascaded RC-CR networks, there are significant differences between them in CMOS implementation. Thus, we take RC PPFs as an independent quadrature generation technique based on the ‘stagger-tuning’ techniques [55] used in this circuitry. 1.4.2 Haven’s Technique Figure 1.9 shows a schematic implementation of Haven’s technique [84]. This schematic consists of a phase splitter (phase shifter), two first limiters, two adders, and two further limiters. The phase splitter first splits the input signal Vin , creating 2 paths, namely, VI, mid and VQ, mid , with approximately 90° phase difference, then adds and subtracts them, producing the output signals VIout and VQout . 16 Chapter 1 Introduction In Haven’s technique, if VI, mid and VQ, mid have equal amplitudes, the angle between VIout and VQout is equal to 90° . The limiting stages will equalize the amplitudes of VI, mid and VQ, mid by phase shift circuit. Moreover, the adders’ outputs will have different amplitude if the phase difference between VI, mid and VQ, mid is not exactly 90° . Another amplitude mismatch in Haven’s technique is the capacitive coupling between the inputs of adders [23]. This may have significant effect in the phase imbalance at the input, if output impedance of the limiter is not small. Limiter + VI, mid Phase Splitter Vin Adder Limiter VIout + ≈90 o VQ, mid VQout + Limiter Adder Limiter Figure 1.9 Schematic of Haven’s technique [84]. 1.4.3 Frequency Division As shown in Figure 1.10, the idea of frequency division is to use a master-slave flip-flop to divide a signal by a factor of 2, if Vin has an exact 50% duty cycle, then there is an accurate 90° phase difference between VIout and VQout [23]. Generating quadrature signals using frequency division at radio frequency has the following main disadvantages: 17 Chapter 1 Introduction • It consumes a substantial power to generate a reference signal whose frequency is twice the operating frequency; for some CMOS processes with low cut-off frequency, this is simply impossible. For example, in the Fraunhofer-Institut für Mikroelektronische Schaltungen und Systeme (Fraunhofer-IMS) 0.6 µm CMOS process, the cut-off frequency is only 4.5 GHz; it is impossible to use frequency division for generating quadrature LO signal in the low-IF Bluetooth receiver, because a 4.9 GHz reference signal is required. • There is a considerable phase mismatch when the input duty cycle deviates from 50%, further more, mismatch in the signal path through the latches also contribute to the phase mismatch. Latch VIout VQout Vin Latch Figure 1.10 A frequency divider as a quadrature generator [84]. 1.4.4 RC-CR Networks An RC-CR (R-resistor, C-capacitor) network is a quadrature generation technique that shifts phases of the two signal paths by + π 4 and − π 4 respectively [23]. As shown in Figure 1.11, this circuit consists of a low-pass filter and a high-pass RC filter in two signal paths. In the RC-CR network, the phase differences between VIout and VQout is 18 Chapter 1 Introduction 90° for all frequencies, however, the amplitudes of the outputs are equal only at the corner frequency of the RC filter, that is, ω equals to 1/( RC ) . As the absolute values of the RC network vary with temperature and process, the corner frequency also varies; it is thus impossible to get a robust quadrature signal in CMOS technology by using RCCR networks. Moreover, this technique is only suitable for narrow band operation, because a good gain matching between two quadrature outputs can only be achieved with a very narrow band centered on the corner frequency of this RC-CR network. Low-pass Filter C R VIout Vin C VQout High-pass Filter R Figure 1.11 RC-CR networks as a quadrature generator [84]. 1.4.5 RC Polyphase Filter (PPF) From the above discussions, we can see that traditional quadrature generation techniques widely used in processes with high precision resistors and capacitors are not well suited to CMOS implementation. Therefore, alternative circuitries, which are 19 Chapter 1 Introduction robust against component mismatch and process variation, are needed. At this point, we would like to point out that process variation is often also termed as process tolerances. Originally, polyphase filters (PPFs) were developed by Gingell [45, 46] in 1971 for generating quadrature signals with even amplitude in audio. In 1994, integrated PPFs were rediscovered as an efficient RF quadrature generation technique in CMOS technology by Steyaert [55]. This has introduced PPFs into a new regime, which we name as RF CMOS PPFs. R1 Rm Rn VIout + Vin + C1 Cm Cn R1 Rm Rn VQout + C1 Cm Cn R1 Rm Rn VIout − Vin − C1 Cm Cn R1 Rm Rn Cm Cn C1 stage 1 stage m stage n Figure 1.12 Polyphase filter as a quadrature generator [55]. 20 VQout − Chapter 1 Introduction The topology of PPF is shown in Figure 1.12, and it can be viewed as ‘n’ stages of RC networks in cascaded connection [55]. Each stage is composed of four identical resistors and four identical capacitors. The resistors and capacitors vary from stage to stage. In Figure 1.12, Vin + and Vin − are the differential inputs, VIout + and VIout − are differential outputs of the I path, VQout + and VQout − are the differential outputs of the Q path. The principle of PPFs is a so-called ‘stagger tuning’ technique [55], that is, by using two or more cascaded stages of RC-CR networks, the amplitude of the quadrature signal generated can be smoothed, and the bandwidth can be extended. As a quadrature generator, PPFs have the following advantages over other traditional quadrature generation techniques [56]: • They are simple in implementation, because only resistors and capacitors are used. • Since a stagger-tuning technique is used in PPFs, they can overcome the problems brought by CMOS process variation without any other complicated tuning circuitry. • They are well suited for wideband quadrature signal generation. The above-mentioned features make PPFs well suited for the CMOS implementation, and nowadays, PPFs are widely used as quadrature generators at radio frequency (RF). In this work, we name them as RF CMOS PPFs for this specific application. Though PPFs are well suited to function as RF quadrature signal generator in a CMOS process, they have the following disadvantages: 21 Chapter 1 Introduction • Being passive filters, RF CMOS PPFs have insertion loss of 3 dB/stage. Buffers, i.e. amplifiers, are usually needed to compensate the signal attenuation. For high accuracy quadrature signal generation, multiple cascaded stages are needed in the PPFs, and the buffers are power hungry. • If PPFs are used in the signal path, thermal noise of the resistors deteriorates the noise figure (NF) of the receiver. The problems mentioned above can be overcome or reduced by the following techniques: • In order to reduce power consumption of quadrature generation in wireless transceiver design, direct-connection between voltage-controlled oscillator (VCO) and RF CMOS PPFs can be used. Borremans [60] successfully demonstrated that it is viable to connect RF CMOS PPF directly to VCO, thus power-hungry buffers can be skipped. • If RF CMOS PPFs are used in the signal path, proper values of resistors can be chosen to avoid deteriorating noise figure (NF) of the receiver. The values of resistors in the first stage of a PPF should be determined by the output impedance of the preceding component, for example, the LNA. And the values of resistors in the last stage of the PPFs should be as close as possible to 50 Ohms. By using this configuration, influences of the resistors on NF of the receivers can be controlled in an acceptable range [32]. From the above discussions, we find that RF CMOS PPFs have advantages over other conventional quadrature generation techniques in simplicity, bandwidth and robustness against CMOS process variation. Moreover, frequency division technique is 22 Chapter 1 Introduction not applicable in our project, thus, PPF is chosen as the quadrature generator in this dissertation. 1.5 Limitations of Previous Works Originally developed for generating quadrature signals with even amplitude in audio by Gingell [45, 46], PPFs have received a lot of attention in both theoretical analysis and practical designs [45-54]. In his doctoral dissertation, Gingell [48] did some simple analytical work for guiding the practical designs. As in discrete components implementation, matching and absolute values of resistors and capacitors are under control by properly selecting components, process variation is not an issue for this application. And in low frequency applications of PPFs, parasitic effects are usually not under consideration. In 1994, integrated PPFs were rediscovered as an efficient RF quadrature generation technique in CMOS technology by Steyaert [55]. Design of integrated RF CMOS PPFs faces many challenges, which were not considered by the pioneers. In 1994 and 1995, Schmidt [53] and Tetsuo [54] analyzed the PPFs in a systematic way by using vector analysis. Though vector analysis of PPFs provides insight into the mathematic representation of PPFs, it is too abstract for the designer to get quantitative results of the influences from process tolerance and components mismatch on the quadrature accuracy of the RF CMOS PPFs. The most comprehensive and important contribution so far in RF CMOS PPFs design is from Behbahani [62]; he analyzed practical design aspects and presented some 23 Chapter 1 Introduction design guidelines. For understanding the limitations of the design guidelines, let us analyze the main factors that should be considered in the design of an RF CMOS PPF. 1. CMOS process variation can be as much as 20%. The bandwidth of RF CMOS PPFs should be extended so that the band of interest can be covered even the worst case of the process variation occurs. 2. Quadrature accuracy (QA) is determined by component matching between the I path and the Q path. In order to get good component matching, the layout of resistors and capacitors should have large areas. 3. Parasitic effects in the RF CMOS PPFs cause signal losses and noise coupling problems. Specifically, parasitic capacitors cause noise coupling from both substrate and neighboring components; parasitic resistors make signal loss more severe than the theoretical value of 3 dB insertion losses in each stage of passive RC filters. In order to reduce unwanted parasitic effects, the layout of resistors and capacitors should be kept as small as possible. 4. Compared to active components, in CMOS RF transceivers, passive components usually consume more chip area, which is a main factor of cost. It is thus required to design chips as small as possible. From the above discussions, we can see that the main specification of the RF CMOS PPF, quadrature accuracy, is very layout dependent; and the requirements from component matching is contradictory to that of minimization of noise coupling, signal loss and chip area. Thus, a tradeoff, that is, an optimization, must be made in a specific design. By simply following Behbahani’s guidelines [62], it takes intensive trials and many design iterations to reach a good design. Furthermore, with layout considerations, 24 Chapter 1 Introduction optimization of RF CMOS PPFs cannot be achieved by using analytical calculations, because of many constraints and tradeoffs in the design. In this situation, a computer-aided analysis and design optimization tool for RF CMOS PPFs is of great help to the community of RF CMOS PPFs designers, especially for industrial projects, which are under time-to-market pressures. However, until now, there has not been such a dedicated tool available in the open literature, to the author’s best knowledge. 1.6 Objectives and Contributions of This Dissertation In order to solve the problems discussed in the previous section, the objective of this dissertation is to contribute a computer-aided analysis and design optimization tool for RF CMOS PPFs, which is in need for the community of RF CMOS PPFs designers. Based on the whole design flow and the silicon success of an RF CMOS PPF for a Bluetooth low-IF transceiver in the Fraunhofer-IMS 0.6 µm CMOS process, this dissertation has the following important contributions: 1. PPFANA, a dedicated computer-aided software tool developed by the author for analyzing the influences from the nonideal effects, namely, process tolerances and component mismatch on the quadrature accuracy of the RF CMOS PPFs, is presented. 2. Physical design considerations for RF CMOS PPFs in system-on-a-chip (SoC) solution are proposed by the author through the analysis of the influences from parasitic effects in SoC. 25 Chapter 1 Introduction 3. Silicon success of an RF CMOS PPF for a low-IF Bluetooth receiver using the Fraunhofer-IMS 0.6 µm CMOS process is reported. 4. The methodology of optimization of RF CMOS PPFs with layout considerations by using genetic algorithms (GAs) is illustrated. 5. PPFOPTIMA, a computer-aided synthesis and optimization tool for RF CMOS PPFs developed by the author, is presented. 6. Dedicated worst-case simulation and Monte Carlo (MC) simulation toolboxes for verification of the performance of RF CMOS PPFs are illustrated. 1.7 Outline of This Dissertation Chapter 1 begins with a discussion on CMOS single chip wireless transceivers, and then advantages and disadvantages of the state-of-the-art transceiver architectures are analyzed. Based on the analysis, the low-IF receiver architecture is chosen for the CMOS single-chip Bluetooth transceiver design. RF quadrature signal generation is an important functional block in modern wireless transceiver design. Through the analysis of quadrature generation techniques, PPF is chosen as the RF quadrature generator in our low-IF Bluetooth receiver. Existing problems in analysis, design and optimization of RF CMOS PPFs are analyzed, limitations of previous work in this topic are pointed out, and then objectives and contributions of this dissertation are clarified. In chapter 2, nonidealities in RF CMOS PPF design, namely, process tolerances and component mismatch, are analyzed by using the transfer function of PPFs. PPFANA, a computer-aided software tool for analysis of influences from process tolerances and component mismatch on the quadrature accuracy (QA) of RF CMOS 26 Chapter 1 Introduction PPFs developed by the author, is described. Based on the simplified RF models of resistors and capacitors, parasitic effects and their influences on RF CMOS PPFs are analyzed; techniques for minimizing unwanted noise coupling and signal losses are proposed and evaluated. Based on the analytical results from chapter 2, physical design considerations for RF CMOS PPFs to be implemented in System-on-a-Chip (SoC) solutions are proposed in chapter 3. The author designed an RF CMOS PPF for a low-IF Bluetooth receiver by using the Fraunhofer-IMS 0.6 µm CMOS process. The designed chip has been fabricated at the Fraunhofer-IMS in Duisburg. The author characterized the performance of the fabricated RF CMOS PPF by measurements. The design, fabrication, measurement procedure and measurement results are presented in chapter 3. Silicon success of this design lays a solid foundation for this dissertation. Quadrature accuracy (QA), the main specification in design of an RF CMOS PPF is determined by component matching which requires large chip area; however, in order to minimize unwanted noise coupling, signal loss and the cost, the chip area must be minimized. Thus, a tradeoff among these design parameters, that is, an optimization, must be made in the design. Chapter 4 is committed to the optimization of RF CMOS PPFs. First, the optimization problem is formulated with design specifications and constraints. Then, possible optimization algorithms like calculus-based optimization, gradient descend, simulated annealing (SA) and genetic algorithms (GA) are analyzed by the author. Based on the results of the analysis, GA is chosen as the optimization engine because of its advantages in escaping from local optima. The author implemented PPFOPTIMA, a GA based optimization tool for RF CMOS PPFs by using MATLAB. In order to facilitate designers in design automation, this tool has been 27 Chapter 1 Introduction further developed into a synthesis and verification environment for RF CMOS PPFs by the author, and the detailed implementation of PPFOPTIMA is described in chapter 4. Experiments on multistage RF CMOS PPFs for a given standard, and experiments on automated synthesis of RF CMOS PPF for different standards, such as, global system for mobile communications (GSM), digitally enhanced cordless telephony (DECT) and wide-band code division multiple access (WCDMA) demonstrate that PPFOPTIMA is effective and efficient in synthesis, optimization, and verification of RF CMOS PPFs. In chapter 5, contributions and conclusions from this dissertation are summarized, and directions for possible future work are pointed out. 28 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Chapter 2 Analysis of Nonidealities in RF CMOS PPFs 2.1 Introduction Polyphase filters (PPFs) were invented by Gingell [45, 46] in 1971, for generation of quadrature signals with even amplitude in audio. At that time, PPFs were implemented by using discrete components. In his doctoral dissertation, Gingell [48] did some simple analytical work for guiding the practical design. In 1994 and 1995, Schmidt [53] and Tetsuo [54] analyzed the PPFN in a systematic way by using vector analysis. In 1994, integrated PPFs were rediscovered as an efficient RF quadrature generation technique in CMOS technology by Stayaert [55], introducing PPFs into a new regime, which we name as RF CMOS PPFs. The design of integrated RF CMOS PPFs faces many challenges, which were not considered by the pioneers. In 2000, Galal [58, 59] analyzed the sensitivity of the RF CMOS PPFs in RF integrated transceivers. In 2001, Behbahani [62] analyzed the application of RF CMOS PPFs in image rejection. However, results from the open literature on the analysis of PPFs listed above have the following limitations: 29 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs 1. Gingell worked on audio frequency single sideband modulation [45-49]. At such low operating frequencies, the influences from parasitic resistors and capacitors are negligible. Thus, they were not considered in his publications. 2. In discrete components implementation of PPFs, components can be selected with any given specifications. Thus, component mismatch was not analyzed in [50-54]. 3. References [55-61] provide useful information about the analysis and the design of RF CMOS PPFs. However, until today, nonidealities, such as, process tolerances, component mismatch and parasitic effects, which are critical in RF CMOS PPF design and optimization, were not analyzed in a systematic way. 4. Though vector analysis of PPFs [53, 54, 62] provides insight into the mathematic representation of PPFs, it is too abstract for the designer to get quantitative results about the influences from process tolerance and components mismatch on the quadrature accuracy (QA) of RF CMOS PPFs. A dedicated computer-aided software tool for solving this problem is required by the design community of RF CMOS PPFs. However, this kind of computeraided tool has not been available to the author’s best knowledge. In order to solve the shortcomings mentioned above, based on the explicit transfer functions of PPFs, PPFANA, a dedicated computer-aided software tool for the 30 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs analysis and the simulation of influences from process tolerances and component mismatch on the quadrature accuracy of the RF CMOS PPFs, has been developed by the author, PPFANA will be presented in this chapter. By using simplified RF models of resistors and capacitors, parasitic effects in RF CMOS PPFs are analyzed. Furthermore, techniques for minimizing unwanted noise coupling and signal loss are proposed. 2.2 Vector Analysis of Polyphase Filters (PPFs) A polyphase signal is a set of two or more vectors having the same frequency but different phases [59]. If its vectors have the same magnitude and are equally spaced in phase, it is said to be symmetric. Consequently, a symmetric four-phase signal consists of two vectors of equal magnitudes having the same frequency and being separated in phase by 90 degrees. In general, polyphase filter networks (PPFNs) are networks having N input terminals and N output terminals [54]. These networks are physically symmetric in a way that the paths from each input to the corresponding output are symmetric. A PPFN is driven by a polyphase signal consisting of a number of vectors that correspond to the number of inputs of the PPFN. Although PPFNs are physically symmetric, they exhibit asymmetric responses to inputs of opposite polarities [54]. This sequencediscrimination property is the reason behind the name ‘sequence asymmetric’ [54]. The 31 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs response of a four-phase PPFN driven by a symmetric four phases input signal will be analyzed now. Since the four phases are symmetric, the chain matrix of a single phase represents the chain matrix of the network. The response of the same network to asymmetric inputs can be derived by resolving the input into a summation of symmetric inputs. Applying the rules of linear superposition, the output of the PPFN is then considered as the sum of the outputs cascaded by each symmetric input alone. e jθ Vk ,in Y2 I k ,in Vk ,in Y1 Y2 I k ,out Vk ,out e- jθ Vk ,out Figure 2.1 One phase of a generalized N-phase PPFN. Figure 2.1 shows the structure of one phase of a generalized N-phase PPFN, where admittance Y1 is connected between the input and the corresponding output, and admittance Y2 is skewed between the input and output of adjacent phases. Since the input is symmetric and the PPFN is physically symmetric, we expect the output to be also symmetric. The chain matrix of a single phase can be written as [58]: Vk ,in 1 = jθ I k ,in Y1 + e Y2 1 Vk ,out Y1 + Y2 , 2Y1Y2 (1 − cos θ ), Y1 + Y2 I k ,out 32 (2.1) Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Where θ represents the relative phase difference between V1 and the neighboring inputs, which in turn determines the polarity of the inputs. If θ <0, Vk , in will be leading e jθ Vk ,in in phase, which causes the inputs to be positive. On the other hand, if θ > 0, Vk , in will be lagging, thus causing the inputs to be negative. Resistance–capacitance (RC) PPFNs are a special case of sequence asymmetric PPFNs in which Y1 is equal to 1/ R and Y2 is equal to jωC . The structure of an RC four-phase PPFN is shown in Figure 2.2. In the following figure, Vk ,in , Vk ,out , k=1,2,3,4, are the four inputs and the four outputs of the RC PPFN, respectively. R V1,out V1,in C R V2,out V2,in C R V3,out V3,in C R V4,out V4,in C Figure 2.2 One-stage of an RC sequence asymmetric PPFN. 33 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs In four-phase PPFNs such as shown in Figure 2.2, the value of θ is either π / 2 or − π / 2 according to the polarity of the inputs. For such PPFNs, the chain matrix for positive inputs can be written as [59]: Vk ,in 1 + jω RC , R Vk ,out 1 = , I + 2 j ω ,1 j ω I C RC + 1 ω RC ,in ,out k k (2.2) while for negative inputs, we find [59]: Vk ,in 1 + jω RC , R Vk ,out 1 = . I k ,in 1 − ω RC 2 jωC ,1 + jω RC I k ,out (2.3) The open-circuit voltage transfer function for the negative part of the inputs is found for I k ,out equals to zero [59]: H(ω ) = Vk ,out 1- ω RC = , Vk ,in 1 + jω RC (2.4) while for the positive part of the inputs, we yield [59]: H( −ω ) = Vk ,out 1 + ω RC = Vk ,in 1 + jω RC (2.5) Sequence-asymmetric PPFNs can be considered as a generalized structure of the classical RC–CR network used for quadrature signal generation. Consider the M-stage four-phase PPFN shown in Figure 2.3(a), having a positive part of the outputs transfer function H(ω ) and a negative part of the outputs transfer function H( −ω ) , where H(ω ) ≠ H( −ω ) . The PPFN is driven by only two phases representing a differential input signal, while the other two inputs are connected as shown in Figure 2.3 (a). Figure 2.3(b) 34 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs shows the phasor representation of the input sequence which consists of two vectors separated in phase by 180 degrees. V1,in V1,out PPFN V2,in V V3,in V2,out V3,out H(ω ) V4,in V4,out (a) V /2 V /4 V /4 1 1 1 = 4 2 jV / 4 3 3 −V / 2 −V / 4 Inputs − jV / 4 + 2 4 jV / 4 − jV / 4 3 −V / 4 Negative part of the outputs Positive part of the outputs (b) Figure 2.3 Quadrature signal generation using four-phase PPFNs (a) Circuit diagram. (b) Decomposition of the two-phase inputs into two parts of four-phase outputs. To be able to understand how quadrature phases are generated from a single input, the inputs can be represented as the sum of two parts of four-phase outputs of different 35 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs polarities. Using linear superposition, the PPFN output can be expressed as the sum of the outputs, separately. It should be noted that the voltage transfer function for any phase in the positive part is H(ω ) , while that for any phase in the negative part is H( −ω ) . Thus, the output phases can be written as: V ((H(ω ) + H(-ω )) , 2 V V2,out (ω ) = - j ((H(ω ) - H(-ω )) , 2 V V3,out (ω ) = - ((H(ω ) + H(-ω )) , 2 V V4,out (ω ) = j ((H(ω ) - H(-ω )) . 2 V1,out (ω ) = (2.6) (2.7) (2.8) (2.9) If we consider the in-phase component to be V1,out (ω ) − V3,out (ω ) , and the quadrature-phase component V2,out (ω ) - V4,out (ω ) , then we find: VI (ω ) = V (H(ω ) + H(-ω )) , (2.10) VQ (ω ) = - jV (H(ω ) - H(-ω )) , (2.11) The ratio of the quadrature-phase to the in-phase outputs of an RC single stage four-phase PPFN can be derived by substituting for H(ω ) and H( −ω ) . With (2.4) and (2.5), we yield from (2.10) and (2.11), VQ ( jω ) VI ( jω ) = jω RC (2.12) The disadvantage of the described PPFN is its limited frequency range within which good gain matching can be achieved between quadrature outputs. The two outputs, although in quadrature, have equal amplitudes only at a frequency equals to 1/ RC , which limits the use of this PPFN to narrow-band applications. Furthermore, the 36 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs gain and phase matching of the quadrature outputs is highly sensitive to the RC mismatch. To achieve broadband quadrature with better gain matching and reduced sensitivity to components mismatch, a two-stage PPFN could be employed [65]. The two outputs have equal amplitudes at two frequencies corresponding to the resonant frequencies of each stage. The voltage transfer ratio can be derived by multiplying the chain matrix of the two stages and evaluating the open-circuit voltage transfer function. From (2.10) and (2.11), we yield [65]: VQ ( jω ) VI ( jω ) = jω ( R1C1 + R2C2 ) 1 + ω 2 ( R1R1C2C2 ) (2.13) This creates a wide-band quadrature generator defined by the resonant frequencies 1 / 2πR1C1 and 1 / 2πR2 C 2 . For any input signal with frequencies lying in this band, the quadrature outputs are matched well in terms of gain and phase. The maximum gain error occurs at frequency ωmax , corresponding to the geometric mean of the two resonant frequencies. The maximum gain error at this frequency is given VQ ( jω ) VI ( jω ) where ωmax is equal to ωmax = 1 . ( R1 R2C2C2 ) 37 R1C1 + R2C2 , 2 ( R1R2C2C2 ) (2.14) Chapter 2 Analysis of Nonidealities in RF CMOS PPFs 2.3 PPFANA, a Software Tool for RF CMOS PPFs 2.3.1 Overview As discussed in the first chapter, vector analysis is very helpful in understanding the mathematical representation of PPFs; however, it is too abstract for the designer to get quantitative calculation on the quadrature accuracy (QA) of the PPFs. Furthermore, in design and optimization of RF CMOS PPFs, it is of great importance to analyze and simulate QA influenced by process tolerances and component mismatch. Unfortunately, there is not any efficient simulation tool openly available. Thus, PPFANA, a software analysis tool for solving the problems mentioned above has been developed in this work. The core of PPFANA is made up from explicit transfer functions, which will be derived in the following subsection. 2.3.2 Explicit Transfer Function of RF CMOS PPFs Explicit transfer functions of RF CMOS PPFs are obtained by multiplying chain matrices of each cascaded stages, then separating the real and imaginary parts. The relation between input and output can thus be expressed by values of resistors and capacitors and the operating frequency, explicitly. In CMOS wireless transceiver RF front-end design; 2-stage, 3-stage, and 4-stage RF CMOS PPFs are most widely used [68]. RF CMOS PPFs with more than four 38 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs cascaded stages are rarely used because of their severe insertion loss. For passive filters, there is a theoretical insertion loss of 3dB/stage. We therefore derive the explicit transfer function of a 4-stge RF CMOS PPF. Those of 2-stage and 3-stage RF CMOS PPFs can be derived by the same method used here. Details of the derivation are given in appendix 2 of this dissertation. The transfer function of 4-stage RF CMOS PPFs is set out from R1 Vin 1+jω R1C1 1 Iin = 1-ω R1C1 2jω C1 1+jω R1C1 R2 1+jω R2C2 1 1-ω R2C2 2jω C2 1+jω R2C2 R3 1+jω R3C3 1 1-ω R3C3 2jω C3 1+jω R3C3 (2.15) R4 Vout 1+jω R4C4 1 . 1-ω R4C4 2jω C4 1+jω R4C4 Iout The complex transfer function of the 4-stage RF CMOS PPF is given by H(jω )= N(jω ) , D(jω ) N(jω )=(1-ω R1C1)(1-ω R2C2)(1-ω R3C3)(1-ω R4C4) , D(jω )=DR(ω )+jDI(ω ) , DR(ω )=1-ω 2 (R1R2C1C2+R1R3C1C3+R2R3C2C3 +R1R4C1C4+R2R4C2C4+R3R4C3C4 +2R1R3C1C4+2R2R3C2C4+2R1R2C2C4 +2R1R2C1C4+2R1R3C3C4+2R2R3C3C4 +2R1R3C2C3+2R1R2C2C3+2R1R4C2C4 +2R1R4C3C4+2R2R4C3C4+2R1R2C1C3 +4R1R3C2C4)+ω 4 (R1R2R3R4C1C2C3C4), 39 (2.16) (2.17) (2.18) (2.19) Chapter 2 Analysis of Nonidealities in RF CMOS PPFs DI(ω )=ω (R1C1+R2C2+R3C3+R4C4+2R3C4+2R1C2+2R1C3 +2R2C3+2R2C4+2R1C4)-ω 3 (R1R2R3C1C2C3 +R1R2R4C1C2C4+R1R3R4C1C3C4+R2R3R4C2C3C4 +2R1R2R3C1C2C4+2R1R2R3C2C3C4+2R1R2R3C1C3C4 +2R1R3R4C2C3C4+2R1R2R4C2C3C4+2R1R2R4C1C3C4). (2.20) Equation (2.15) can also be expressed as: H(jω )=H1(jω )+jH2(jω ) , H1(jω )= (2.21) 1+aω 2 +bω 4 , D(jω ) a=R1R2C1C2+R1R3C1C3+R2R3C2C3 +R1R4C1C4+R2R4C2C4+R3R4C3C4 b=R1R2R3R4C1C2C3C4 , H2(jω )= cjω +djω 3 , D(jω ) c=R1C1+R2C2+R3C3+R4C4 , d=R1R2R3C1C2C3+R1R2R4C1C2C4 . +R1R3R4C1C3C4+R2R3R4C2C3C4 (2.22) , (2.23) (2.24) (2.25) (2.26) (2.27) 2.3.3 Development of PPFANA With the explicit transfer functions we derived in subsection 2.3.2, the quadrature accuracy of an RF CMOS PPF with given values of resistors, capacitors and operating frequency can be calculated by using MATLAB. In order to make it easy to use, graphical user interfaces (GUIs) have been developed for PPFANA. The GUI of PPFANA for 4-stage RF CMOS PPFs is shown in Figure 2.4. The GUIs for the 2-stage and 3-stage RF CMOS PPFs are similar to this one. 40 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Figure 2.4 Graphical user interface of PPFANA for 4-stage RF CMOS PPF. In PPFANA, quadrature accuracy (QA), is measured by gain mismatch (GM) and phase mismatch (PM), the smaller GM and PM are, the better QA is. From Figure 2.4, we can see PPFANA has following features: • QA influenced by process tolerance (PT) and component mismatch (CM) can be analyzed independently. 41 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs • QA influenced by PT and CM can be analyzed at the same time. • Worst-case QA can be analyzed. • Default values for an RF CMOS PPF designed for a low-IF Bluetooth receiver in Fraunhofer-IMS 0.6 µm CMOS technology are given as an example for new users. In the following sections, simulation results for QA influenced by PT and CM will be presented. The simulation results will be compared with those obtained with the commercial RF circuit simulator-Cadence SpectreRF to verify the effectiveness of PPFANA. 2.4 Analysis of Quadrature Accuracy in Ideal PPFs In this section, the quadrature accuracy (QA) of ideal PPFs is investigated by using PPFANA. In the transfer function derived in the last section, H1 ( jω ) , H 2 ( jω ) are complex signal of the I, Q path respectively. From the definition of complex numbers, we can derive the module and the complex angle. Gain mismatch, mgain , and phase mismatch, ∆φ , can be expressed by mgain =| 20 log10 | H1 ( jω ) | −20log10 | H 2 ( jω ) || , (2.28) mphase =|| ∠H1 ( jω ) - ∠H 2 ( jω ) | -90° | . (2.29) 42 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Notice that in Cadence simulations, it is more convenient to get phase difference, d phase , than phase mismatch, ∆φ , between I path and Q path by using AC simulation. For the purpose of comparison, we define a parameter, phase difference, d phase as d phase =| ∠H1 ( jω ) - ∠H 2 ( jω ) | . (2.30) Please note that in all of the equations related to mgain , ∆φ , d phase used in this dissertation, the angular frequency ω is used for the convenience of expression of complex. Whereas in all of the figures related to mgain , mphase , d phase , frequency f is used for the purpose of comparison with Cadence simulation results. It is well known that ω equals to 2πf . Figure 2.5 Gain mismatch in ideal multi-stage RF CMOS PPFs tailored to the Bluetooth frequency range 2.4 GH to 2.48 GHz. 43 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Three ideal multi-stage (2-stage, 3-stage and 4-stage) RF CMOS PPFs for the frequency band of Bluetooth, i.e., 2.4 GHz to 2.48 GHz, were designed by the author and they were simulated by using PPFANA. Simulation results for the gain mismatch and phase difference in these ideal RF CMOS PPFs are shown in Figure 2.5 and Figure 2.6, respectively. Figure 2.6 Phase difference in ideal multi-stage RF CMOS PPFs tailored to the Bluetooth frequency range 2.4 GH to 2.48 GHz. From above figures, we can see the following: • For ideal RF CMOS PPFs, at the desired frequency, gain mismatch is almost zero, and phase difference is almost 90° . • With more cascaded stages, the useful bandwidth with less gain mismatch and phase mismatch can be extended. 44 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs In order to compare simulation results, these ideal RF CMOS PPFs were simulated with Cadence SpectreRF as well. Simulation results from Cadence SpectreRF and from PPFANA are listed in the following Table 2.1. Ideal RF CMOS PPFs ∆φ /degrees mgain /dB PPFANA SpectreRF PPFANA SpectreRF 2-stage 10−3 10−3 10−3 10−3 3-stage < 10 −3 < 10 −3 < 10 −3 < 10 −3 4-stage < 10 −3 < 10 −3 < 10 −3 < 10 −3 Table 2.1 Quadrature accuracy of ideal RF CMOS PPFs (2.4 GHz to 2.48 GHz), obtained by using PPFANA and SpectreRF. From these simulation results listed in the table above, we can see the following: • For ideal 2-stage RF CMOS PPFs, the gain mismatch is 10−3 dB and the phase mismatch is 10−3 degrees. • For ideal RF CMOS PPFs with more than 2 cascaded stages, the gain mismatch is less than 10−3 dB, and the phase mismatch is less than 10−3 degrees. Considering computational errors, these values can be taken as zero. Thus, we can say that ideal RF CMOS PPFs with more than two cascaded stages are almost perfect in quadrature generation. 45 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs • The simulation results of PPFANA are in accordance with those of Cadence SpectreRF. This validates the effectiveness of PPFANA. 2.5 Analysis of Quadrature Accuracy Influenced by Process Tolerance In CMOS processes, the actual values of identically designed and fabricated components can be different from wafer to wafer. The variation of the component values in a given CMOS process is called process tolerances, which is also named process variation. In this dissertation, these two terminologies are used without any difference. In high performance CMOS analog/RF circuit, tuning techniques are usually needed to overcome process tolerances. Most tuning techniques use variable capacitors or variable resistors and additional control circuits, making circuitries complicated. In RF CMOS PPFs, a special stagger-tuning technique [55] is used. The idea of this technique is to increase the bandwidth of the circuit, to guarantee a proper filter operation despite process tolerances. By using this special and simple tuning technique, conventional tuning techniques [55] are no longer needed in RF CMOS PPFs to overcome the influence from process variations. 46 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Let us generalize the equations of GM and PM in multi-stage PPFs and derive expressions for GM and PM influenced by process tolerances (PT). GM and PM in RF CMOS PPFs with ideal components are expressed as mgain,ideal and ∆φ , mgain,ideal = G( R1 , C1 ,L Ri , Ci ,L Rn , Cn ) (2.31) ∆φideal = F( R1 , C1 ,L Ri , Ci ,L Rn , Cn ) (2.32) Then we get GM and PM in RF CMOS PPFs with process tolerance mgain, PT and ∆φPT according to mgain,PT = G( RPT1 , CPT1 ,L RPTi , CPTi ,L RPTn , CPTn ) (2.33) ∆φPT = F( RPT1 , CPT1 ,L RPTi , CPTi ,L RPTn , CPTn ) (2.34) where G , F are gain and phase expressions of RF CMOS PPFs’ transfer functions, Ri , Ci , i = 1L n , are the nominal values of the resistors and capacitors, and RPTi , CPTi , i = 1L n , are the resistors and capacitors with process tolerance. In this work, gain mismatch and phase mismatch influenced by process tolerances in multi-stage RF CMOS PPFs have been simulated by using PPFANA. These RF CMOS PPFs are designed for the frequency band of Bluetooth, ranging from 2.4 GHz to 2.48 GHz, using the Fraunhofer-IMS 0.6 µm CMOS technology. In these simulations, the resistors are polysilicon resistors, in which process tolerance is ± 16% , and the capacitors are poly-N+ capacitors, in which process tolerance is ± 14% . Gain mismatch and phase mismatch are the worst value in the frequency band of interest, i.e. 2.4 GHz to 2.48 GHz. 47 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Figure 2.7 Gain mismatch influenced by process tolerance in a 2-stage RF CMOS PPF (2.4 GHz to 2.48 GHz) with regular design. Figure 2.8 Phase mismatch influenced by process tolerance in a 2-stage RF CMOS PPF (2.4 GHz to 2.48 GHz) with regular design. 48 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Figure 2.7 and Figure 2.8 show the gain mismatch and the phase mismatch influenced by process tolerance in a 2-stage RF CMOS PPFs with regular design, that is, it is designed with lower corner frequency at 2.4 GHz and higher corner frequency at 2.48 GHz without any technique to overcome the influences from process tolerance. From these figures, we can see the following: • Process tolerances have significant influence on the gain mismatch of the RF CMOS PPF, whereas, their influences on the phase mismatch of the RF CMOS PPF is not that obvious. • With regular design, RF CMOS PPF is not robust enough to overcome the influence from process tolerance. In order to get robust RF CMOS PPFs, the influence of process tolerances on the quadrature accuracy should be overcome. As the ‘stagger tuning’ technique is used in the polyphase filters, in practical design, we can extend the bandwidth to guarantee that the signal frequency band can be covered by worst-case lower and upper corner frequencies. This is the concept of tolerance design [102] in RF CMOS PPFs design. The 2-stage RF CMOS PPF was redesigned with tolerance design, and the gain mismatch influenced by process tolerances is shown in the following Figure 2.9. From this figure, we can clearly see that, the gain mismatch is no longer sensitive to process tolerance. Thus, tolerance design should be applied in design of RF CMOS PPFs. 49 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Figure 2.9 Gain mismatch influenced by process tolerance in a 2-stage RF CMOS PPF (2.4 GHz to 2.48 GHz) with tolerance design. RF CMOS PPFs ∆φPT /degrees mgain, PT /dB PPFANA SpectreRF PPFANA SpectreRF 2-stage 0.220 0.224 0.500 0.509 3-stage 0.015 0.017 0.050 0.053 4-stage 0.002 0.002 < 10 −3 < 10 −3 Table 2.2 Quadrature accuracy of RF CMOS PPFs (2.4 GHz to 2.48 GHz) with process tolerance, obtained by PPFANA and SpectreRF 50 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs In order to compare the quadrature accuracy of multi-stage RF CMOS PPFs influenced by process tolerance and to compare simulation results obtained by using PPFANA and those by using Cadence SpectreRF, three RF CMOS PPFs with two, three and four cascaded stages, respectively were designed for the frequency band of Bluetooth with tolerance design. Simulation results for the gain mismatch and for the phase mismatch of these RF CMOS PPFs are shown in Table 2.2, from which we can see the following: • Quadrature accuracy of RF CMOS PPFs is influenced by process tolerances, significantly. • By using more cascaded stages, the quadrature accuracy of the RF CMOS PPFs can be improved. • The simulation results from PPFANA are in accordance with those from Cadence SpectreRF. 2.6 Analysis of Quadrature Accuracy Influenced by Component Mismatch In CMOS processes, two neighboring components that are ideally supposed to be identical can have slight differences. This phenomenon is called component mismatch (CM) [81]. Ideally, in RF CMOS PPFs, components in the I path and in the Q path 51 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs should be identical; however, in practice, this is impossible to achieve because of component mismatch. Now, let us generalize the transfer functions of multi-stage PPFs and analyze both the GM and the PM influenced by component mismatch (CM) between I path and Q path, we yield mgain,ideal =| G I ( RI1 , CI1 ,L RIn , CIn ) - G Q ( RQ1 , CQ1 ,L RQn , CQn ) | , ∆φideal =|| FI ( RI1 , CI1 ,L RIn , CIn ) - G Q ( RQ1 , CQ1 ,L RQn , CQn ) | -90o | . (2.35) (2.36) Furthermore, we get mgain,CM =| G I ( RICM1 , CICM1 ,L RICMn , CICMn ) - G Q ( RQCM1 , CQCM1 ,L RQCMn , CQCMn ) | , (2.37) ∆φCM =|| FI ( RICM1 , CICM1 ,L RICMn , CICMn ) - FQ ( RQCM1 , CQCM1 ,L RQCMn , CQCMn ) | -90o | . (2.38) In (2.37) and (2.38) RICMk equals (1 ± CM) RIk , RQCMk equals (1 m CM) RQk , CICMk is (1 ± CM)CIk , and CQCMk is (1 m CM)CQk , k = 1L n , n is the number of cascaded stages in a given RF CMOS PPF. In the equations above, mgain,ideal and ∆φideal are the gain mismatch and the phase mismatch of RF CMOS PPFs with ideal resistors and capacitors, mgain, CM and ∆φCM are the gain mismatch and the phase mismatch of RF CMOS PPFs with component mismatch, FI , FQ , G I , G Q are I path and Q path gain and phase expressions derived from multi-stage RF CMOS PPFs’ transfer functions, RIk , CIk , RQk , CQk are nominal values of resistors and capacitors in I path and Q path, 52 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs RICMk , CICMk , RQCMk , CQCMk are values of resistors and capacitors in I path and Q path with component mismatch. In this work, quadrature accuracy influenced by component mismatch in multistage RF CMOS PPFs has been simulated by using PPFANA. These RF CMOS PPFs were designed for the frequency band of Bluetooth, using Fraunhofer-IMS 0.6 µm CMOS technology. In the simulations, the resistors are polysilicon resistors, and the capacitors are poly-N+ capacitors. In order to compare the quadrature accuracy influenced by different levels of component mismatch, 1% and 2% component mismatch between neighboring resistors, and neighboring capacitors were simulated. Gain and phase mismatches are the worst value in the band of interest, i.e., 2.4 GHz to 2.48 GHz. The simulation results are shown in Table 2.2. RF CMOS PPFs resistors and capacitors with 1% resistors and capacitors with 2% component mismatch component mismatch mgain, CM /dB ∆φCM /degrees mgain, CM /dB ∆φCM /degrees PPFANA PPFANA PPFANA PPFANA 2-stage 0.210 0.520 0.230 0.530 3-stage 0.025 0.030 0.060 0.090 4-stage 0.015 0.020 0.020 0.050 Table 2.3 Quadrature accuracy influenced by component mismatch in multi-stage RF CMOS PPFs (2.4 GHz to 2.48 GHz). 53 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs From the simulation results in Table 2.3, we can see the following: • Component mismatch has significant influence on quadrature accuracy of RF CMOS PPF. • Stronger component mismatch leads to worse quadrature accuracy, that is, more gain mismatch and phase mismatch. Though component mismatch cannot be totally eliminated in practice, layout techniques, such as, inter-digitized [77] and common-centroid [77] layout structures, are helpful to reduce the component mismatch to some extend. These techniques will be discussed in the Chapter 3. 2.7 Analysis of Influences from Parasitic Effects 2.7.1 Simplified RF Models of Resistors and Capacitors There are several types of resistors in CMOS processes; polysilicon resistors [81] are the most favorable selection for RF applications for its area efficiency and comparatively good robustness against parasitic influences. In compact models [75-80], polysilicon resistors are usually modeled as distributed resistors and capacitors. As in our application, the physical dimension of the resistors are much smaller than the wavelength of the Bluetooth RF signal, for the purpose of analysis, we simplify the distributed model into a simplified model as shown in Figure 2.8. 54 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs From Figure 2.10, we can see that polysilicon resistors with its parasitic capacitance can form a low-pass filter. In RF CMOS PPFs, current flows through resistors. If the corner frequency of the low pass filter formed is lower than that of the signal frequency, the signal is then cut off. This phenomenon is unwanted and should be avoided in RF CMOS PPF design. R Out In Cpara Cpara Rsub Rsub gnd gnd Figure 2.10 Simplified RF model of a polysilicon resistor [81]. Now, let us investigate how the problem mentioned above can be avoided in the design of RF CMOS PPFs. We have [81] f RCP = 1 1 1 = = , 2 L 2π RCpara 2π LWR C 2π L Rsh Cuap sh uap W f op L≤ ≤f RCP , 1 , 2π f op Rsh Cuap 55 (2.39) (2.40) (2.41) Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Lmax,res = 1 , 2π f op Rsh Cuap (2.42) where f RCP is the corner frequency of the filter formed by the polysilicon resistor and its parasitic capacitor to the substrate, f op is the operating signal frequency, Rsh is the sheet resistance of resistor, L is the length of the resistor, Cuap is parasitic capacitance per unit area to the substrate, Lmax, res is the maximum length of resistors can be used. From the derivations above, we can see that for a certain CMOS process and a given operating frequency of the RF CMOS PPF, before physical layout, the maximum length of the resistor should be calculated to avoid inappropriate physical design. Rp1 1 Cp1 Rp2 Cp1 2 Cp2 Cp2 Rsub Rsub gnd gnd Figure 2.11 Simplified RF model of a capacitor [81]. 56 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs In different CMOS processes, there are different kinds of capacitors, e.g. polypoly capacitors [81], poly-well capacitors [81], MOS capacitors [81], and metalinsulator-metal (MIM) capacitors [81]. The first three kinds of capacitors are fairly standard, whereas MIM capacitors are only available in advanced CMOS processes [81]. RF capacitors are modeled as distributed networks including parasitic resistors and capacitors [81]. As in our application, the physical dimension of the capacitors are much smaller than the wavelength of the Bluetooth RF signal, for the purpose of analysis, we simplified the distributed model as the model shown in Figure 2.11. Now, let us investigate the quality (Q) factors of the capacitor and make a comparison among different capacitors mentioned above. The Q factor is given by [81] 1 , RCω (2.43) R = Rsh N unit , (2.44) Q(ω ) = Insert (2.44) into (2.43), we get Q(ω ) = 1 . Rsh N unit Cω (2.45) In the above equations, R is the parasitic resistance of the capacitor, C is the nominal capacitance, ω is the operating frequency, Rsh is the sheet resistance of the plates, N unit is the number of unit squares. From (2.45) we can see that for a given capacitance C and a given operating frequency ω , there are two ways to improve quality factor of the capacitor: • Use capacitors with low sheet resistance plates. 57 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs • Use a low number of unit squares, e.g. N unit equals 1. As metal plates have less sheet resistance, the quality factor of metal-insulatormetal (MIM) capacitors is greater than that of poly-poly resistors, poly-well capacitors and MOS capacitors [81]. Thus, if possible, the use of MIM capacitors is highly recommended for design of RF CMOS PPFs. Furthermore, in the physical layout of capacitors, square capacitors should be used to get a greater quality factor. 2.7.2 Substrate Noise Coupling In CMOS single chip transceiver design, the whole transceiver system, including RF, analog and digital circuits, is integrated into a chip [99]. This concept is call system-on-a-chip (SoC) [99]. SoC design poses serious challenges different from conventional multi-chip or multi-package design, because digital circuits are placed on the same substrate with sensitive analog circuits [95]. Analog circuits Noise Coupling Noise Noise Digital circuits Noise Coupling Noise Noise Semiconductive Substrate Figure 2.12 Principle of substrate noise coupling in system-on-a-chip [99]. 58 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs The most critical issue in SoC design is substrate noise coupling [99], which occurs as a result of the conductive nature of silicon and the lack of perfect isolation between devices and the substrate [100]. Below frequencies of 5 GHz, the capacitive noise coupling is the main contributor to the substrate noise coupling [87, 88]. In this dissertation, the operating frequency is 2.45 GHz, which is well below 5 GHz. Thus, we consider only the capacitive noise coupling. In SoC design, digital circuits are usually noisy. Noise generated by digital circuits is injected into the substrate [99]. Due to the semi-conductive nature of the silicon substrate, the noise is then sensed by the sensitive analog circuit via capacitive coupling [99]. The principle of substrate noise coupling in SoC is shown in Figure 2.12 [99]. RF CMOS PPF In Out Cpara Cpara Rsub Rsub Noise Noise gnd gnd Figure 2.13 Simplified model of substrate noise coupling in RF CMOS PPFs. 59 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs Shown in Figure 2.13 is the simplified model of substrate noise coupling in RF CMOS PPFs. In this model, simplified RF models of resistors and capacitors together with noisy resistive substrate model are used. Now, let us analyze the noise coupled to the unshielded RF CMOS PPFs by the substrate noise coupling. The parasitic capacitance between the polysilicon resistor and the substrate ( CR ), and the parasitic capacitance between the capacitor and the substrate ( CC ) are CR = LRWR CuaR = S R CuaR , (2.46) CC = LCWCCuaC = SCCuaC . (2.47) Summing all capacitances, we get ∑ n Csum = 4 × ( SCi CuaCi + S Ri × CuaRi ) , (2.48) i =1 where i = 1L n , n is the number of cascaded stages, CR is the parasitic capacitance between the polysilicon resistors and the substrate, LR ,WR , SR are length, width and area of the polysilicon resistors, respectively, CuaR is the unit area parasitic capacitance of the resistors, CC is the parasitic capacitance between the capacitor back plate and the substrate, LC ,WC , SC are length, width and area of the capacitors, respectively, and CuaC is the unit area parasitic capacitance of the capacitors. In order to minimize noise coupling from the substrate, the parasitic capacitance between RF CMOS PPF and the substrate, i.e., Csum , should be minimized. In (2.48), for a certain CMOS process, CuaC , CuaR are known constants. Thus, what the designer 60 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs can do is to minimize the parasitic capacitance by minimizing the chip area. However, in practice, the chip area can only be reduced to a certain range, so noise coupling still exists [99], and in practice, it is impossible to get sufficiently low substrate noise coupling by only minimizing the chip area. Thus, noise isolation techniques, namely, NWell and guard ring should be applied [99]. For different types of substrates, these noise isolation techniques have different effects [93]. Categorized by resistivity in the substrates, there exist a high-resistivity substrate and a low-resistivity substrate in CMOS processes [93]. A high resistivity substrate is composed of a uniformly doped layer with a resistivity coefficient of 20 Ωcm to 50 Ωcm [93]. A low resistivity substrate consists of a thick, high resistivity epitaxial layer (10~15 Ωcm) and a low resistivity bulk (1 mΩcm) . Low resistivity substrates have been widely adopted for desirable latch-up suppression properties [93]. It has been found that at low and medium frequencies typically lower than 5 GHz, substrates show a resistive behavior [93]. At higher frequencies, the transport patterns are too complex to be accurately modeled by resistive or resistive-capacitive meshes [98]. In this dissertation, the operating frequency is well below 5 GHz, thus we use resistive network to model the substrate. In high-resistivity substrates, distance and guard rings are effective attenuation techniques to reduce signal interaction [93]. In low resistivity substrates, the current tends to flow through low impedance paths located deep in the chip’s lower layers; as a result, guard rings are generally ineffective in 61 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs blocking substrate currents [94]. In low-resistivity substrates the use of a very low impedance backplate contact is often preferred [99]. From the discussions above, we can see that the choice of the isolation techniques should be based on the property of a given CMOS process and the specific application. 2.8 Summary In this chapter, based on vector analysis, explicit transfer functions of multi-stage PPFs were derived. Non-idealities in RF CMOS PPFs design, namely, process tolerance, component mismatch, and parasitic effects, were analyzed. Important contributions and conclusions in this chapter are: • PPFANA, a software tool developed by the author for the simulation of the quadrature accuracy (QA) of RF CMOS PPFs, which are influenced by process tolerance and component mismatch, is presented. • As is shown that the process tolerance has significant influences on quadrature accuracy. In order to make an RF CMOS PPF robust against process tolerance, tolerance design is used. • Component mismatch also has an influence on the quadrature accuracy (QA). Solution for design: use layout technique to minimize component mismatch. 62 Chapter 2 Analysis of Nonidealities in RF CMOS PPFs • Parasitic effects in RF CMOS PPFs have been analyzed by using simplified RF models of resistors and capacitors. Physical design considerations for minimizing and isolating substrate noise coupling have been proposed. 63 Chapter 3 Design of an RF CMOS Polyphase Filter Chapter 3 Design of an RF CMOS Polyphase Filter 3.1 Overview In order to verify the effectiveness of PPFANA, an RF CMOS polyphase filter (PPF) for a low-IF Bluetooth receiver using Fraunhofer-IMS 0.6 µm CMOS process has been designed, fabricated and measured. Influences from process tolerances and component mismatch on the quadrature accuracy of the RF CMOS PPF designed have been analyzed by using PPFANA. Schematic and post-layout simulation results obtained by using Cadence SpectreRF have been compared with those obtained by using PPFANA. Silicon success of this design lays a solid foundation for this dissertation in the following two aspects: • Physical design considerations for RF CMOS PPFs in a system-on-a-chip (SoC) solution have been proposed based on the design practice. • Design heuristics from this practical design lay the basis for optimization of RF CMOS PPFs. 64 Chapter 3 Design of an RF CMOS Polyphase Filter 3.2 Schematic Design 3.2.1 Derivation of Specifications The specifications of RF CMOS PPFs can be derived from the wireless communication standards and the selected transceiver architecture. In our design of a Bluetooth receiver, a low-IF receiver architecture has been chosen because it incorporates advantages over heterodyne and homodyne receivers, providing high integratebility. The target specification related to the RF CMOS PPFs in the receiver is the desired image reject ratio (IRR), which can be obtained from system level simulation. In our low-IF Bluetooth receiver, the IRR is required to be greater than or equal to 36 dB in the frequency band of Bluetooth, that is, between 2.4 GHz and 2.48 GHz. The relationship between the IRR, the gain mismatch ∆A and the phase mismatch ∆φ can be expressed as follows [84]: ∆A 2 ∆φ 2 RIR = -20 log10 + 16( A + A ) 2 4 I Q (3.1) In (3.1) RIR is the IRR, and AI and AQ are the voltage gain of the I path and Q path output signal. Setting out from (3.1), the main specifications of the RF CMOS PPF, i.e. the gain mismatch and phase mismatch have been derived. In order to compare these target specifications and the simulation results obtained by using Cadence SpectreRF and PPFANA, the gain mismatch is expressed as: 65 Chapter 3 Design of an RF CMOS Polyphase Filter mgain = -20log10 ∆A (3.2) Detailed specifications of this RF CMOS PPF are listed in the Table 3.1. Frequency band / GHz mgain / dB ∆φ / degrees 2.4-2.48 ≤ 0.6 ≤5 RF CMOS PPF Table 3.1 Specifications of RF CMOS PPF for a low-IF Bluetooth receiver. 3.2.2 Design Guidelines In 2001, Behbahani [62] proposed the following guidelines for the design of RF CMOS PPFs: [Step1] Calculate the number of cascaded stages required in the PPF from the targeting image reject ratio (IRR) and the fractional bandwidth over which this rejection is required. [Step2] As an initial guess, place the two lowest and highest poles at the boundaries of the rejection band. Space the remaining poles equally on the logarithmic frequency axis. The actual pole locations are fine-tuned by simulations. [Step3] Specify the matching between the resistors and between the capacitors based on the desired IRR. This determines the physical area of the filter. 66 Chapter 3 Design of an RF CMOS Polyphase Filter [Step4] Large resistors will lower the power consumption of the amplifier driving the PPF input. Use the largest filter resistance, limited either by the maximum noise at the output or by the cut-off frequency. In low-noise or low frequency circuits, the first is the limiting factor, while in high-frequency PPFs it is the second. [Step5] To lower cascaded loss, taper down the resistance of the PPF stages toward the input. The resulting impedance of the input stage of the PPF will determine the drive requirements on the amplifier prior to the filter. [Step6] Design the driving amplifier. If the cascade filter loss is still too large, insert interstage amplifiers to preserve signal dynamic range within the PPF; the collinear common-mode signal at each output shifts the zero crossings and corrupts the final phase relationship among the outputs. Thus, the outputs must be sensed using linear differential circuits that reject the common mode. Though rather comprehensive, an important design consideration is missing in these design guidelines, that is, process tolerance should be considered in selecting lower and upper corner frequencies for the RF CMOS PPFs. The importance of tolerance design in design of RF CMOS PPFs has already been analyzed in the previous chapter 1; in this chapter we apply it to a practical design. 67 Chapter 3 Design of an RF CMOS Polyphase Filter 3.2.3 Tolerance Design In the design of RF CMOS PPFs, to guarantee that the worst-case circuit performance still satisfies the specifications, process tolerances should be considered by using the concept of ‘tolerance design’ [102]. Specifically, by enlarging the bandwidth of the PPF, the worst-case frequency range of the PPF can be guaranteed to be located in a given operating frequency band. In the Fraunhofer-IMS 0.6 µm CMOS process, sheet resistance of the polysilicon resistors used in this design varies from 36 Ω/square to 50 Ω /square, while the nominal value is 43 Ω/square. The unit capacitance of the poly_N+ capacitor in this process varies from 1.1 fF/µm 2 to 1.7 fF/µm 2 , whilst the nominal value is 1.4 fF/µm 2 . It is well known that the relationship between the corner frequency f corner of an RC filter and the values of resistors and capacitors is given by f corner = 1 . 2 πRC (3.3) From (3.3), we get the expression of RC time constant as follows: RC = 1 , 2 πf corner (3.4) where R is the resistors value, C is the capacitor value, and f corner is the corner frequency of this RC filter. For convenience of calculation of the RC time constant with tolerance design, we define the RC time constant variation ratio σ RC = ( R + ∆R)(C + ∆C ) × 100% RC 68 (3.5) Chapter 3 Design of an RF CMOS Polyphase Filter In (3.5) ∆R and ∆C are the process variations of the resistors and capacitors, respectively. Setting out from the Fraunhofer-IMS 0.6 µm CMOS process, we find σ RC equal to 41.2%. In order to overcome the influence of σ RC , we need to decrease the lower RC time constant, determined by higher corner frequency of the RC filter, and increase the higher RC time constant, determined by lower corner frequency, by 41.2% respectively. The lower corner frequency is set to 1.44 GHz, and the higher corner frequency is set to 3.47 GHz with tolerance design of RF CMOS PPFs. 3.2.4 Analytical Calculations In the schematic design, constraints in physical layout should also be considered to avoid unreasonable circuit sizing. In the design of RF CMOS PPFs, the maximum length of resistors, Lmax,res , allowed in a given CMOS process, and minimum components area, required by a given standard deviation of the component mismatch, need to be calculated. • Calculation of maximum resistor length. As discussed in section 2.7.1, at radio frequency, parasitic effects have significant influences on the circuit performance. By using the simplified model of RF resistors, the maximum length of the resistor, Lmax,res , allowed in a given CMOS process has been derived, and it is expressed in equation (2.42). Using this equation, at 2.45 GHz, the maximum length Lmax,res of the polysilicon resistor in the Fraunhofer-IMS 0.6 µm CMOS process is equal to 132 µm. 69 Chapter 3 Design of an RF CMOS Polyphase Filter • Calculation of minimum component area. In the design of RF CMOS PPFs, component matching is a critical factor to be considered. From Monte Carlo simulations [73], it has been found that RUIR > -20log10 (σ Component ) , (3.6) where RUIR is the ultimately obtainable image reject ratio, σ component is the variance of the component mismatch. It is known from the experimental study [73] that the variance of adjacent on-chip resistors and capacitors is proportional to the inverse of their surface area. Measurement results in Fraunhofer-IMS 0.6 µm CMOS process show that for two neighboring polysilicon resistors with width of 20 µm and length of 250 µm, the maximum mismatch is 1%, for two neighboring poly-N+ capacitors with 300 µm 2 , the maximum mismatch is 0.5%. In our design, the target specification of the image reject ratio (IRR) is 36 dB. Calculated by using equation (3.6), a component mismatch of 1% is needed to satisfy this target specification. Based on the guidelines and the hand calculation results, the range of length, width of the resistor and the value of the capacitor were calculated as a preparation for the physical layout. The schematic of the RF CMOS PPF is shown in Figure 3.1. This design was based on intensive trials and it took several iterations between schematic design and layout to obtain proper tradeoffs among design parameters, i.e., 70 Chapter 3 Design of an RF CMOS Polyphase Filter quadrature accuracy, signal loss, and chip area. The circuit dimensions are shown in the following Table 3.2. R0 R1 R2 I_LO+ C0 C1 C2 R0 R1 R2 LO+ Q_LO+ C0 C1 C2 R0 R1 R2 I_LO- C0 C1 C2 R0 R1 R2 LO- Q_LOC0 C1 Stage 1 Stage 2 C2 Stage 3 Figure 3.1 Schematic of a 3-stage RF CMOS PPF for a low-IF Bluetooth receiver. Stage Resistors Value Capacitors Value 1 R1 217.6 Ω C1 229.4 fF 2 R2 283.6 Ω C2 229.4 fF 3 R3 347.6 Ω C3 229.4 fF Table 3.2 Dimensions of a 3-stage RF CMOS PPF for a low-IF Bluetooth receiver. 71 Chapter 3 Design of an RF CMOS Polyphase Filter 3.2.5 Schematic Simulation Figure 3.2 Simulation results of a 3-stage RF CMOS PPF obtained by using SpectreRF Figure 3.3 Simulation results of a 3-stage RF CMOS PPF obtained by using PPFANA. 72 Chapter 3 Design of an RF CMOS Polyphase Filter mgain /dB d phase /degrees PPFANA 0.012 90.063 SpectreRF 0.010 90.061 Table 3.3 Simulation results of a 3-stage RF CMOS PPFs obtained by using PPFANA and SpectreRF. The simulation results obtained for the schematic by using Cadence SpectreRF and PPFANA are shown in Figure 3.2 and Figure 3.3, respectively. Accurate results are listed in Table 3.3. From figures and table above, we can see that the simulation results match; the gain mismatch is approximately 0.01 dB and the phase difference is approximately 90.06 degrees, measured between 2.4 GHz and 2.48 GHz, and ignoring computational errors. As mentioned in the second chapter, the phase mismatch is phase difference minus 90 degrees, thus phase mismatch in this RF CMOS PPF is approximately 0.06 degrees. Compared with Table 3.1, we can see that the target specifications are met in the schematic simulation. 3.3 Physical Layout Design 3.3.1 Layout Techniques As discussed in the chapter 2, in the physical design, special attention must be paid to the layout of the resistors and capacitors. The layout of the four resistors in one 73 Chapter 3 Design of an RF CMOS Polyphase Filter stage of the RF CMOS PPF designed by the author is shown in Figure 3.4. To obtain good matching, the following techniques are applied: • Identical structures, including end contacts, are used for all the resistors. • Resistors are placed very closely. • All of the resistors have the same orientation. • A common-centroid structure is used [77]. • Dummy resistors are used to minimize the boundary effects. Dummy resistor Resistor 1 Resistor 2 Resistor 3 Resistor 4 Dummy resistor N-Well Guard rings Figure 3.4 Layout of the four resistors in one stage of an RF CMOS PPF. The layout of the four capacitors in one stage of the RF CMOS PPF designed by the author is shown in Figure 3.5. In order to obtain good matching, the following techniques are applied: 74 Chapter 3 Design of an RF CMOS Polyphase Filter • Identical structures, including terminals, are used for all capacitors. • All of the capacitors to be matched are placed very closely. • Capacitors to be matched are placed with the same geometrical orientation. • A common-centroid structure is used [77]. • Dummy capacitors are placed around the matched array to minimize the boundary effects. • Input and output wires are placed as symmetrically as possible. Guard ring Capacitor 3 Capacitor 1 Wires Capacitor 2 Capacitor 4 Note: Surrouding capacitors are dummy capacitors Figure 3.5 Layout of the four capacitors and wires in one stage of an RF CMOS PPF. Following the layout techniques mentioned above, component mismatch in RF CMOS PPFs can be control well. The latest component mismatch model in [81] can be 75 Chapter 3 Design of an RF CMOS Polyphase Filter used to estimate the standard deviation of the mismatch in the layout. Thus a layout of this design is taken as the layout pattern used in the chapter 4. 3.3.2 On-Chip Noise Isolation Techniques As discussed in chapter 2, in the design of RF CMOS PPFs, special attentions must be paid to on-chip noise isolation techniques to reduce unwanted substrate noise coupling. On-chip shielding should be used to protect the sensitive RF CMOS PPFs from noise generated by other circuits. The CMOS process used in this design, the Fraunhofer-IMS 0.6 µm CMOS process, is a P-substrate, single N-well process. In our application, N-well and a guard ring are used. N-Wells: N-Well is an epitaxial layer fabricated on the P-substrate to differentiate it from the substrate. In an N-well process, i.e., a process with P-substrate and N-well, the N-well is originally used for the fabrication of P-transistors. With proper biasing, the N-well can be used to provide isolation between a component and the substrate. As shown in Figure 3.4, resistors in this design are protected by N-wells, the region with grids. These resistors are built in the shallow P-region within the buried Nwell. A depletion layer exists on both sides of the N-well and this provides dielectric isolation between the active devices and the bulk region. Since in our application the Nwell is connected to the low-impedance positive supply, the N-well performs a Farady 76 Chapter 3 Design of an RF CMOS Polyphase Filter shield around the resistors. Thus, resistors are protected against noise coupling by Nwell. However, the N-well is not well suited to use for the capacitors in this design, because the bottom plate of the poly-N+ is already in the N+ region. Despite this fact, poly-N+ capacitors are the best capacitor in the sense of linearity in the Fraunhofer-IMS 0.6 µm CMOS process. Guard Rings: The principle of guard ring, also named as guarding band, is to use a narrow ring of P+ or N+ with stable and noise-free connections forming a local clean zone to reduce noise coupling through the substrate. In the Fraunhofer-IMS 0.6 µm CMOS process, guard rings can be connected to either ground or Vdd. A grounded guard ring uses a low-resistance P+ area to connect to ground. A guard ring that connects to Vdd uses an N-well and N+ region on the substrate. Positive N+ connections attract electrons, and the grounded P+ connections attract holes. Thus, they can provide a barrier against substrate noise coupling. As shown in Figure 3.4 and Figure 3.5, a P+ guard ring and a N+ guard ring are used in the layout of the resistors, a P+ guard ring is used in the layout of capacitors, and these guard rings are placed as close as possible to the resistors and capacitor. 3.3.3 Layout and Post-Layout Simulation In order to test this chip independently, test pads are added to the layout of the RF CMOS PPF; shielded ground pads (Abschirm_GND) are used to avoid cross-coupling 77 Chapter 3 Design of an RF CMOS Polyphase Filter between different paths and wiring in the layout is kept as symmetrical as possible to minimize additional mismatch. The final layout of the RF CMOS PPF with test pads is shown in Figure 3.10. Test pads Stage 3 Stage 2 Stage 1 Decoupling capacitor Figure 3.6 Layout of a 3-stage RF CMOS PPF with test pads. mgain / dB ∆φ / degrees 0.071 0.26 0.27 1.8 Cadence postlayout simulation PPFANA Table 3.4 Simulation results obtained by using Cadence post-layout simulation and PPFANA. 78 Chapter 3 Design of an RF CMOS Polyphase Filter After the layout, post-layout simulation (PS) of the RF CMOS PPF with coefficient extracted networks was done by using Cadence SpectreRF. In this extraction method, all kinds of parasitic resistances and capacitances, such as, parasitics between neighboring components, wires, and parasitics to the substrate, are extracted. In this way, we can provide realistic simulation results. Unfortunately, by this simulation method, the influences from process tolerances and component mismatching cannot be easily simulated. In this situation, PPFANA, the software the author developed in this dissertation shows its advantages over Cadence post-layout simulation. The simulation results by using PPFANA and Cadence post-layout simulation are shown in Table 3.4 for the purpose of comparison. 3.3.4 Chip Photo ` Test pads Stage 3 Stage 2 Stage 1 Decoupling capacitor Figure 3.7 Chip photo of an RF CMOS PPF for a low-IF Bluetooth receiver. 79 Chapter 3 Design of an RF CMOS Polyphase Filter A chip photo of the fabricated chip is shown in Figure 3.7. The squares in the top of this photo are test pads; in the middle of the bottom part is the RF CMOS PPF designed for a low-IF Bluetooth receiver. 3.4 Measurements 3.4.1 Introductory Remarks As an RF CMOS PPF has three ports, namely one input port and two output ports, and the wafer station in Fraunhofer-IMS can only measure components with two ports, a printed circuit board (PCB) providing interfaces to the measurement equipments was designed and manufactured. The fabricated chip was bonded to the test PCB to allow measurements. 3.4.2 Modeling of Test Pads and Bonding Wires As test pads and bonding wires have parasitic resistance, inductances and capacitance, in order to simulate the influences from these parasitic components, a model of test pads and bonding wires shown in Figure 3.8 was built by using the Cadence package physical geometrical modeling tools. Both schematic simulation and post-layout simulation of RF CMOS PPF with test pads and bonding wires show that the parasitic components have no significant influences on the gain mismatch and the 80 Chapter 3 Design of an RF CMOS Polyphase Filter phase mismatch of the RF CMOS PPF, because they are in a fully balanced configuration and their layouts are symmetrical. R_ESD R_Bond BeforePad r=99 r = 200m L_Bond ∩∩∩∩ AfterBond l = 800p f =2.45GHz c = 183f r = 174 C_Pad R_Pad gnd Figure 3.8 Model of test pads and bonding wires. 3.4.3 Design of the Test PCB The functionality of the test PCB is to provide an interface to the RF measurement equipment. Specifically, the test PCB includes two types of conversions, i.e., impedance conversion and differential to single-end conversion. A schematic of the test PCB is shown in the Figure 3.9. From this schematic, we can see that the differential input of the RF CMOS PPF is accomplished by using a balance-unbalance converter (BALUN), and the differential outputs of I path and Q path are converted by 81 Chapter 3 Design of an RF CMOS Polyphase Filter BALUNs to single-ended outputs respectively. In order to get maximum output power gain, resistors and capacitors with optimized values are connected to the outputs as loads. gnd r = 250 c = 240f SMA 2:1 I_LO + ⊃ ⊂ TOKO Balun ⊃ ⊂ ⊂ ⊃ ⊃⊂ 617DB-1023 in I_LOgnd gnd SMA 1:2 in TOKO Balun 617DB-1023 LO + f_lo = 2.449GHz ⊃ ⊂ ⊃ ⊂ i_DC ⊃ ⊂ ⊃⊂ = 0 r = 250 c = 240f gnd r = 250 c = 240f LO- SMA gnd Q_LO + 2:1 ⊃ ⊂ TOKO Balun ⊃ ⊂ ⊃ ⊃⊂ ⊂ 617DB-1023 in Q_LOgnd gnd r = 250 c = 240f Figure 3.9 Schematic of the printed circuit board (PCB) for test of the RF CMOS PPF. In Figure 3.10, the photo of the fabricated test PCB is shown. The metal connectors are the SMA connectors. The black block in the center of the PCB is the fabricated chip, which is bonded to the PCB. 82 Chapter 3 Design of an RF CMOS Polyphase Filter Figure 3.10 Photo of the fabricated test PCB. 3.4.4 Measurement Setup In the measurement setup by the author, an Agilent E8267C PSG vector signal generator and a Lecroy wavermaster digital oscilloscope were used to measure the performance of the fabricated chip. A diagram of the measurement setup is shown in Figure 3.11. The Agilent E8267C PSG vector signal generator generates a 2.45 GHz continuous sinusoidal signal, which is input to the test PCB via RF cable. Then the I (inphase) path and Q (quadrature-phase) path were connected to the Lecroy wavemaster digital oscilloscope via an RF cable. A feature of this Lecroy wavemaster digital 83 Chapter 3 Design of an RF CMOS Polyphase Filter oscilloscope is its embedded real time fast Fourier transform (FFT). With this digital oscilloscope, time domain and frequency domain measurements of the two port outputs can be conducted in real time. Agilent E8267 PSG Vector signal generator In Out P_in RF CMOS PPFs Test PCB RF Cable I_out Q_out RF Cable RF Cable P_out P_in P_out In1 In2 Lecroy Wavemaster Digital oscilloscope Power Supply Figure 3.11 Diagram of the measurement setup for test of the RF CMOS PPF. 3.4.5 Measurement Results Two types of measurements, namely, time domain and frequency domain measurements, on RF CMOS PPFs have been conducted in this work. Time domain measurement results are shown in Figure 3.12. From the time domain signal, we can see that the gain mismatch is approximately 0.17 dB, and the phase difference is approximately 88.78 degrees, consequently, the phase mismatch is approximately 1.22 degrees. 84 Chapter 3 Design of an RF CMOS Polyphase Filter Figure 3.12 Time domain measurement results of the RF CMOS PPF. As time domain measurement is observed at only that time interval, it has significant measurement inaccuracy in the RF domain. 85 Chapter 3 Design of an RF CMOS Polyphase Filter In order to get more accurate measurement result, frequency domain measurement was conducted. Figure 3.13 Gain mismatch of the RF CMOS PPF measured in frequency domain. 86 Chapter 3 Design of an RF CMOS Polyphase Filter The frequency domain measurement results of the gain mismatch and the phase mismatch in the RF CMOS PPF are shown in Figure 3.13 and Figure 3.14 respectively. The measurement results are 0.45 dB gain mismatch and 3.2 degrees phase mismatch. Figure 3.14 Phase difference of the RF CMOS PPF measured in frequency domain. 87 Chapter 3 Design of an RF CMOS Polyphase Filter 3.5 Analysis of Simulation and Measurement Results By comparing schematic simulation results obtained by using PPFANA and Cadence SpectreRF, which are shown in Table 3.3, we can see that they are in good accordance with each other; the effectiveness of PPFANA is thus verified. From the schematic and post-layout simulation of RF CMOS PPFs with test pads, we have found that test pads do not have significant influences on the quadrature accuracy of RF CMOS PPFs because they have fully balanced configuration and symmetrical layout, whereas bonding wires, external components, i.e., load resistors and capacitors, and BALUN contribute certain mismatch. By comparing the post-layout simulation results of RF CMOS PPFs obtained by using PPFANA and Cadence SpectreRF and the measurement results, we can see that the simulation results obtained by using PPFANA are closer to the measurement results because the influences from process tolerances and component mismatch are simulated. In this situation, PPFANA provides a useful design aid for RF CMOS PPF design. 3.6 Summary This chapter concentrates on a practical design of an RF CMOS PPF for a low-IF Bluetooth receiver. Detailed design considerations, analytical calculations and layout techniques for minimizing component mismatch were analyzed. 88 Chapter 3 Design of an RF CMOS Polyphase Filter The fabricated chip was bonded to the test PCB. Measurement results show that PPFANA developed by the author provides more realistic simulation results than the commercially available Cadence tools. Further contributions of this chapter are the following: 1. Silicon success of an RF CMOS PPF for a low-IF Bluetooth receiver was presented. 2. Design heuristics from design practice reported here lay a solid foundation for the optimization of RF CMOS PPFs. 3. The effectiveness of PPFANA was demonstrated. 89 Chapter 4 Optimization of RF CMOS Polyphase Filters Chapter 4 Optimization of RF CMOS Polyphase Filters 4.1 Introduction In the open literatures, there are some papers on analysis [55-60] and design[5568] of RF CMOS polyphase filters (PPFs). For instance, Behbahani [62] analyzed some practical aspects in the design of RF CMOS PPFs and presented some design guidelines. It is known that the main specification of the RF CMOS PPFs, quadrature accuracy, is layout dependent. The requirements from component matching are contradictory to that of minimization of noise coupling, signal loss and chip area [ZHA2]. Thus, a tradeoff must be made in a specific design [ZHA2]. By simply following Behbahani’s guidelines [62], it takes intensive trials and many design iterations to reach a good design [ZHA3]. Furthermore with layout considerations, optimization of RF CMOS PPFs cannot be accomplished by using analytical calculations because of many constraints and tradeoffs in the design [ZHA3]. In this situation, a computer-aided analysis and design optimization tool for RF CMOS PPFs is of great help to the community of RF CMOS PPFs designers, especially, for industrial projects, which are under time-to-market pressures. Unfortunately, until now, there is not any such dedicated tool available openly, to the author’s best knowledge. In this chapter, the author will present a novel optimization tool for RF CMOS PPFs, based on MATLAB. The tool, which was 90 Chapter 4 Optimization of RF CMOS Polyphase Filters developed by the author, is termed PPFOPTIMA and it takes layout constraints explicitly into considerations [ZHA3]. A genetic algorithm (GA) is proposed as the optimization engine of PPFOPTIMA for its capability in avoiding local optima. In order to enable users to carry out an automated design, PPFOPTIMA provides automated synthesis and verification incorporating dedicated worst-case and Monte Carlo simulation options. Experimental results illustrated in this chapter demonstrate that PPFOPTIMA is effective and efficient in the synthesis, the optimization and the verification of RF CMOS PPFs. 4.2 Design Considerations and Design Flow As analyzed in chapter 2, CMOS process tolerances, component mismatch and parasitic effects should be considered in the design of RF CMOS PPFs in order to accomplish a robust design. Design considerations and heuristics from our design practice in chapter 3 will be discussed in this section. CMOS process tolerances should be considered by using the concept of ‘tolerance design’ [102]. Specifically, by enlarging the bandwidth of the PPF, the operating frequency can be covered by upper and lower corners frequency of the RF CMOS PPFs, no matter how they shift with process variations [102]. 91 Chapter 4 Optimization of RF CMOS Polyphase Filters The most important specification for the design of an RF CMOS PPF is the image reject ratio (IRR), which is related to the sensitivity of a receiver. From Monte Carlo (MC) simulations, it has been found that [59] RUIR > -20log10 (σ Component ) , (4.1) where RUIR is the ultimately obtainable IRR, and σ component is the standard deviation of the component mismatch. Typically, RUIR is in the range of 25 dB to 60 dB for RF CMOS PPFs [ZHA3]. The standard deviation σ component typically between 3% and 0.5% [81]. It is known from the experimental study [73] that the variance of adjacent on-chip resistors and capacitors and their area are reciprocally proportional, that is, neighboring components with larger area have better matching than those with small area [73]. By using the latest resistor and capacitor mismatch models [81] of (4.2) and (4.3), the minimum chip area required by a target specification of the IRR can be calculated [ZHA3]. The standard deviation σ component of the component mismatch between two neighboring resistors with identical layout can be calculated as follows [81]: 2 σ 2 ∆R/R =σ 2 R sh 2 2 L L L 2 2 + σ Re + σ ∆W , (W + ∆W ) ( L ⋅ Rsh + Re ) ( L ⋅ Rsh + Re ) (4.2) with the standard deviation of the sheet resistance of the polysilicon resistors Rsh given by σ R sh = AR sh (WL)1 / 2 with the standard deviation of the resistor width 92 , (4.3) Chapter 4 Optimization of RF CMOS Polyphase Filters σ ∆W = A∆W , W 1/ 2 (4.4) and with the standard deviation of the end resistance coefficient Re defined as σ R = AR , e e (4.5) In (4.2) to (4.5), W and L are the resistor width and the resistor length, and ∆W is the resistor width offset, ARsh , A∆W , and ARe are fitting parameters obtained from massive measurement results of σ Rsh , σ ∆W , σ Re , respectively. For two neighboring capacitors with identical layout and capacitance C, the variance σ ∆2c / C of the component mismatch between them can be calculated as follows [81]: 2 σ ∆c/C = σ p2 + σ a2 + σ d2 , (4.6) where σ p denotes the standard deviation of the periphery, given by σp = fp , C 3/4 (4.7) with the standard deviation caused by area variations defined as σa = fa , C 1/2 (4.8) and with the standard deviation caused by distance fluctuations σ d = f d .d , (4.9) In (4.7) to (4.9), f p , f a , f d are constants describing the influences of periphery, area and distance fluctuations. In the component mismatch model of capacitors, the periphery component models the effect of edge roughness, and it is most significant for small capacitors, which have a relatively large amount of edge capacitance. The area 93 Chapter 4 Optimization of RF CMOS Polyphase Filters component models the effect of short-range dielectric thickness variation, and it is most significant for moderate size capacitors. The distance component models the effect of global dielectric thickness variation across the wafer, and it becomes significant for large capacitors or widely spaced capacitors [81]. Optimized for digital circuits, parasitic effects in CMOS processes are severe for analog design. In the design of RF CMOS PPFs, there are two influences from parasitic effects, namely [ZHA3] • signal loss in addition to the theoretical 3 dB/stage caused by the lossy substrate and • capacitive noise coupling caused by parasitic capacitances. For a given CMOS process, there are two ways to minimize the influences from parasitic effects, one is to reduce the chip area as derived in Chapter 2 to decrease capacitive noise coupling, the other is to use on-chip noise isolation techniques, namely N-wells and guard rings, to protect noise sensitive analog circuits [ZHA2]. With considerations of parasitics, the maximum length of the resistor (MLR) allowed in a CMOS process can be calculated by using the following equation [ZHA2]: Lmax,res = 1 2 πf op Rsh Cp (4.10) where Lmax,res is the MLR, f op is the operating frequency of the RF CMOS PPF, Rsh is the sheet resistance, and Cp is parasitic capacitance per unit area between resistor and the substrate. Before accomplishing physical layout, the MLR must be calculated to avoid an inappropriate physical design. 94 Chapter 4 Optimization of RF CMOS Polyphase Filters Start Specifications RF CMOS PPF with 2 cascaded stages Calculate minimum area of resistors and capacitors Calculate values of resistors with considerations of process tolerances Increase the number of cascaded stages by 1 Worst-case schematic simulation No Satisfy specifications? Yes Calculate maximum lengths of resistors Tradeoff between lengths and widths of resistors Physical layout Worst-case post-layout simulation No Satisfy specifications? Yes End Figure 4.1 A design flow for specification-driven automated synthesis of RF CMOS PPFs. 95 Chapter 4 Optimization of RF CMOS Polyphase Filters Based on aforementioned design considerations and the design heuristics, a design flow for specification-driven automated synthesis of RF CMOS PPFs, as shown in Figure 4.1, is proposed in this chapter. From Figure 4.1, we can see that all the design considerations and constraints we have just discussed are included in this design flow. Setting out from a given target specification, we start with a 2-stage RF CMOS PPF, going through schematic design. If in the schematic simulation, the target specification cannot be met, we move on to an RF CMOS PPF with three cascaded stages, and deduce the compliance with the target specification. If we fail again, an RF CMOS PPF with four cascaded stage is taken. After completing the schematic design, we carry out the physical layout design and check whether the target specification can be met in the post-layout simulation. If we fail, we go back to the schematic design using an RF CMOS PPF with more cascaded stages, until the target specifications are met in the post-layout simulation. Then we finish this design. 4.3 Problem Formulation for RF CMOS PPFs Optimization In design of an RF CMOS PPF, the design objectives are • to satisfy the target specifications required by a given wireless communication standard and transceiver architecture, • to minimize the chip area, • to maximize the immunity to noise coupling, and 96 Chapter 4 Optimization of RF CMOS Polyphase Filters • to minimize additional signal losses. Based on these design objectives, we can categorize the design considerations by objective functions or constraints. Objective functions are the image reject ratio (IRR) and the chip area. Here we use the relationship between the IRR RIR , the gain mismatch mgain and the phase mismatch ∆φ as shown in the following equation (4.11) [84]. RIR = -20log10 ( 2 mgain 16( AI + AQ ) + ∆φ 2 ), 4 (4.11) where the gain mismatch is defined by mgain = AI − AQ , (4.12) and where the phase mismatch is defined by ∆φ =|| φI − φQ | −90o | . (4.13) In (4.11) to (4.13), AI , AQ , φI , φQ are amplitudes and phases of the I path and the Q path, respectively. All of these parameters can be calculated by using the transfer functions of RF CMOS PPFs derived in chapter 3 of this dissertation. In order to minimize the component mismatch, the layout pattern shown in Figure 3.4 and Figure 3.5 should be followed in the layout of resistors and capacitors. In this layout pattern, the chip areas of an RF CMOS PPF with n cascaded stages is given by [ZHA3] n S = ∑ (6 S Ri + 16 S Ci ) , i =1 (4.14) where the chip area of resistors in the ith stage is S Ri = LRi ⋅ WRi , 97 (4.15) Chapter 4 Optimization of RF CMOS Polyphase Filters and where the chip area of the capacitor in the ith stage is SCi = Ci Cunit , (4.16) In (4.14) to (4.16), LRi , WRi are the length and width of resistors in the ith stage respectively, Ci is the capacitor value in the ith stage, Cunit is the unit capacitance of the capacitors, i=1,2,3,…n, n is the number of the cascaded stages in an RF CMOS PPF. Though the chip areas defined in (4.14) is an objective to be minimized for the reduction of substrate noise coupling, for a given target specification of the IRR and a given CMOS process, there exist a minimum area of resistors and capacitors to avoid bad component mismatch which cannot satisfy the specification of the IRR. Using the equation (4.1), we find the corresponding standard deviation of resistors and capacitors for a given target specification of IRR: σ ∆R/R > 10- RIR / 20 , (4.17) σ ∆C/C > 10- RIR /20 . (4.18) In (4.17) and (4.18), RIR is the IRR and σ ∆R/R , σ ∆C/C are standard deviations of matched resistors and capacitors, respectively. These figures can be calculated by using the latest component mismatch models proposed by Cheng [81] as shown in (4.2) and (4.6). Another constraint in practice is that the length of resistors should be less than the MLR calculated by using (4.10). In order to choose a suitable optimization algorithm, let us investigate the relationship between the IRR and component values. For the purpose of simplification, we take the amplitude mismatch between the I path and the Q path in a 2-stage RF 98 Chapter 4 Optimization of RF CMOS Polyphase Filters CMOS PPF for a Bluetooth receiver as an example. In the design of this 2-stage RF CMOS PPFs, if we determine the values of the resistors in each stage, then the capacitors values are automatically determined by the relationship between corner frequency and RC time constant shown in (3.4). In this situation the amplitude mismatch ∆A can be expressed as: 1+ ∆A = ω2 ω1ω2 2 ω2 ω ω R1 ω 1 − +2 + + R2 ω2 ω1ω2 ω1 ω2 2 1/ 2 (4.19) Where ω is the frequency of interest; ω1 and ω2 are the upper and the lower corner frequency of this RF CMOS PPF, which are 2.4 GHz and 2.48 GHz respectively; R1 and R2 are resistors values in the first stage and the second stage, which are in the range of 50 Ohms to 500 Ohms. Taking these into account, we can rewrite (4.19) as 1 + x2 z= 4 . x − 2 x2 + 2x + 2 y (4.20) Where z is ∆A ; x is the normalized frequency of interest, which is in the range of [0.5, 5]; and y is the ratio between R1 and R2 , which is in the range of [0.5, 5]. The threedimensional plot of ∆A is shown in Figure 4.2. From this plot, we can clearly see that it has several maxima. This means that, the function in equation (4.20) has multiple local optima. For RF CMOS PPFs with more cascaded stages, the relationship between quadrature accuracy, component values, and frequency of interest is even more complex. In this situation, an in-depth analysis of possible optimization methods is necessary. 99 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.2 A three-dimensional plot of the amplitude mismatch in a 2-stage RF CMOS PPF, expressed in the equation (4.20). 4.4 Analysis of Possible Optimization Methodologies 4.4.1 Limitations of Conventional Optimization Methods There are various optimization theories and techniques in engineering mathematics [104]. Essentially, the targets of the optimization techniques are to search for the maximum or the minimum values in a certain search space [104]. The easiest way to find the accurate maximum or minimum in a continuous function is to use calculus-based search [104], in which the existence of the first order and the second order derivatives are required [104]. However, this technique is not 100 Chapter 4 Optimization of RF CMOS Polyphase Filters suitable for solving the optimization problem in this dissertation for the following reasons: • Tendency to get trapped on local maxima. Even though a better solution may exist, all moves from the local maxima seem to decrease the fitness of the solution. • Dependence on the existence of derivatives. There is another optimization technique, gradient descent [104], which is also referred to as hill-climbing [104]. This technique performs well on functions with only one peak. However, for functions with multiple peaks, the first peak found is taken as the maximum, no matter whether it is the highest peak or not [104]. Thus, hill-climbing is not suitable for our optimization problem either. For optimization problems with multiple peaks or multiple valleys, the direct way is to use random search to find the optima. Unfortunately, for most of the real-life optimization problems, this method is inefficient because of the vast amount of computations and is therefore not selected by the author. In order to save computational complexity, iterated climbing was proposed [104], which is a combination of random search and gradient search. Once a peak has been located, the hill-climbing is started again, but with another randomly chosen starting point. However, since each random trial is performed in isolation, no overall idea of the topology and photography of the search space is obtained. Furthermore, trials are randomly allocated over the entire search space; many points in regions of low fitness 101 Chapter 4 Optimization of RF CMOS Polyphase Filters are evaluated as points in high fitness regions. Therefore, iterated climbing is not considered as a proper candidate for the optimization of RF CMOS PPFs and is therefore not selected by the author. 4.4.2 Simulated Annealing Simulated annealing (SA) was invented by Kirkpatrick [109] in 1982 by mimicking the process of cooling of a solid. Essentially, it is a modified version of hillclimbing. The search process starts from a random point in the search space. Then, a random move is made. In the case of climbing reaches a higher point by this move, the move is accepted. Otherwise, it is accepted only with probability p(t) (where t is time). The probability function p(t), essentially relates to the temperature. A value of p(t) close to one refers to a high temperature. Decreasing p(t) means lowering the temperature. At time t equal to zero, p(0) is approximately one. As time t passes, p(t) is decreased, approaching zero at the end of the SA operation. This procedure is an analogy with the cooling of a solid. Therefore, initially, any moves are accepted, but as p(t) decreases, the probability of accepting a negative move is lowered. This optimization algorithm has been successfully applied in analog design automation [109-112], especially in IC layout routing. However simulated annealing deals with only one candidate at a time. Like random search, it does not build an overall picture of the search space, and no information from previous moves is used to guide the selection of new moves. This leads to a low efficiency in solving complicated optimization problems. Therefore, SA 102 Chapter 4 Optimization of RF CMOS Polyphase Filters does not seem promising for the optimization of RF CMOS PPFs and is hence not selected by the author. 4.4.3 Genetic Algorithms A. Introductory Remarks Genetic algorithms (GAs) are adaptive methods based on the genetic processes of biological organisms. For GA basics, please refer to the famous textbook written by Goldberg [113]. Here we focus on the analysis of the suitability of GAs to our optimization problems. The following four key schemes, which characterize GAs, create the benefit of GAs over conventional optimization techniques and the SA we had mentioned in the previous subsections. B. Direct Manipulation of Coding [118] GAs manipulate decisions or control variable representations at a string level to exploit similarities among high-performance strings [118]. Other methods usually deal with functions and their control variables directly. GAs deal with parameters of finite length, which are encoded using a finite alphabet, rather than directly manipulating the parameters. This means that the search is constrained neither by the continuity of the function under investigation, nor by the existence of a derivative function. Moreover, by exploring similarities in codings, GAs can deal effectively with a broader class of functions than can many other procedures. 103 Chapter 4 Optimization of RF CMOS Polyphase Filters C. Search from a Population, not a Single Point [118] In GAs, the search sets out from a population of many individuals, rather than starting from just one point. This parallelism means that the search will not become trapped on a local maximum - especially if a measure of diversity-maintenance is incorporated into the algorithm, even if one candidate may become trapped on a local maximum, but the need to maintain diversity in the search population means that other candidates will therefore avoid that particular area of the search space. D. Search via Sampling, a Blind Search [118] GAs remains general by exploiting information available in any search problem. GAs process similarities in the coding with information and rank the structures according to their survival capabilities in the current environment. By exploiting such widely available information, GAs may be applied to virtually any problem. E. Search Using Stochastic Operators, no Deterministic Rules [118] The transition rules used by GAs are probabilistic, not deterministic. A distinction, however, exists between the randomized operators of GAs and other methods that are simple random walks. GAs use random choice to guide a highly exploitative search. From the analysis of GA, SA and conventional optimization techniques, we can see that the GA is well suited for the solving of complicated optimization problems with 104 Chapter 4 Optimization of RF CMOS Polyphase Filters multiple objectives and, consequently, with multiple local optima. Since the optimization of RF CMOS PPFs has multiple optimization objectives and multiple local optima, conventional optimization algorithms are not recommendable. Therefore, the GA was chosen for the optimization engine in PPFOPTIMA, the optimization tool for RF CMOS PPFs developed by the author of this dissertation. 4.5 MATLAB Implementation of Genetic Algorithms 4.5.1 Overview In this section, the MATLAB implementation of genetic algorithms is presented. MATLAB is chosen as the programming platform for the following reasons: • It provides many built-in auxiliary functions useful for function optimization. • It is efficient for numerical computations. 4.5.2 Chromosome Representation The process of GA begins with a set of potential solutions, termed chromosomes, that are randomly generated or selected [113]. The entire set of those chromosomes establishes a population [113]. For any GA, a chromosome represents an individual in the population [113]. The representation scheme determines how the problem is structured in the GA and how the genetic operators that are used [113]. Each chromosome is made up of a sequence of genes, taken from a certain alphabet [113]. 105 Chapter 4 Optimization of RF CMOS Polyphase Filters The sequence of genes makes the value of a particular chromosome. This value of a chromosome is called genotypes [113]. The genotypes are uniquely mapped into the decision variables, called phenotypic domain. The chromosomes evolve during several iterations or generations. The most commonly used representation in GAs is based on the binary alphabet {0, 1}. In this case, each decision variable is encoded by a binary string. The binary strings are concatenated to form a chromosome. For example, a problem with two variables, X1 and X2, may be mapped onto the chromosome structure in the way shown in Figure 4.3. X1 is encoded by 10 bits and X2 is represented by 15 bits. This encoding may reflect the level of accuracy or range of the individual decision variables. Examining the chromosome string in isolation yields no information about the problem we are trying to solve. It is only with the decoding of the chromosome into its phenotypic values that any meaning can be applied to the representation. Chromosome comprising the values of two concatenated decision variables X1 and X 2 1011010011 010111010100101 Decision variable X1 Decision variable X2 Figure 4.3 Mapping variables into chromosomes. 106 Chapter 4 Optimization of RF CMOS Polyphase Filters 4.5.3 Genetic Operation A. Introductory Remarks The genetic operation includes three basic operators, namely, reproduction, crossover and mutation [113]. These three basic operators provide the basic search mechanism of genetic algorithms (GAs) and they are used to create new solutions based on existing solutions in the population [113]. B. Reproduction Reproduction is the selection of individuals to produce successive generations [113]. Reproduction plays an important role in a genetic algorithm. A probabilistic selection is performed based upon the individual's fitness in such a way that the fitter individuals have an increased chance of being selected. An individual in the population can be selected more than once with all individuals in the population having a chance of being selected to be reproduced into the next generation. A common selection approach assigns a probability of selection, Pj , to each individual, j, based on its fitness value [113]. In general, j is an integer, which can vary between 1 and N [113]. A series of N random numbers is generated and compared N against the cumulative probability, ∑p j , of the population. The appropriate individual, j =1 i, is selected and copied into the new population. 107 Chapter 4 Optimization of RF CMOS Polyphase Filters Various methods exist to assign probabilities to individuals, namely, roulette wheel, linear ranking and geometric ranking. In the GA implemented in this work, the roulette wheel mechanism was chosen to probabilistically select individuals based on some measures of their performance. The roulette wheel selection method, developed by Holland [113], was the first selection method. The probability, Pj , for each individual is defined by Pj = Fj (4.21) N ∑F j j =1 Where Fj is the fitness of individual j, and N is the population size. As shown in Figure 4.4, the circumference of the roulette wheel is the sum of all six individual’s fitness values; the sizes of the sectors stand for the fitness values of the individuals. Individual 5, which has the largest sector, is the fittest individual, whereas individuals 6 and 4 are the least fit and, correspondingly, have the smallest sectors within the roulette wheel. To select an individual, a uniformly distributed random number is generated in the predefined interval, and the individual whose sector spans the random number is selected. This process is repeated until the desired number of individuals has been selected. The roulette wheel selection is not only used in genetic algorithms in conjunction with maximization, when combined with e.g. windowing and scaling, it is well suited for minimization and negativity. Thus, roulette wheel selection method has been chosen by the author. 108 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.4 Roulette wheel selections. C. Crossover and Mutation Crossover involves splitting two individuals and then combining one half of each individual with the other pair [113]. Mutation involves altering one individual to produce a single new solution [113]. If chromosomes are as binary types represented, simple crossover and binary mutation can be adopted [113]. Let X and Y be two m-dimensional row vectors denoting individuals (parents) from the population. Simple crossover generates a random sample r from a uniform distribution from 1 to m and creates two new individuals according to equation (4.22) and equation (4.23). xi, if i < r x ′i = yi, otherwise (4.22) yi, if i < r y′i = xi, otherwise (4.23) For example, consider the two pairs of binary strings 109 Chapter 4 Optimization of RF CMOS Polyphase Filters P1 = 1 0 0 1 0 1 1 0, (4.24) P2 = 1 0 1 1 1 0 0 0. (4.25) If an integer position, i, is selected uniformly and randomly, and the genetic information exchanged between the individuals about this point, then two new offspring strings are produced. The two offspring below are produced when the crossover point i = 5 is selected, O1 = 1 0 0 1 0 0 0 0, (4.26) O2 = 1 0 1 1 1 1 1 0. (4.27) This crossover operation is not necessarily performed on all strings in the population. Instead, it is applied with a probability Px when the pairs are chosen for breeding. Binary mutation flips each bit in every individual in the population with probability Pm according to following equation (4. 28): 1 − xi, if U(0,1) < Pm x ′i = xi, otherwise (4.28) For example, mutating the fourth bit of O1 leads to the new string: O1m = 1 0 0 0 0 0 0 0. (4.29) Mutation is generally considered to be a background operator, which ensures that, the probability of searching a particular subspace of the problem space is never zero. This has the effect of tending to inhibit the possibility of converging to a local optimum, rather than the global optimum. 110 Chapter 4 Optimization of RF CMOS Polyphase Filters 4.5.4 Initialization, Termination and Fitness Functions GAs simultaneously operate on a number of potential solutions, called a population, consisting of some encoding of the parameter set [113]. The mode of operation generates the required number of individuals using a random number generator that uniformly distributes numbers in the desired range. However, since GAs can iteratively improve existing solutions, i.e., solutions from other heuristics and/or current practices, the initial population can be seeded with potentially good solutions, with the remainder of the population being randomly generated solutions. One of the variations is the extended random initialization procedure of Bramlette [113], whereby a number of random initializations are tried for each individual and the one with the best performance is chosen for the initial population. Typically, a population is composed of between 30 and 100 individuals, which is about ten times the number of variables to be optimized. The GA moves from generation to generation, selecting parents and reproducing offspring until a termination criterion is met. Because the GA is a stochastic search method, it is difficult to formally specify convergence criteria. The most frequently used stopping criterion is a specified maximum number of generations [118]. Another termination strategy involves population convergence criteria. In general, GAs will force much of the entire population to converge to a single solution. When the sum of the deviations among individuals becomes smaller than some specified threshold, the algorithm can be terminated. The algorithm can also be terminated due to a lack of 111 Chapter 4 Optimization of RF CMOS Polyphase Filters improvement in the best solution over a specified number of generations. Alternatively, a target value for the evaluation measure can be established based on some arbitrarily ‘acceptable’ threshold. Several strategies can be used in conjunction with each other. The objective function [118] is used to provide a measure of how individuals have performed in the problem domain. In the case of a minimization problem, the fittest individuals will have the lowest numerical value of the associated objective function. This raw measure of fitness is usually only used as an intermediate stage in determining the relative performance of individuals in a GA [118]. Another function, the fitness function, is normally used to transform the value of the objective function f (x) into measure of relative fitness, thus: F (x) = g (f (x)) (4.30) where g (⋅) transforms the value of the objective function to a non-negative number and F (⋅) is the resulting relative fitness. This mapping is always necessary when the objective function is to be minimized as the lower objective function values correspond to fitter individuals. A linear transformation which offsets the objective function is often used prior to fitness assignment, such that, F (x) = a f (x) + b, (4.31) where a is a positive scaling factor. If we are minimizing, the offset b is used to ensure that the resulting fitness values are non-negative. 112 Chapter 4 Optimization of RF CMOS Polyphase Filters Start Create initial random population End Apply fitness measure to individuals of the population Design best individual for result Create a new population Termination criteria satisfied? Yes Select best individuals No Select genetic operations Select one individual based on fitness Select two individuals based on fitness Select one individual based on fitness Perform reproduction Perform crossover Perform mutation Copy into new population Insert offsprings into new population Insert mutation into new population Figure 4.5 Flowchart of the genetic algorithm implemented in PPFOPTIMA. The main functions used in the optimization engine of PPFOPTIMA are listed in the Table 4.1. These GA elements have been integrated into an operational GA. The flowchart of this GA is shown in Figure 4.5. 113 Chapter 4 Optimization of RF CMOS Polyphase Filters Main functions Description ga Basic function roulette Selection function simpleXover Crossover function binaryMutation Mutation function. initializega Initialization function maxGenTerm Termination function Table 4.1 Main functions used in the optimization engine of PPFOPTIMA. 4.6 Implementation of PPFOPTIMA 4.6.1 Introduction In Figure 4.6, the framework of PPFOPTIMA is shown, from which we can see that inputs needed from the user are specifications of the design, e.g. the operating frequency, and process related information. Under these conditions, the GA used in the optimization engine makes tradeoffs between resistors, capacitors and their corresponding physical size. Values of the resistors and the capacitors are determined by process tolerances and constraints from thermal noise. The physical sizes of the resistors and the capacitors are determined by component mismatch properties and constraints from noise coupling and insertion loss. The output of PPFOPTIMA comprises the optimized circuit dimension for schematic and the physical layout, which 114 Chapter 4 Optimization of RF CMOS Polyphase Filters is convenient and efficient for designers under time-to-market pressures. Details of the system implementation will be illustrated in the following subsections. RF CMOS PPFs design specifications Quadrature accuracy Tolerance design of resistors and capacitors Process tolerance CMOS process files Component mismatch Maximum area of resistors and capacitors Design constraints Insertion loss Thermal noise Fewer stages, Minimum area Trade - off values of resistors and capacitors Constraints on resistors values Trade - off areas of resistors and capacitors Trade - off values and areas of resistors and capacitors by using genetic algorithms Circuit sizing for schmatic and layout Figure 4.6 Framework of PPFOPTIMA. 115 Coupled noise Minimum area Chapter 4 Optimization of RF CMOS Polyphase Filters 4.6.2 Construction of Fitness Functions Unlike using conventional optimization methods, the first step of the GA is to establish a fitness function F, which is the criterion in selecting the suitable population for the next generation. In PPFOPTIMA, the fitness function is a sum of IRR, chip area and the component mismatch of the resistors and the capacitors with different weights: F = w1S + w2 ( M R + M C ) + w3 RIR (4.32) The real numbers w1 , w2 and w3 are the weighting factors for chip area S, for the component mismatch of resistors M R , and capacitors M C , and for the image reject ratio (IRR) RIR , respectively. In our application, since S , M R and M C are in the order of 10−3 , w1 and w2 are chosen in the order of 104 to differentiate good population from poor ones. 4.6.3 Graphical User Interface In order to facilitate users input and visualize the outputs, a graphical user interface (GUI) has been developed for PPFOPTIMA, which is depicted in Figure 4.7. The blank area shown in Figure 4.7 will be filled by simulation results. The GUI has the following features: 1. Explicit and regulated user input information: Operating frequency and process information required are listed in the user input boxes. In order to avoid possible errors caused by mis-operations, data types in input boxes are 116 Chapter 4 Optimization of RF CMOS Polyphase Filters regulated. For example, in the case of inputs that require numbers, strings will not be accepted, and a popup window will notify the user about this. Figure 4.7 Graphical user interface of PPFOPTIMA. 117 Chapter 4 Optimization of RF CMOS Polyphase Filters 2. Visualized and classified outputs: The optimization results are classified and displayed in different categorized windows. 3. Programmable weights for the fitness function: Weighting factors for component mismatch, chip area and image reject ratio are taken as inputs. 4. Preset values for tutorial purpose: In order to support novice users, input parameters for RF CMOS PPF designed for a Bluetooth receiver in FraunhoferIMS 0.6 µm CMOS technology are provided in the GUI. 5. Integrated high-level verification toolboxes: In order to verify the optimization results, high-level verification toolboxes, namely, Monte Carlo (MC) simulation and worst-case simulation toolboxes, have been developed and integrated into PPFOPTIMA. 4.6.4 Verification Toolboxes A. Introductory Remarks In order to verify the performance of the synthesized circuit, dedicated verification toolboxes, namely, Monte Carlo (MC) simulation and worst-case simulation were developed as already mentioned in section 4.6.3. In our application, the Monte Carlo (MC) simulation provides an estimate of the discrete probability density of gain mismatch and phase mismatch, which are related to the required IRR, the main specification of RF CMOS PPFs. The worst-case simulation gives us the possible worst- 118 Chapter 4 Optimization of RF CMOS Polyphase Filters case values for both the gain mismatch and the phase mismatch versus frequency, respectively. B. Monte Carlo Simulation In a real design, there are a lot of processes happening in probabilistic ways, and it is hard to model or describe them by using ordinary or differential equations. Therefore, a statistical representation is a suitable way to characterize them. In statistical simulations, sequences of random numbers with a certain probability distribution function (PDF) are used to model the stochastic process. Based on this modeling technique, responses of systems to stochastic inputs can be simulated. Usually, many statistical simulations runs are conducted and averaged to reach good accuracy of the simulation results. This is the method of Monte Carlo (MC) simulation, which has following primary components: • Probability distribution functions (PDF) - the statistical description of the physical, or mathematical, system. • Random number generator - a source of random numbers to mimic stochastic factors in the physical system. • Sampling rule - a prescription for sampling from random numbers with the specified PDF. • Scoring (or tallying) - the accumulated outcomes to meet overall tallies or scores for the quantities of interest. 119 Chapter 4 Optimization of RF CMOS Polyphase Filters • Error estimation - an estimate of the statistical error (variance) as a function of the number of trials and other quantities. Process tolerances and component mismatch in integrated circuits are consequences of stochastic processes within a certain range, and they are usually available in CMOS process files derived by elaborate measurements. It is known that both process tolerances and component mismatch have truncated Gaussian probability distribution functions [102]. In our application, Monte Carlo (MC) simulation can be applied to verify the statistical nature of the IRR with certain process tolerances and a resultant component mismatch. In order to obtain comparatively stable and reliable results, many simulation steps must be performed, and the results are taken as an average over the number of Monte Carlo (MC) runs. A flowchart of the Monte Carlo simulation toolbox implemented in PPFOPTIMA is shown in Figure 4.8. The effect of the image reject ratio (IRR) used in this toolbox is represented by the following equation: p RIR = F (mgain , mphase ) = [∑ F ( Ri ,1 , Ci ,1 ,L Ri ,n , Ci ,n )] / p , (4.33) Ri , j = R j ∗ [1 ± PR ] ∗ [1 ± M R ] , (4.34) Ci , j = C j ∗ [1 ± PC ] ∗ [1 ± M C ] , (4.35) i =1 where PR , PC , M R and M C are vectors of random numbers normalized by process tolerances and component mismatch of a given CMOS process. In (4.33) i = 1L p , p is the number of Monte Carlo (MC) runs. In (4.34) and (4.35), j = 1L n , n is the number of cascaded stages in an RF CMOS PPF. 120 Chapter 4 Optimization of RF CMOS Polyphase Filters Start Generate random numbers Normalize random numbers according to probability distrinution functions of process tolerances and component mismatch Take random values of resitors and capacitors to evaluate the IRR No Meet termination criteria? Yes Computer output by averaging the statistical samples Print out, and save output End Figure 4.8 Flowchart of the Monte Carlo simulation option in PPFOPTIMA C .Worst-case Simulation In circuit design, it is required that the worst-case circuit performance satisfies a given target specifications. For most circuits, worst-case circuit performance occurs as the combination of worst-case process tolerance, temperature and component mismatch. 121 Chapter 4 Optimization of RF CMOS Polyphase Filters Start Find worst image reject ratio of RF CMOS PPFs without process tolerances Shift corner frequencies, to make worst image reject ratio fall into the operating band Calculate component mismatch according to the areas of resistors and capacitors Add mismatch into neighboring components Calculate, save and print out simulation results End Figure 4.9 Flowchart of the novel worst-case simulation methodology in PPFOPTIMA. To obtain worst-case simulation results with widely used commercial tools like, e.g. Cadence SpectreRF, the user need to carry out the simulations with variety of models. For example, slow-to-fast, fast-to-slow, fast-to-fast, slow-to-slow and slow-gain models must be considered. The various simulation results must then be compared in order to find the worst-case performance of the circuit. This procedure is inconvenient and expensive with respect to computation and simulation time. 122 Chapter 4 Optimization of RF CMOS Polyphase Filters RF CMOS PPFs with varying numbers of cascaded stages have varying worstcase boundaries. Through analysis, we have found that worst-case boundary of RF CMOS PPFs does not necessarily to occur with the worst process variation. Instead, it occurs in the case of a process variation where worst image reject ratio falls in the operating frequency band. The verification toolboxes of PPFOPTIMA take this observation into account, yielding a novel simulation methodology proposed by the author of this dissertation. The flowchart of the novel worst-case simulation methodology is shown in Figure 4.9. 4.7 Experimental Results 4.7.1 Overview In order to verify effectiveness of PPFOPTIMA, two categories of experiments have been conducted. The first category of experiments is to synthesize and verify multi-stage RF CMOS PPFs for local oscillator (LO) quadrature generation in receivers for a given communication standard. In these experiments, RF CMOS PPFs for LO quadrature generation in a Bluetooth receiver are taken as examples. The second category of experiments is the automated synthesis and verification of RF CMOS PPFs in receivers for different communication standards, especially, for GSM, DECT, and WCDMA receivers, by using PPFOPTIMA. The CMOS process used in all of these experiments is Fraunhofer-IMS 0.6 µm CMOS process. 123 Chapter 4 Optimization of RF CMOS Polyphase Filters 4.7.2 Experiments on RF CMOS PPFs for a Bluetooth Receiver A. Introductory Remarks In this section, multi-stage RF CMOS PPFs following target specifications of a low-IF Bluetooth receiver, which were synthesized and analyzed with PPFOPTIMA, will be presented. These RF CMOS PPFs are designed for LO quadrature generation in this low-IF Bluetooth receiver in which the LO frequency is 2.45 GHz. The specification derived from the Bluetooth standard and the low-IF receiver architecture is an image reject ratio (IRR) great than 30 dB, which can be translated into a gain mismatch of less than 0.7 dB, and a phase mismatch of less than 5 degrees. Although PPFOPTIMA is capable of synthesizing RF CMOS PPFs automatically, in these experiments, RF CMOS PPFs have been synthesized and verified by using PPFOPTIMA manually to verify the effectiveness of the tool. The first step in using PPFOPTIMA is the dimensioning of the circuit by pressing the button ‘Optimization by GA’ in the GUI. Synthesis results, which include values, lengths, widths and layout areas of resistors and capacitors, are shown as ‘Optimization Results’ in the GUI. After that worst-case simulations are used to check whether the performance of the synthesized RF CMOS PPF satisfies the target specifications over all of the process corners. Then, Monte Carlo simulations are used to check the probability distribution of the gain mismatch and the phase difference, respectively. 124 Chapter 4 Optimization of RF CMOS Polyphase Filters B. Experiments on a 2-Stage RF CMOS PPF for a Bluetooth Receiver Shown in Figure 4.10 is the synthesis result of a 2-stage RF CMOS PPF designed for LO quadrature generation in a low-IF Bluetooth receiver. Figure 4.10 Synthesis result of a 2-stage RF CMOS PPF for a Bluetooth receiver. The worst-case simulation results of the RF CMOS PPF synthesized in Figure 4.10 are shown in Figure 4.11. The gain mismatch, mgain , is 0.81 dB and the phase 125 Chapter 4 Optimization of RF CMOS Polyphase Filters difference, d phase , is 92 degrees, i.e., the phase mismatch, mphase , is 2 degrees. As the gain mismatch cannot meet the target specification, RF CMOS PPFs with more cascaded stages must be tried in the following subsections. Figure 4.11 Worst-case simulation results of a 2-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 126 Chapter 4 Optimization of RF CMOS Polyphase Filters As worst-case simulation only provides a boundary of the circuit performance, in order to know the statistical distribution of the circuit performance, Monte Carlo (MC) simulation runs using 2000 samples of RF CMOS PPFs have been conducted. Figure 4.12 Monte Carlo simulation results of a 2-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . 127 Chapter 4 Optimization of RF CMOS Polyphase Filters The Monte Carlo simulation results are expressed as frequency of occurrence histogram for different intervals of the gain mismatch and the phase difference, and they are shown in Figure 4.12. In the MC simulations, after 200 MC runs, the simulation results enter steady state. In 2000 samples of RF CMOS PPFs, 1880, that is, 94% of them have a gain mismatch between 0.52 dB and 0.81 dB, and 1892, that is 94.6% of them have a phase difference between 91.27 degrees and 91.97 degrees, that is, a phase mismatch between 1.27 degrees and 1.97 degrees. C. Experiments on a 3-Stage RF CMOS PPF for a Bluetooth Receiver As the 2-stage RF CMOS PPF synthesized cannot satisfy the target specifications, now let us check whether a 3-stage RF CMOS PPF can satisfy the specifications. Synthesis results of a 3-stage RF CMOS PPF are shown in Figure 4.13. The worst-case simulation results shown in Figure 4.14 reveal a gain mismatch of 0.083 dB, and a phase difference of 90.15 degrees, i.e., a phase mismatch of 0.15 degrees. As the target specifications of this design are met, a 3-stage RF CMOS PPF is chosen. To verify the statistical distribution of gain mismatch and phase mismatch in this design, MC simulation has been used. After 200 MC runs, the simulation results enter steady state. The obtained results are shown in Figure 4.15. In 2000 samples of RF CMOS PPFs, 90% of them have a gain mismatch of less than 0.047 dB and a phase mismatch of less than 0.1 degrees. 128 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.13 Synthesis results of a 3-stage RF CMOS PPF for a Bluetooth receiver. The author would like to mention that in Monte Carlo simulations gain mismatch and phase mismatch could be worse than that from worst-case simulation, because in 129 Chapter 4 Optimization of RF CMOS Polyphase Filters the worst-case simulation, the worst image reject ratio (IRR), in which worst gain mismatch and worst phase mismatch of the RF CMOS PPFs do not necessarily happen at the same time. Figure 4.14 Worst-case simulation results of a 3-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 130 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.15 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . D. Experiments on a 4-stage RF CMOS PPF for a Bluetooth Receiver In this section, a 4-stage RF CMOS PPF for a Bluetooth receiver was synthesized. The synthesis results are shown as ‘Optimization Results’ in Figure 4.16. 131 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.16 Synthesis results of a 4-stage RF CMOS PPF for a Bluetooth receiver. 132 Chapter 4 Optimization of RF CMOS Polyphase Filters The worst-case simulation results of the RF CMOS PPF are shown in Figure 4.17, in which the gain mismatch is 0.028 dB, and the phase difference is 90.031 degrees, i.e., the phase mismatch is equal to 0.031 degrees. Figure 4.17 Worst-case simulation results of a 4-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 133 Chapter 4 Optimization of RF CMOS Polyphase Filters Monte Carlo simulation results are shown in Figure 4.18, after 700 Monte Carlo runs, the simulation result enter steady state. The MC simulation results show that in 2000 samples of RF CMOS PPFs, more than 90% of them have a gain mismatch less than 0.005 dB and phase mismatch less than 0.01 degrees. Figure 4.18 Monte Carlo simulation results of a 4-stage RF CMOS PPF for a Bluetooth receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . 134 Chapter 4 Optimization of RF CMOS Polyphase Filters From the simulation results above, we can see that the performance of the 4-stage RF CMOS PPF synthesized is more than sufficient for the target specifications in a lowIF Bluetooth receiver. However, for passive filters like RF CMOS PPFs, they have a nominal insertion loss of 3 dB/stage. In order to compensate the insertion loss, buffer amplifiers are usually necessary for RF CMOS PPFs with many cascaded stages, thus, causing higher power consumption. In the design of CMOS wireless receivers, low power consumption is required. Thus, the strategy for topology selection in PPFOPTIMA is to use as few cascaded stages as possible to satisfy the target specifications. 4.7.3 Automated Synthesis and Verification of RF CMOS PPFs for Different Communication Standards A. Introductory Remarks In Figure 4.19 the GUI of PPFOPTIMA for automated synthesis of RF CMOS PPFs is shown. The specification needed is image reject ratio (IRR) for CMOS wireless receivers. With a given specification, a 2-stage RF CMOS PPF is chosen at first, and optimized by PPFOPTIMA, and then the worst-case simulation is conducted to verify whether the specifications can be met. If the specifications are met, a popup window will notify the user that a 2-stage RF CMOS PPF is chosen and the optimized circuit dimension is provided. If a 2-stage RF CMOS PPF cannot meet the specifications, the 135 Chapter 4 Optimization of RF CMOS Polyphase Filters number of stages of the RF CMOS PPFs is increased by one until the specification can be met. The final results are an RF CMOS PPF with a selected number of stages and optimized circuit dimensions. Figure 4.19 Graphic user interfaces of PPFOPTIMA for automated synthesis of RF CMOS PPFs. In order to verify the effectiveness of PPFOPTIMA in automated synthesis and verification, RF CMOS PPFs for LO quadrature generation in receivers of different communication standards, for example, GSM, DECT and WCDMA were synthesized and verified. The results will be presented in the remainder of this section 4.7.3. 136 Chapter 4 Optimization of RF CMOS Polyphase Filters B. Automated Synthesis and Verification of RF CMOS PPF for a GSM Receiver Figure 4.20 Synthesis results of a 3-stage-RF CMOS PPF for a GSM receiver. 137 Chapter 4 Optimization of RF CMOS Polyphase Filters In this experiment, an RF CMOS PPF targeting an image reject ratio (IRR) of at least 40 dB for a low-IF GSM receiver was synthesized and verified. A 3-stage RF CMOS PPF was chosen by PPFOPTIMA, the synthesis results are shown in Figure 4.20. Figure 4.21 Worst-case simulation results of a 3-stage RF CMOS PPF for a GSM receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 138 Chapter 4 Optimization of RF CMOS Polyphase Filters The worst-case simulation results are shown in Figure 4.21, in which the IRR is 49.2 dB, the gain mismatch is 0.0512 dB and the phase difference is 90.1072 degrees, i.e., the phase mismatch is 0.1072 degrees. Figure 4.22 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a GSM receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . 139 Chapter 4 Optimization of RF CMOS Polyphase Filters In order to check the statistical distribution of gain mismatch and phase mismatch, a Monte Carlo (MC) simulation in PPFOPTIMA was conducted. After 200 MC runs, the results enter a steady state. The results of the MC simulation are shown in the Figure 4.22, from which we can see that in 2000 samples of RF CMOS PPFs, more than 90% of them have a gain mismatch of less than 0.045 dB, and a phase mismatch of less than 0.1 degrees. Figure 4.23 Synthesis results of a 2-stage-RF CMOS PPF for a DECT receiver. 140 Chapter 4 Optimization of RF CMOS Polyphase Filters C. Automated Synthesis and Verification of RF CMOS PPFs for a DECT Receiver In this section, an RF CMOS PPF targeting 28 dB IRR for a low-IF DECT receiver has been synthesized and verified. A 2-stage RF CMOS PPF was chosen by PPFOPTIMA, the synthesis results are shown in Figure 4.23. Figure 4.24 Worst-case simulation results of a 2-stage RF CMOS PPF for a DECT receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 141 Chapter 4 Optimization of RF CMOS Polyphase Filters The worst-case simulation results of the RF CMOS PPF synthesized according to Figure 4.23 are shown in Figure 4.24. The worst-case IRR is 30.7 dB, the gain mismatch is 0.612 dB, and the phase difference is 91.51 degrees, i.e., the phase mismatch is 1.51 degrees. Figure 4.25 Monte Carlo simulation results of a 2-stage RF CMOS PPF for a DECT receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . 142 Chapter 4 Optimization of RF CMOS Polyphase Filters To check the statistical distribution of gain and the phase mismatch, Monte Carlo simulation in PPFOPTIMA was applied. After 200 MC runs, the simulation results enter a steady state. The MC simulation results are shown in Figure 4.25. In 2000 samples of RF CMOS PPFs, more than 90% of them have the gain mismatch between 0.45 dB to 0.61 dB, and the phase mismatch between 0.9 degrees and 1.5 degrees. D. Automated Synthesis and Verification of RF CMOS PPFs for a WCDMA Receiver In this section, an RF CMOS PPF for LO quadrature generation in a low-IF WCDMA receiver was synthesized and verified. The LO frequency is set to 1.90 GHz, and the targeting specification of RF CMOS PPF is 36 dB IRR. A 3-stage RF CMOS PPF was chosen by PPFOPTIMA, the synthesis results are shown in Figure 4.26. The worst-case simulation results are shown in Figure 4.27, in which the worstcase IRR is 49.1 dB, the gain mismatch is 0.0541 dB, the phase difference is 90.1201 degrees, i.e., the phase mismatch is 0.1201 degrees. To check the statistical distribution of the gain mismatch and the phase mismatch, a Monte Carlo simulation in PPFOPTIMA has been conducted. The MC simulation results shown in Figure 4.28 demonstrate that, in 2000 samples of RF CMOS PPFs, more than 90% of them have the gain mismatch less than 0.04 dB, and the phase mismatch less than 0.1 degrees. 143 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.26 Synthesis results of a 3-stage-RF CMOS PPF for a WCDMA receiver. 144 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.27 Worst-case simulation results of a 3-stage RF CMOS PPF for a WCDMA receiver. Upper plot: gain mismatch mgain versus frequency f. Lower plot: phase difference d phase versus frequency f. 145 Chapter 4 Optimization of RF CMOS Polyphase Filters Figure 4.28 Monte Carlo simulation results of a 3-stage RF CMOS PPF for a WCDMA receiver. Upper plot: histogram of the gain mismatch mgain . Lower plot: histogram of the phase difference d phase . 4.8 Summary In this chapter, the optimization problem for RF CMOS PPFs has been formulated. Possible optimization algorithms like calculus-based optimization, gradient 146 Chapter 4 Optimization of RF CMOS Polyphase Filters descend, simulated annealing (SA) and genetic algorithms (GA) have been analyzed. GA has been selected for the optimization engine because of its advantages in escaping from local optima. PPFOPTIMA, a GA based optimization tool for RF CMOS PPFs has been implemented by using MATLAB. In order to facilitate designers in design automation, this tool has been developed further into a specification-driven automated synthesis and verification environment incorporating dedicated worst-case and Monte Carlo simulation. In order to verify the effectiveness of PPFOPTIMA, two types of experiments have been conducted. The first type of experiments consists of the synthesis and the verification of multi-stage RF CMOS PPFs in a receiver for a given communication standard. Here, a low-IF Bluetooth receiver has been taken as an example. The second type of experiments consists of the synthesis and verification of the RF CMOS PPFs for different communications standards, namely GSM, DECT, and WCDMA. The experimental results demonstrate that PPFOPTIMA is effective in synthesis, optimization and verification of RF CMOS PPFs. Focusing on the optimization of RF CMOS PPFs, this chapter has the following contributions: 1. The methodology of optimization of RF CMOS PPFs with layout considerations by using genetic algorithm (GA) has been illustrated. 147 Chapter 4 Optimization of RF CMOS Polyphase Filters 2. PPFOPTIMA, a computer-aided synthesis and optimization tool for RF CMOS PPFs, has been presented. 3. Dedicated worst-case simulation and Monte Carlo simulation toolboxes for verification of the performance of RF CMOS PPF have been developed. 148 Chapter 5 Summary and Outlook Chapter 5 Summary and Outlook 5.1 Summary RF CMOS polyphase filters (PPFs) is an efficient solution for high accuracy radio frequency quadrature generation in CMOS technology. The main specification of the RF CMOS PPF, namely the quadrature accuracy, is layout dependent; and the requirements from component match are contradictory to that of minimization of noise coupling, signal loss and chip area, thus a tradeoff must be made in a specific design. By simply following guidelines proposed by Behbahani [62], it takes intensive trials and many design iterations to reach a good design. Furthermore, with layout considerations, the optimization of RF CMOS PPFs cannot be solved by using analytical calculations, because of many constraints and tradeoffs in the design. In this situation, a computer-aided analysis and design optimization tool for RF CMOS PPFs is of great help to the community of RF CMOS PPFs designers, especially for industrial projects, which are under time-to-market pressure. Unfortunately, until now, there is no such dedicated tool available, to the author’s best knowledge. Focused on analysis, design and optimization of RF CMOS PPFs, this dissertation has following contributions: 1. PPFANA, a dedicated software tool for simulation of quadrature accuracy in RF CMOS PPFs influenced by process tolerances and component mismatch, 149 Chapter 5 Summary and Outlook has been developed. It provides an efficient computer-aided analysis for RF CMOS PPFs. 2. Based on the simplified RF CMOS models of resistors, and capacitors, parasitic effects in RF CMOS PPFs have been analyzed. Techniques of minimizing those unwanted influences from parasitics have been proposed, and physical design considerations for RF CMOS polyphase filter in system-on-achip (SoC) solution have been analyzed. 3. Silicon success of an RF CMOS polyphase filter for a low-IF Bluetooth receiver was achieved. Measurement results from this practical design further verified the effectiveness of PPFANA. Design consideration and design heuristics from this design practice lay a solid foundation for this dissertation. 4. Based on heuristics from the practical design of an RF CMOS PPF, a design automation oriented design flow for RF CMOS PPFs has been proposed. 5. By analysis on existing optimization algorithms, the methodology of synthesis and verification of RF CMOS PPFs with layout considerations by using genetic algorithm (GA) has been proposed in this dissertation. 6. PPFOPTIMA, a GA based optimization tool for RF CMOS PPFs has been implemented by using MATLAB. In order to enable the designers in design automation, PPFOPTIMA has been developed further towards a specificationdriven automated synthesis and verification environment incorporating dedicated worst-case and Monte Carlo simulation options. 150 Chapter 5 Summary and Outlook 5.2 Outlook Compared to Electronic Design Automation (EDA) tools for digital circuit, those for analog circuit, especially for RF circuit, are still in their infancy. Nowadays, RF analog design is still a kind of ‘art’, which is done by ‘Analog Artists’. Although some research groups, e.g. at the University of California at Los Angeles, and at the Katholieke Universiteit Leuven, have contributed some design automation tools for some RF components, there is still a far way to go in the research topic. Optimization is a key step in design automation of analog and RF circuits. Though RF circuits are comparatively simple in the sense of the number of components, taking layout considerations into account, optimization of RF circuits is complicated because of multiple design objectives and constraints. In this situation, genetic algorithm (GA) has advantages over other conventional optimization techniques for its capability in escaping from local optima. The successful application of GA in the optimization of RF CMOS PPFs demonstrates that GA is effective and efficient in RF circuit optimization. However, this optimization methodology has following drawbacks: 1. GA is able to escape from local optima, but it is not good at finding exact optimum point. 2. GA is not intelligent enough to be trained, that is, for GA based optimization tools, if modification is needed; change of fitness function and more work is needed. 3. It is still heuristics based trials to find suitable weights in applications of GAs. 151 Chapter 5 Summary and Outlook Compared to GA, an artificial neural network (ANN) may lead to improvements because of its self-learning mechanisms. For RF circuit synthesis and optimization, an ANN may find a wider application in the future. 152 References References I. Review and Outlook of CMOS Processes [1] Gray, P.; Meyer, R.: Future directions of silicon ICs for RF personal communications. Proceedings of the Custom Integrated Circuits Conference (CICC’95), Santa Clara/CA, pp. 83-90, 1995. [2] Lee, T. H.: CMOS RF.: No longer an oxymoron. Proceedings of the IEEE Gallium Arsenide Integrated Circuit Symposium (ICS’97), Anaheim/CA, pp. 244-247, 1997. [3] Lee, T. H.: Recent developments in CMOS RF integrated circuits. Proceedings of the IEEE International Microwave Symposium (MTT-S’98), Baltimore/ML, pp.137-141, 1998. [4] Huang, Q.; Piazza, F.; Orsatti, P.; Ohguro, T.: The impact of scaling down to deepsubmicron on CMOS RF circuits. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp.1023-1036. [5] Wen, K.; Wuen, W.: CMOS RFIC: application to wireless transceiver design, IEICE Transactions on Electronics. vol. E83-C (2000), pp. 187-202. [6] Abidi, A. A.: RF CMOS comes of age. 2003 Symposium on VLSI Circuits Digest of Technical Papers, 4-89114-035-6/03, Kyoto/Japan, June 2003. [7] Hoffman, K.: System integration, from transistor design to large scale integrated circuits. Chichester: Wiley, 2004. II. CMOS Wireless Transceivers [8] Abidi, A. A.: Direct-conversion radio transceivers for digital communication. IEEE Journal of Solid State Circuits, vol. 30 (1995), pp. 1399-1410. [9] Abidi, A. A.: Low-power radio-frequency ICs for portable communications. Proceedings of the IEEE, vol. 83 (1995), pp. 544-69. [10] Rofougaran, A.; Chang, J.; Rofougaran, M.; Abidi, A. A.: A 1 GHz CMOS RF front-end IC for a direct-conversion wireless receiver. IEEE Journal of Solid State Circuits. vol. 31(1996), pp. 880-889. [11] Rudell, J. C.; Ou, J. J.; Cho, T.; Chien, G.; Brianti, F.; Weldon, J. A.; Gray, P. R.: A 1.9GHz wide-band IF double conversion CMOS receiver for cordless telephone applications. IEEE Journal of Solid State Circuits, vol. 32 (1997), pp. 2071-2088. [12] Piazza, F.; Huang, Q.: A 12mA triple conversion RF receiver for GPS. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 202-209. [13] Rofougaran, A.; Chang, G.; Rael, J. J.; Chang, J.; Rofougaran, M.; Chang, P. J.; Djafari, M.; Min, J.; Roth, E.; Abidi, A. A.; Samueli, H.: A single- chip 900 MHz spreadspectrum wireless transceiver in 1 µm CMOS, Part 2: Receiver Design. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 1087-1099. 153 References [14] Wu, S.; Razavi, B.: A 900-MHz/1.8-GHz CMOS receiver for dual-band applications. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 2178-2185. [15] Tadjpour, S.; Cijvat, E.; Hegazi, E.; Abidi, A. A.: A 900-MHz dual-conversion low-IF GSM receiver in 0.35µm CMOS. IEEE Journal of Solid State Circuits, vol. 36 (2001), pp. 1992-2002. [16] Zeijl, P. van.; Eikenboek, J. T.; Vervoort, P. P.; Setty, S.; Tangenberg, J.; Shipton, G.; Kooistra, E.; Keekstra, I.C.; Belot, D.; Visser, K.; Bosma, E.; Blaakmeer, S.C.: A Bluetooth radio in 0.18 µm CMOS. IEEE Journal of Solid State Circuits, vol. 37 (2002), pp. 1679-95. [17] Manstretta, D.; Castello, R.; Gatta, F.; Rossi, P.; Svelto, F.: A 0.18µm CMOS direct conversion receiver front-end for UMTS. Proceedings of IEEE Solid State Circuit Conference (ISSCC’02), Leuven/Belgium, Digest of Technical Papers, pp. 1120-1124. [18] Lee, K. Y.; Lee, S. W.; Koo, Y.; Huh, H.; Nam, H.; Lee, J.; Park, J.; Lee, K.; Jeong, D.; Kim, W.: A full-CMOS 2-GHz WCDMA direct conversion transmitter and receiver. IEEE Journal of Solid State Circuits, vol. 38 (2003), pp. 1174-1186. III. Wireless Transceiver Architectures [19] Hamilton, N. C.: Aspects of direct conversion receiver design. Proceedings of the fifth International Conferences on HF Radio System and Technology, Edinburgh/ UK, pp. 299-303, 1991. [20] Min, J.; Rofougaran, A.; Samueli, H.; Abidi, A. A.: An all-CMOS architecture for a low-power frequency-hopped 900 MHz spread-spectrum transceiver. Proceedings of the Custom IC Conference, San Diego/ CA, pp. 379-382, 1994. [21] Pottie, G. J.: System design choices in personal communications. IEEE Personal Communications, vol. 2 (1995), No. 5, pp. 50-67. [22] Rofougaran, A. G.; Chang, J. J.; Rael, J.; Chang, Y.C.; Rofougaran, M.; Chang, P. J.; Djafari, M.; Min, J.; Roth, E.; Abidi, A. A.; Samueli, H.: A single-chip 900 MHz spread-spectrum wireless transceiver in 1-µm CMOS, part 1: architecture and transmitter design. IEEE Journal of Solid State Circuits, vol. 33, (1998), pp. 583-601. [23] Crols, J.; Steyaert, M.: CMOS wireless transceiver design. London: Kluwer Academic Publishers, second edition, 2000. [24] Mirabbasi, S.; Martin, K.: Classical and modern receiver architectures. IEEE Communications Magazine, vol. 38 (2000), No. 8, pp. 132-139. [25] Razavi, B.: RF CMOS transceivers for cellular telephony. IEEE Communications Magazine, vol. 41 (2003), No. 8, pp. 144-149. IV. Image Reject Mixer and Image Reject Receiver 154 References [26] Rudell, J. C.; Ou, J. J.; Cho, T. band Chien, G.; Brianti, F.; Weldon, J. A.; Gray P. R.: A 1.9-GHz wide-band IF double conversion CMOS receiver for cordless telephone applications. IEEE Journal of Solid State Circuits, vol. 32 (1997), pp. 2071-2088. [27] Long, J. R.; Maliepaard, M. C.: A 1V 900MHz image-reject down-converter in 0.5 µm CMOS. Proceedings of the Custom Integrated Circuits Conference (CICC’99), San Diego/CA, pp. 665-668, May, 1999. [28] Maligeorgos J.; Long, J. R.: A 2V 5.1-5.8 GHz image-reject receiver with wide dynamic range. Proceedings of the International Solid State Circuits Conference (ISSCC’2000), pp .322-330, Feb. 2000. [29] Long, J. R.: A low-voltage 5.1-5.8-GHz image-reject down converter RF IC. IEEE Journal of Solid State Circuits, vol. 35 (2000), pp. 1320-1328. [30] Montemayor, R.; Razavi, B.: A self-calibrating 900-MHz CMOS image-reject receiver. Proceedings of the European Solid State Circuit Conference, pp. 292-295, Sept. 2000. [31] Maligeorgos, J. P.; Long, J. R.: A low-voltage 5.1-5.8-GHz image-reject receiver with wide dynamic range. IEEE Journal of Solid State Circuits, vol. 35 (2000), pp. 1917-1926. [32] Vancorenl, P.; Steyaert, M.: A wideband IMRR improving quadrature mixer/LO generator. Proceedings of the European Solid State Circuits Conference (ESSIRC”2001), Villach/Austria, pp. 360-363, Sept, 2001. [33] Weldon, J. A.; Narayanaswami, R. S.; Rudell, J. C.; Lin, L.; Masanori, O.; Dedieu, S.; Tsai, K. C.; Lee, C. W.; Gray, P. R.: A 1.75 GHz highly integrated narrow-band CMOS transmitter with harmonic-rejection mixers. IEEE Journal of Solid State Circuits, vol. 36 (2001), pp. 2003-2015. [34] Der, L.; Razavi, B.: A 2-GHz CMOS image-reject receiver with LMS calibration. IEEE Journal of Solid State Circuits, vol. 38 (2003), pp. 683-695. V. Quadrature Generation Techniques [35] Yamamoto, K.; Maemura, K.; Andoh, N.; Mitsui, Y.: A 1.9-GHz-band GaAs directquadrature modulator IC with a phase shifter. IEEE Journal of Solid State Circuits, vol. 28 (1993), pp. 994-1000. [36] Rofougaran, A.; Rael, J.; Rofougaran, M.; Abidi, A. A.: A 900 MHz CMOS LC-oscillator with quadrature outputs. Proceedings of the International Solid State Circuits Conference (ISSCC’96), San Francisco/CA, pp. 392-393, 1996. [37] Navid, S.; Behbahani, F.; Fotowat, A.; Hajimiri, A.; Gaethke, R.; Delurio, M.: Levellocked loop, A technique for broadband quadrature signal generation. Proceedings of the Custom Integrated Circuits Conference, Santa Clara/CA, pp. 411-414, May 1997. [38] Maloberti, F.; Signorelli, M.: Quadrature waveform generator with enhanced performances. Proceedings of the Symposium on VLSI circuits (VLSI’98), Lafayette/Louisiana, pp. 56-57, 1998. 155 References [39] Matsuoka, H.; Tsukahara, T.: A 5-GHz frequency-doubling quadrature modulator with a ring-type local oscillator. IEEE Journal of Solid State Circuits, vol. 34 (1999), pp. 13451348. [40] Liu, T. P.; Westerwick, E.: 5-GHz CMOS radio transceiver front-end chipset. IEEE Journal of Solid State Circuits, vol. 35 (2000), pp. 1927-1933. [41] Osa, J.; Carlosena, A.: Limitations of the MOS resistive circuit in MOSFET-C implementation: bandwidth, noise, offset and non-linearity. Analog Integrated Circuits and Signal Processing, vol. 28 (2001), pp. 239-252. [42] Melville, R.; Long, D.; Gopinathan, V.; Kinget, P.: An injection-locking scheme for precision quadrature generation. Proceedings of the European Solid State Circuits Conference, Villach/Austria, pp. 275-279, Sept. 2001. [43] Leenaerts, D. M. W.; Vaucher, C. S.; Bergveld, H. J.; Thompson, M.; Moore, K.: A 15mW fully integrated I/Q synthesizer for Bluetooth in 0.18µm CMOS. IEEE Journal of Solid State Circuits, vol. 38 (2003), pp.1155-1162. [44] Mazzanti, A.; Uggetti, P.; Rossi, P.; Svelto, F.: Injection locking LC dividers for low power quadrature generator. Proceedings of the IEEE Custom Integrated Circuits Conference (CICC’2003), pp. 328-332, 2003. VI. Polyphase Filters (Patent Related Documentations) [45] Gingell, M. J.: A symmetrical polyphase network, British Patents 1,174,709 & 1,174,710. June 7, 1968. US Patent 3,559,042 & 3,618,133, Jan 26, 1971. [46] Gingell, M. J.: Single sideband modulation using sequence asymmetric polyphase networks, Electrical Communication Magazine, vol. 48 (1973), pp. 21-25. [47] Hawker, P.: Polyphase system for SSB generation. Radio Communication, pp. 698-699, Oct. 1973. [48] Gingell, M. J.: The synthesis and application of polyphase networks with sequence asymmetric properties, Ph.D. Thesis, University of London, 1975. [49] Gingell, M. J.: Sequence asymmetric polyphase networks: application to FDM. IEE Colloquium on Applications of Active, Digital and Passive Filters, London/UK, January 1975. [50] Hawker, P.: G3PLX polyphase SSB generator. Radio Communication, pp. 379-381, May 1975. [51] Horowitz.; Hill.: The art of electronics. New York, Cambridge University Press, 1990. [52] Richard, H.: Polyphase direct conversion SSB. Wireless World, pp. 202-206, March 1994. [53] Schmidt, K.: Phase-shift network analysis and optimization. QEX including Communications Quarterly, pp. 17-23, April 1994. [54] Tetsuo, Y.: Polyphase network calculation using a vector analysis method. QEX including Communications Quarterly, pp. 9-15, June 1995. 156 References VII. Analysis and Design of RF CMOS Polyphase Filters [55] Steyaert, M.; Crols, J.: Analog integrated polyphase filters. Proceedings of the Workshop on Advances in Analog Circuit Design, Duisburg / Germany, pp. 18, March 1994. [56] Crols, J.; Steyaert, M.: An analog integrated polyphase filter for a high performance lowIF receiver. Proceedings of the IEEE Symposium on VLSI Circuits (VLSI’95), Kyoto / Japan, pp. 87-92, June 1995. [57] De Ranter, C.; Borremans, M.; Steyaert, M.: A wideband linearisation technique for nonlinear oscillators using a multi-stage polyphase filter. Proceedings of the European Solid State Circuits Conference (ESSIRC’99), Duisburg / Germany, pp. 214-217, Sept. 1999. [58] Galal, S. H.; Tawfik, S.: On the design and sensitivity of RC sequence asymmetric polyphase networks in RF integrated transceiver. Proceedings of the IEEE International Symposium on Circuit and System (ISCAS’99), pp. 593-597, 1999. [59] Galal, S. H.; Ragaie, H. F.; Tawfik, M. S.: RC sequence asymmetric polyphase networks for RF integrated transceivers. IEEE Transactions on Circuit and System (II), vol.47 (2000), pp. 1127-1134. [60] Borremans, M.; De Muer, B.; Steyaert, M.: The optimization of GHz integrated CMOS quadrature VCOs based on a polyphase filter loaded differential oscillator. Proceedings of the IEEE International Symposium on Circuits and Systems (ISCAS’2000), Geneva / Switzerland, pp. 729-732, May 2000. [61] Andreani, P.; Mattisson, S.; Essink, B.: A CMOS gm-C polyphase filter with high image band rejection. Proceedings of the European Solid State Circuits Conference (ESSIRC’2000), pp. 244-247, Sept. 2000. [62] Behbahani, F.; Kishigami, Y.; Leete, J.; Abidi, A. A.: CMOS mixers and polyphase filters for large image rejection. IEEE Journal of Solid State Circuits, vol. 36 (2001), pp. 873-887. [63] Mihai, S.; Tiberiu, A.: Power, accuracy and noise aspects in CMOS mixed-signal design. Boston: Kluwer Academic Publishers, March 2002. [64] Shi, B.; Shan, W.; Andreani, P.: A 57-dB image band rejection CMOS Gm-C polyphase filter with automatic frequency tuning for Bluetooth. Proceedings of the IEEE International Symposium on Circuit and System (ISCAS’02), Scottsdale/AZ, pp. 169-172, June 2002. [65] Kobayashi, H.; Kang, Jian.; Kitahara, Tokashi.: Explicit transfer function of RC polyphase filter for wirless transceiver. Proceedings of the Third IEEE Asian-pacific Conference on ASICs (APASIC’02), Session 3A-Analog Communication Circuits (II), Paper 5, Taipei / Taiwan, August 2002. [66] Andreani, P.; Bonfanti, A.; Romanò, L.; Samori, C.: Analysis and Design of a 1.8-GHz CMOS LC quadrature VCO. IEEE Journal of Solid State Circuits, vol. 37 (2002), pp. 1737-1747. [67] Kadoyama, T.; Suzuki, N.; Sasho, N.; Iizuka, H.; Nagase, I.; Usukubo, H.; Katakura, M.; A complete single-chip GPS receiver with 1.6-V 24-mW radio in 0.18-µm CMOS. 157 References Proceedings of the Symposium on VLSI Circuits (VLSI’03), Kyoto / Japan, Section 10, paper 4, June 2003. [68] De Ranter, C.; Steyaert, M.: High data rate transmitter circuits, RF CMOS design and techniques for design automation. Boston: Kluwer Academic Publisher, 2003. VIII. Analog Circuit Analysis, Device Modeling and Layout [69] Chen, W. K.: Passive and active filters, theory and implementations. New York: Wiley, 1986. [70] Gray, P. R.; Meyer, R. G.: Analysis and Design of Analog Integrated Circuits, Wiley, 1993. [71] Martinez, J. S.; Stayaert, M.; Sansen, W.: High-performance CMOS continuous-time filters. Boston: Kluwer Academic Publishers, 1993. [72] Tsividis, Y. P.: Integrated continuous-time filter design - an overview. IEEE Journal of Solid State Circuits, vol. 29 (1994), pp. 166-176. [73] McNutt, M. J.; LeMarquis, S.; Dunkley, J.: Systematic capacitance matching errors and corrective layout procedures. IEEE Journal of Solid State Circuits, vol. 29 (1994), pp. 611616. [74] Berge, J. M.; Levia, O.; Rouillard, J.: Modeling in analog design. Boston, Kluwer Academic Publishers, 1995. [75] Engberg, J.; Larsen, T.: Noise theory of linear and nonlinear circuits. Wiley, 1996. [76] Klaassen, D. B. M.: Compact modeling of sub-micron CMOS. Proceedings of the European Solid State Circuits Conference (ESSIRC’96), Neuchatel/Switzerland, pp. 40-46, Sept. 1996. [77] Baker, R. J.; Li, H. W.; Boyce, D. E.: CMOS circuit design, layout, and simulation. New York: IEEE Press, 1998. [78] Thomas, R. E.; Rosa, A.: The analysis and design of linear circuits, Wiley, 2001. [79] Cheng, Y.: MOSFET modeling for RF IC design. International Journal of High Speed Electronics and Systems, vol.11 (2001), pp. 1321-1340. [80] Allen P.; Holberg, D.: CMOS analog circuit design. Oxford University Press, 2002. [81] Ytterdal, T.; Cheng, Y.; Fjeldly, T. A.: Device modeling for analog and RF CMOS circuit design. Wiley, 2003. IX. RF Microeletronic Design (Books) [82] Goyal, R.: High frequency analog integrated circuit design. New York: Wiley, 1995. [83] Nibler, F.: High frequency circuit engineering. London: IEE Press, 1996. [84] Razavi, B.: RF Microelectronics. New Jersey: Prentice-Hall, 1997. [85] Lee, T. H.: The design of CMOS radio-frequency integrated circuits. Cambridge: Cambridge University Press, 1998. [86] Pozar, D. M.: Microwave and RF design of wireless systems. New York: Wiley, 2001. 158 References X. Substrate Noise Coupling [87] Verghese, N.; Allstot, D. J.: Computer-aided design considerations for mixed-signal coupling in RF integrated circuits. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 314-323. [88] Pfost, M.; Rein, H.: Modeling and measurement of substrate coupling in Si-bipolar ICs up to 40 GHz. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 582-591. [89] Yue, C. P.; Wong, S. S.: On-chip spiral inductors with patterned ground shields for Sibased RF ICs. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 743-752. [90] Charbon, E.; Gharpurey, R.; Meyer, R. G.; Sangiovanni-Vincentelli, A.: Substrate optimization based on semi-analytical techniques. IEEE Transactions on Computer-Aided Design, vol. 18 (1999), pp. 172-190. [91] Costa, J. P.; Chou, M.; Silveira, L. M.: Efficient techniques for accurate modeling and simulation of substrate coupling in mixed-signal ICs. IEEE Transactions on ComputerAided Design, vol. 18 (1999), pp. 597-607. [92] Colvin, J. T.; Bhatia, S. S.; Kenneth, K. O.: Effects of substrate resistances on LNA performance and a bond-pad structure for reducing the effects in a silicon bipolar technology. IEEE Journal of Solid State Circuits, vol. 34 (1999), pp. 1339-1344. [93] Aragones, X.; Rubio, A.: Experimental comparison of substrate noise coupling using different wafer types. IEEE Journal of Solid State Circuits, vol. 34 (1999), pp. 1405-1409. [94] Felder, M.; Ganger, J.: Analysis of ground-bounce induced substrate noise coupling in a low resistive bulk epitaxial process: design strategies to minimize noise effects on a mixedsignal chip. IEEE Transactions on Circuit and System (II), vol. 46 (1999), pp. 1427-1436. [95] Makoto N.; Jin N.; Takashi M.; Atsushi I.; Measurements and analyses of substrate noise waveform in mixed-signal IC environment. IEEE Transactions on Computer-Aided Design, vol. 19 (2000), pp. 671-678. [96] Samavedam, A.; Sadate, A.; Mayaram, K.; Fiez T. S.: A scalable substrate noise-coupling model for design of mixed-signal ICs. IEEE Journal of Solid State Circuits, vol. 35 (2000), pp. 895-904. [97] Yuan, Z. Y.; Li, Z. F.; Zou, M. L.: Computer-aided analysis of on-chip interconnects near semiconductor substrate for high-speed VLSI. IEEE Transactions on Computer-Aided Design, vol. 19 (2000), pp. 990-998. [98] Masoumi, N.; Elmasry, M. I.; Safieddin, S. N.: Fast and efficient parametric modeling of contact-to-substrate coupling. IEEE Transactions on Computer-Aided Design, vol. 19 (2000), pp. 1282-1292. [99] Charbon, E.; Gharpurey, R.; Miliozzi, P.; Meyer, R.; Sangiovanni-Vincentelli, A.: Substrate noise-analysis and optimization for IC design. Boston: Kluwer Academic Publishers, 2001. [100] Peng, M. S.; Lee, H. S.: Study of substrate noise and techniques for minimization. Proceedings of the Symposium on VLSI Circuits (VLSI’03), Section 15, paper 2, Kyoto / Japan, June 2003. 159 References [101] Charbon, E.; Miliozzi, P.; Carloni, L. P.; Ferrari, A.; Sangiovanni-Vincentelli, A.: modeling digital substrate noise injection in mixed-signal ICs. IEEE Transactions on Computer Aided Design of Integrated Circuit, vol. 18 (1999), pp. 301-310. XI. Tolerance Design [102] Spence, R.; Soin, R. S.: Tolerance design of electronic circuit. New York: AddisonWesley, 1997. XII. Conventional Optimization Methods and Applications in Electronic Design [103] Sapatnekar, S. S.; Rao, V. B.; Vaidya, P. M.; Kang, S. M.: An exact solution to the transistor sizing problem for CMOS circuits using convex approximation. IEEE Transaction on Computer–Aided Design, vol. 12 (1993), pp. 1621-1634. [104] Devadas, S.; Malik, S.: Survey of optimization techniques targeting low power VLSI circuit. Proceedings of the Conference on Design Automation (DAC’95), San Francisco/CA, pp. 738-742, 1995. [105] Wolfe, A.: Opportunities and obstacles in low–power system–level CAD. Proceedings of the Conference on Design Automation (DAC’96), Paris/France, pp. 1178-1182, 1996. [106] Conn, A. R.; Haring, R. A.; Visweswariath, C.: Noise considerations in circuit optimization. Proceedings of the IEEE/ACM International conference on Computer Aided Design, Baltimore/ML, pp. 220-227, 1998. [107] Del Mar Hershenson, M.; Mohan, S. S.; Boyd, S. P.; Lee, T. H.: Design and optimization of LC oscillators. Proceedings of the IEEE/ACM International Conference on Computer Aided Design, San Jose / CA, pp. 65-69, Nov. 1999. XIII. Simulated Annealing and Applications in Electronic Design [108] Kirkpatrick, S.; Gelatt Jr. C. D.; Vecchi, M. P.: Optimization by Simulated Annealing. Science, pp. 671-680, 1983. [109] Gielen, G.; Walscharts, H.; Sansen, W.: Analog circuit design optimization based on symbolic simulation and simulated annealing. IEEE Journal of Solid State Circuits, vol. 25 (1990), pp. 707-713. [110] Swings, K.; Gielen, G.; Sansen, W.: An intelligent analog IC design system based on manipulation of design equations. Proceedings of the IEEE Custom Integrated Circuits Conference (CICC’90), pp. 8.6.1-8.6.4, 1990. [111] Lampaert, K.; Gielen, G.; Sansen, W.: A performance-driven placement tool for analog integrated circuits. IEEE Journal of Solid State Circuits, vol. 30 (1995), pp. 773-780. 160 References [112] Carley, L. R.; Gielen, G.; Rutenbar, R.; Sansen, W.: Synthesis tools for mixed-signal ICs: Progress on frontend and backend strategies. Proceedings of the Design Automation Conference (DCA’96), Paris/France, pp. 298-303, June 1996. XIV. Genetic Algorithms and Applications in Electronic Design [113] Goldberg, D.E.: Genetic algorithms in search, optimization and machine learning. New York: Addison-Wesley, 1989. [114] Verghese, N. K.; Allstot, D. J.: Computer-aided design considerations for mixed-signal coupling in RF integrated circuits. IEEE Journal of Solid State Circuits, vol. 33 (1998), pp. 314-323. [115] Gupta, R.; Allstot, D.J.: Parasitic-aware design and optimization in CMOS RF integrated circuits. Proceedings of the IEEE International Microwave Symposium (MTT-S’98), Baltimore/ML, pp. 1867-1870, 1998. [116] Gupta, R.; Ballweber, B.M.; Allstot, D. J.: Design and optimization of CMOS RF power amplifiers. IEEE Journal of Solid State Circuits, vol. 36 (2001), pp. 166-175. [117] Choi, K.; Allstot, D. J.; Kiaei, S.: Parasitic-aware synthesis of RF CMOS switching power amplifiers. Proceedings of the IEEE International Symposium on Circuit and System (ISCAS’2002), Leuven/Belgium, vol. I, pp. 269-272, 2002. [118] Zebulum, R. S.; Pacheco, M. C.; Vellasco, M. R.: Evolutionary electronics-automatic design of electronic circuits systems by genetic algorithms. New York: CRC Press, 2002. [119] Allstot, D. J.; Choi, K.; Park, J.: Parasitic-aware optimization of CMOS RF circuits. Boston: Kluwer Academic Publishers, February 2003 XV. Ph.D Dissertations [120] Kuhn, W. B.: Design of integrated, low power, radio receivers in BiCMOS technologies. Ph.D dissertation in Electrical Engineering, Virginia Polytechnic Institute and State University, 1995. [121] Min, J.: Analysis and design of a frequency-hopped spread-spectrum transceiver for wireless personal communications. Ph.D. dissertation in Electrical Engineering, University of California, Los Angeles, 1996. [122] Chang, J.: An integrated 900 MHz spread-spectrum wireless receiver in 1-µm CMOS and a suspended inductor technique. Ph.D dissertation in Electrical Engineering, University of California, Los Angeles, March 1998. [123] Shaeffer, D.K.: The design and implementation of low-power CMOS radio receivers. Ph.D dissertation in Electrical Engineering, Stanford University, 1998. [124] Basedau, P. M.: Analysis and design of LC and crystal oscillator. Ph.D dissertation in Electric Engineering, Swiss Federal Institute of Technology, Zurich, 1999. [125] Delaurenti, M.: Design and optimization techniques of high–speed VLSI circuits. PhD dissertation in Electrical Engineering, Politecnico di Torino, December 1999. 161 References [126] Piazza, F.: Low power RF-receiver front-end ICs for mobile communications. Ph.D dissertation in Electrical Engineering, Swiss Federal Institute of Technology, Zurich, 2000. [127] Lin, L.: Design techniques for high performance integrated frequency synthesizers for multi-standard wireless communication applications. Ph.D dissertation in Electrical Engineering, University of California, Berkeley, 2000. [128] Hitko, D. A.: Circuit design and technological limitations of silicon RFICs for wireless applications. Ph.D dissertation in Electrical Engineering, Massachusetts Institute of Technology, 2002 162 Appendix 1. Publications from the Author Appendix 1 Publications from the Author Part 1. Publications from the Author After 2001 ZHA1. Zhang, Z.S.; Christoffers, N.; Hosticka B.J.; Kaiser, T.; Kokozinski, R.; Lin, J.: A survey of oscillator phase-noise: analysis and simulation. Proceedings of the Second Joint Symposium on Opto- & Microelectronic Devices and Circuits (SODC’02), pp. 322-326, Stuttgart/Germany, March 2002. (in English) ZHA2. Zhang, Z.S.; Kolnsberg, S.; Kokozinski, R.: Design considerations for RF CMOS polyphase filter in low-cost digital SoC solution. On-line Proceedings of The sixth workshop on Analog Circuit: http://www.imtek.uni-freiburg.de/workshop2004/, Freiburg/Germany, March 2004. (in English) ZHA3. Zhang, Z.S.; Kolnsberg, S.; Kokozinski, R.: Synthesis of RF CMOS polyphase filters with layout considerations. Chinese Journal of Semiconductors, vol.25 (2004), No.12, pp. 1612-1617. (in English) Part 2. Publications from the Author Before 2001 ZHA4. Zhang, Z.S.; Lin, J.; Chen, Z.B.; Sun, M.: Design and experiments of PHV-I portable highfrequency vibrator, Instrument Technology & Sensors, vol.36 (2000), No.10, pp. 14-18. (in Chinese) ZHA5. Zhang, Z.S.; Lin, J.; Chen, Z.B.; Yu, S.B.: Development of portable high-frequency vibrator. Automation in Petroleum Industry, vol.14 (2000), No.6, pp. 14-17. (in Chinese) ZHA6. Zhang, Z.S.; Lin, J.; Chen, Z.B.; Yu, S.B.: Design and implementation of portable high frequency vibrator. Measurement & Control Technique, vol.19 (2000), No.10, pp. 10-53. (in Chinese) ZHA7. Zhang, Z.S.; Lin, J.; Chen, Z.B.; Yu, S.B.: An industrial PC-based measurement & control system in portable high-frequency vibrator. Computer Automated Measurement & Control, vol.8 (2000), No.4, pp. 10-13. (in Chinese) ZHA8. Zhang, Z.S.; Lin, J.; Jiang, H.: A novel interface between non-standard keyboard and industrial PC in portable measurement & control instruments. Measurement & Control Technique, vol.19 (2000), No.6, pp. 10-61. (in Chinese) ZHA9. Zhuang, J.; Lin, J.; Wu D. J.; Zhang, B.J.; Zhang, Z.S.: Analysis on amplitude characteristics of the coupling process between PHV and the earth. Journal of Changchun University of Science & Technology, vol.29 (1999), No.2, pp. 184-188. (in Chinese) 163 Appendix 1. Publications from the Author ZHA10. Yu, S.B.; Lin, J.; Zhang, Z.S.: The Study on the frequency characteristic of portable highfrequency vibrator. Proceedings of The Fourth International Conference on Electronic Measurement & Instruments (ICEMI’99), Harbin/China, pp. 191-195, 1999. (in English) ZHA11. Zhang, Z.S.; Lin, J.; Yu, S.B.: The optimal signal design of linear sweep in PHVS system. Petroleum Instruments, vol.12 (1998), No.3, pp. 1-5. (in Chinese) ZHA12. Zhang, Z.S.: Serial ADC DSP101/102 directly interfaced with DSP and its applications. Petroleum Instruments, vol.12 (1998), No.2, pp. 19-22. (in Chinese) ZHA13. Zhang, Z.S.; Lin, J.; Fu X.J.; Sun C.T.: An analysis on sweep signal design of vibroseis system. Petroleum Instruments, vol.11 (1997), No.6, pp. 10-14. (in Chinese) ZHA14. Zhang, Z.S.: Realizing digital programmable filter by using universal filter UAF42. Electronic Technology, vol.24 (1997), No.9, pp. 13-34. (in Chinese) 164 Appendix 2 Transfer Functions of Multi-stage RF CMOS PPFs Appendix 2 Transfer Functions of Multi-Stage RF CMOS PPFs A2.1 Explicit Transfer Function of 2-Stage RF CMOS PPFs The transfer function of the 2-stage RF CMOS PPF can be obtained by multiplying the chain matrices of each stage as follows: R1 Vin 1+jω R1C1 1 Iin = 1-ω R1C1 2jω C1 1+jω R1C1 R2 Vout 1+jω R2C2 1 . 1-ωR2C2 2jω C2 1+jω R2C2 Iout (A2.1) The open circuit ( Iout = 0) complex transfer function is: H(jω )= (1-ω R1C1)(1-ω R2C2) . 1+jω (R1C1+R2C2+2R1C2)-ω 2 (R1R2C1C2) (A2.2) Equation (A2.1) can also be expressed as: H(jω )=H1(jω )+jH2(jω ) , Where 1+ω 2 (R1R2C1C2) H1(jω )= , 1+jω (R1C1+R2C2+2R1C2)-ω 2 (R1R2C1C2) H2(jω )= jω (R1C1+R2C2) , 1+jω (R1C1+R2C2+2R1C2)-ω 2 (R1R2C1C2) (A2.3) (A2.4) (A2.5) A2.2 Explicit Transfer Function of 3-Stage RF CMOS PPFs The transfer function of the 3-stage RF CMOS PPF can be derived by multiplying the chain matrices of each stage as follows: R1 Vin 1+jω R1C1 1 Iin = 1-ω R1C1 2jω C1 1+jω R1C1 R2 1+jω R2C2 1 1-ωR2C2 2jω C2 1+jω R2C2 R3 Vout 1+jω R3C3 1 . 1-ω R3C3 2jω C3 1+jω R3C3 Iout The complex transfer function is: 165 (A2.6) Appendix 2 Transfer Functions of Multi-stage RF CMOS PPFs H(jω )= Where N(jω ) , D(jω ) N(jω )=(1-ω R1C1)(1-ω R2C2)(1-ω R3C3) , D(jω )=DR(ω )+jDI(ω ) , DR(ω )=1-ω 2 (R1R2C1C2+R1R3C1C3+R2R3C2C3 +2R1R3C2C3+2R1R2C1C3+2R1R2C2C3), DI(ω )=ω (R1C1+R2C2+R3C3+2R1C2+2R1C3 +2R2C3)-ω 3 (R1R2R3C1C2C3). (A2.7) (A2.8) (A2.9) (A2.10) (A2.11) Equation (A2.7) can also be expressed as: H(jω )=H1(jω )+jH2(jω ) Where H1(jω )= 1+ω 2 (R1R2C1C2+R1R3C1C3+R2R3C2C3) , D(jω ) jω (R1C1+R3C3+R2C2)+jω 3 (R1R2R3C1C2C3) H2(jω )= . D(jω ) 166 (A2.12) (A2.13) (A2.14) Appendix 3 Source Code of PPFANA Appendix 3 Source Code of PPFANA A3.1 Source Code for Analysis of Gain Mismatch Influenced by Process Tolerances A.3.1.1 Source Code for Analysis of Gain Mismatch Influenced by Process Tolerances in 2-stage RF CMOS PPFs global f_1; global f_2; global rt_1; global rt_2; global ct_1; global ct_2; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); ct_2=findobj(gcf,'Tag','ct_2'); ct_2=str2double(get(ct_2,'string')); pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rt_1), rt_1=223.5; else rt_1=rt_1; end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2; end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2); c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RinCin=abs(h-n); plot(w,RinCin,'g -s') c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ 167 Appendix 3 Source Code of PPFANA (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RdeCde=abs(h-n); plot(w,RdeCde,'b -*') c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RinCde=abs(h-n); plot(w,RinCde,'r -^') c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RdeCin=abs(h-n); plot(w,RdeCin,'k -d') legend('RinCin','RdeCde','RinCde','RdeCin') w=f_1.*(1-0.4):f_1./1e3:f_2.*(1+0.4); c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RinCin=abs(h-n); plot(w,RinCin,'g -') c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RdeCde=abs(h-n); plot(w,RdeCde,'b -.') % % c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); 168 Appendix 3 Source Code of PPFANA a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RinCde=abs(h-n); plot(w,RinCde,'r --') % % c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=20.*log10(a); n=20.*log10(d); RdeCin=abs(h-n); plot(w,RdeCin,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by process tolerances','FontSize', 14) A.3.1.2 Source Code for Analysis of Gain Mismatch Influenced by Process Tolerances in 3-stage RF CMOS PPFs global f_1; global f_2; global rth_1; global rth_2; global rth_3; global cth_1; global cth_2; global cth_3; global cm; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21;else pt_c=pt_c; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rth_1), rth_1=263.9; else rth_1=rth_1; end if isempty(rth_2), rth_2=293.7; else rth_2=rth_2; end if isempty(rth_3), rth_3=315.2; else rth_3=rth_3; end 169 Appendix 3 Source Code of PPFANA if isempty(cth_1), cth_1=173.8; else cth_1=cth_1; end if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^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); m=20.*log10(c); k=20.*log10(b); RinCde=abs(m-k); plot(w,RinCde,'k -d') legend('RinCin','RdeCde','RinCde','RdeCin') w=f_1.*(1-0.4):f_1./1e3:f_2.*(1+0.4); c3_3=cth_3.*(1+pt_c).*1e-15; c3_2=cth_2.*(1+pt_c).*1e-15; c3_1=cth_1.*(1+pt_c).*1e-15; r3_1=rth_1.*(1+pt_r); r3_2=rth_2.*(1+pt_r); r3_3=rth_3.*(1+pt_r); c=abs((1+(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2))./ (1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); 171 Appendix 3 Source Code of PPFANA b=abs((j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3)+(j.*2.*pi.*w).^3.*r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3 _3)./(1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c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.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); m=20.*log10(c); k=20.*log10(b); RinCde=abs(m-k); plot(w,RinCde,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by process tolerances','FontSize', 14) A.3.1.3 Source Code for Analysis of Gain Mismatch Influenced by Process Tolerances in 4-stage RF CMOS PPFs global f_1; global f_4; global rf_1; global rf_2; global rf_3; global rf_4; global cf_1; global cf_2; global cf_3; global cf_4; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_4), f_4=3.47e9; else f_4=f_4; end if isempty(rf_1), rf_1=289.9; else rf_1=rf_1; end if isempty(rf_2), rf_2=329; else rf_2=rf_2; end 173 Appendix 3 Source Code of PPFANA if isempty(rf_3), rf_3=377.4; else rf_3=rf_3; end if isempty(rf_4), rf_4=390; else rf_4=rf_4; end if isempty(cf_1), cf_1=158.2; else cf_1=cf_1; end if isempty(cf_2), cf_2=186.9; else cf_2=cf_2; end if isempty(cf_3), cf_3=218.5; else cf_3=cf_3; end if isempty(cf_4), cf_4=283.4; else cf_4=cf_4; end figure hold on w=f_4.*(1+0.1):f_4./20:f_4.*(1+0.2); c4=cf_4.*(1+pt_c).*1e-15; c3=cf_3.*(1+pt_c).*1e-15; c2=cf_2.*(1+pt_c).*1e-15; c1=cf_1.*(1+pt_c).*1e-15; r1=rf_1.*(1+pt_r); r2=rf_2.*(1+pt_r); r3=rf_3.*(1+pt_r); r4=rf_4.*(1+pt_r); d=abs((1+(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4 *c3) +(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4))./(1-(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3 +r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1*r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4 +2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2*c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4+2*r1 *r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4) +(j*(2.*pi.*w)).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+2*r1*c3+2*r2*c3+2*r2*c4+2*r1*c4)(j*(2.*pi.*w)).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r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1*c3*c4))); a=abs(((2.*pi.*w).*(r1*c1+r2*c2+r3*c3+r4*c4)+(2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c 4+r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4))./(1(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1* r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4+2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2* c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4+2*r1*r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2 .*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4)+(j.*2.*pi.*w).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+ 2*r1*c3+2*r2*c3+2*r2*c4+2*r1*c4)(j.*2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c4+r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4+2*r 1*r2*r3*c1*c2*c4+2*r1*r2*r3*c3*c2*c4+2*r1*r2*r3*c1*c3*c4+2*r1*r4*r3*c3*c2*c4 +2*r1*r2*r4*c3*c2*c4+2*r1*r2*r4*c1*c3*c4))); m=20.*log10(d); k=20.*log10(a); RinCde=abs(m-k); plot(w,RinCde,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by process tolerances','FontSize', 14) A3.2 Source Code for Analysis of Phase Mismatch Influenced by Process Tolerances A.3.2.1 Source Code for Analysis of Phase Mismatch Influenced by Process Tolerances in 2-stage RF CMOS PPFs global f_1; global f_2; global rt_1; global rt_2; global ct_1; global ct_2; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); ct_2=findobj(gcf,'Tag','ct_2'); ct_2=str2double(get(ct_2,'string')); pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end 178 Appendix 3 Source Code of PPFANA if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rt_1), rt_1=223.5; else rt_1=rt_1; end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2; end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2); c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RinCin=(h-n).*180./pi+90; plot(w,RinCin,'g -s') c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RdeCde=(h-n).*180./pi+90; plot(w,RdeCde,'b -*') c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RinCde=(h-n).*180./pi+90; plot(w,RinCde,'r -^') c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); h=atan(a); n=atan(d); RdeCin=(h-n).*180./pi+90; plot(w,RdeCin,'k -d') legend('RinCin','RdeCde','RinCde','RdeCin') w=f_1.*(1-0.4):f_1./1e3:f_2.*(1+0.4); c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RinCin=(h-n).*180./pi+90; plot(w,RinCin,'g -') 179 Appendix 3 Source Code of PPFANA c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RdeCde=(h-n).*180./pi+90; plot(w,RdeCde,'b -.') % % c2_2=ct_2.*(1-pt_c).*1e-15; c2_1=ct_1.*(1-pt_c).*1e-15; r2_1=rt_1.*(1+pt_r); r2_2=rt_2.*(1+pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RinCde=(h-n).*180./pi+90; plot(w,RinCde,'r --') % % c2_2=ct_2.*(1+pt_c).*1e-15; c2_1=ct_1.*(1+pt_c).*1e-15; r2_1=rt_1.*(1-pt_r); r2_2=rt_2.*(1-pt_r); a=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); d=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.* w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); h=atan(a); n=atan(d); RdeCin=(h-n).*180./pi+90; plot(w,RdeCin,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by process tolerances','FontSize', 14) A.3.2.2 Source Code for Analysis of Phase Mismatch Influenced by Process Tolerance in 3-stage RF CMOS PPFs global f_1; global f_2; global rth_1; global rth_2; global rth_3; global cth_1; global cth_2; global cth_3; global cm; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rth_1), rth_1=263.9; else rth_1=rth_1; end 180 Appendix 3 Source Code of PPFANA if isempty(rth_2), rth_2=293.7; else rth_2=rth_2; end if isempty(rth_3), rth_3=315.2; else rth_3=rth_3; end if isempty(cth_1), cth_1=173.8; else cth_1=cth_1; end if isempty(cth_2), cth_2=221.2; else cth_2=cth_2; end if isempty(cth_3), cth_3=350.7; else cth_3=cth_3; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2); c3_3=cth_3.*(1+pt_c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t); RinCde=(l-n).*180./pi+90; plot(w,RinCde,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by process tolerances','FontSize', 14) A.3.2.3 Source Code for Analysis of Phase Mismatch Influenced by Process Tolerance in 4-stage RF CMOS PPFs global f_1; global f_4; global rf_1; global rf_2; global rf_3; global rf_4; global cf_1; global cf_2; global cf_3; global cf_4; global cm; global pt_r; global pt_c; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); pt_r=findobj(gcf,'Tag','pt_r'); if isempty(pt_r), pt_r=0.16; else pt_c=findobj(gcf,'Tag','pt_c'); pt_r=str2double(get(pt_r,'string')); pt_r= pt_r; end pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_4), f_4=3.47e9; else f_4=f_4; end if isempty(rf_1), rf_1=289.9; else if isempty(rf_2), rf_2=329; else if isempty(rf_3), rf_3=377.4; else rf_3=rf_3; end if isempty(rf_4), rf_4=390; else if isempty(cf_1), cf_1=158.2; else cf_1=cf_1; end if isempty(cf_2), cf_2=186.9; else cf_2=cf_2; end rf_1=rf_1; end rf_2=rf_2; end rf_4=rf_4; end if isempty(cf_3), cf_3=218.5; else cf_3=cf_3; end if isempty(cf_4), cf_4=283.4; else cf_4=cf_4; end 184 Appendix 3 Source Code of PPFANA figure hold on w=f_4.*(1+0.1):f_4./20:f_4.*(1+0.2); c4=cf_4.*(1+pt_c).*1e-15; c3=cf_3.*(1+pt_c).*1e-15; c2=cf_2.*(1+pt_c).*1e-15; c1=cf_1.*(1+pt_c).*1e-15; r1=rf_1.*(1+pt_r); r2=rf_2.*(1+pt_r); r3=rf_3.*(1+pt_r); r4=rf_4.*(1+pt_r); c=abs((1+(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4 *c3) +(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4))./(1-(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3 +r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1*r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4 +2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2*c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4 +2*r1*r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c 3*c4)+(j*(2.*pi.*w)).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+2*r1*c3+2*r2*c3+2*r2*c4+2*r1* c4)(j*(2.*pi.*w)).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c4+r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4. +2*r1*r2*r3*c1*c2*c4+2*r1*r2*r3*c3*c2*c4+2*r1*r2*r3*c1*c3*c4+2*r1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c3*c4+r3*r2*r4*c3*c2*c4))./(1-(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3 +r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1*r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4 +2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2*c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4+2*r1 *r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4) +(j.*2.*pi.*w).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+2*r1*c3+2*r2*c3+2*r2*c4+2*r1*c4) (j.*2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c4+r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4+2*r 1*r2*r3*c1*c2*c4+2*r1*r2*r3*c3*c2*c4+2*r1*r2*r3*c1*c3*c4+2*r1*r4*r3*c3*c2*c4 +2*r1*r2*r4*c3*c2*c4+2*r1*r2*r4*c1*c3*c4))); h=atan(c); n=atan(b); RinCde=(n-h).*180./pi+90; plot(w,RinCde,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by process tolerances','FontSize', 14) A3.3 Source Code for Analysis of Gain Mismatch Influenced by Component Mismatch A.3.3.1 Source Code for Analysis of Gain Mismatch Influenced by Component Mismatch in 2-stage RF CMOS PPFs global f_1; global f_2; global rt_1; global rt_2; global ct_1; global ct_2; global cm; global pt; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); ct_2=findobj(gcf,'Tag','ct_2'); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01;else ct_2=str2double(get(ct_2,'string')); cm=str2double(get(cm,'string')); cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1;end if isempty(f_2), f_2=f_2;end f_2=3.47e9; else if isempty(rt_1), rt_1=223.5; else rt_1=rt_1;end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2;end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2); c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; 189 Appendix 3 Source Code of PPFANA r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RinCin=abs(m-k); plot(w,RinCin,'g -s') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RdeCde=abs(m-k); plot(w,RdeCde,'b -*') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1+cm);r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RinCde=abs(m-k); plot(w,RinCde,'r - ^') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RdeCin=abs(m-k); plot(w,RdeCin,'k -d') legend('RinCin','RdeCde','RinCde','RdeCin') w=f_1.*(1-0.2):f_1./1e3:f_2.*(1+0.2); c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RinCin=abs(m-k); plot(w,RinCin,'g -') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RdeCde=abs(m-k); plot(w,RdeCde,'b -.') % % c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; 190 Appendix 3 Source Code of PPFANA b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b);k=20.*log10(c); RinCde=abs(m-k); plot(w,RinCde,'r --')% % c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w )*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); m=20.*log10(b); k=20.*log10(c); RdeCin=abs(m-k); plot(w,RdeCin,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by component mismatch','FontSize', 14) A.3.3.2 Source Code for Analysis of Gain Mismatch Influenced by Component Mismatch in 3-stage RF CMOS PPFs global f_1; global f_2; global rth_1; global rth_2; global rth_3; global cth_1; global cth_2; global cth_3; global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01; else cm=str2double(get(cm,'string')); cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rth_1), rth_1=263.9; else rth_1=rth_1; end if isempty(rth_2), rth_2=293.7; else rth_2=rth_2; end if isempty(rth_3), rth_3=315.2; else rth_3=rth_3; end if isempty(cth_1), cth_1=173.8; else cth_1=cth_1; end if isempty(cth_2), cth_2=221.2; else cth_2=cth_2; end if isempty(cth_3), cth_3=350.7; else cth_3=cth_3; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2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.*c3_3)); c3_3=cth_3.*(1+cm).*1e-15; c3_2=cth_2.*(1+cm).*1e-15; c3_1=cth_1.*(1+cm).*1e-15; r3_1=rth_1.*(1-cm); r3_2=rth_2.*(1-cm); r3_3=rth_3.*(1-cm); b=abs((j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3)+(j.*2.*pi.*w).^3.*r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3 _3)./(1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); m=20.*log10(c); k=20.*log10(b); RdeCin=abs(m-k); plot(w,RdeCin,'k :') % xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by component mismatch','FontSize', 14) A.3.3.3 Source Code for Analysis of Gain Mismatch Influenced by Component Mismatch in 4-stage RF CMOS PPFs global f_1; global f_4; global rf_1; global rf_2; global rf_3; global rf_4; global cf_1; global cf_2; global cf_3; global cf_4; global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_4), f_4=3.47e9; else f_4=f_4; end if isempty(rf_1), rf_1=289.9; else if isempty(rf_2), rf_2=329; else if isempty(rf_3), rf_1=rf_1; end rf_2=rf_2; end rf_3=377.4; else rf_3=rf_3; end 195 Appendix 3 Source Code of PPFANA if isempty(rf_4), rf_4=390; else rf_4=rf_4; end if isempty(cf_1), cf_1=158.2; else cf_1=cf_1; end if isempty(cf_2), cf_2=186.9; else cf_2=cf_2; end if isempty(cf_3), cf_3=218.5; else cf_3=cf_3; end if isempty(cf_4), cf_4=283.4; else cf_4=cf_4; end figure hold on w=f_4.*(1+0.1):f_4./20:f_4.*(1+0.2); c4=cf_4.*1e-15; c3=cf_3.*1e-15; c2=cf_2.*1e-15; c1=cf_1.*1e-15; r1=rf_1; r2=rf_2; r3=rf_3; r4=rf_4; a=abs((1+(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4 *c3) +(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4))./(1-(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3 +r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1*r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4 +2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r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r4*c1*c3*c4+r3*r2*r4*c3*c2*c4))/(1(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1* r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4+2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2* c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4+2*r1*r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2 .*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4)+(j.*2.*pi.*w).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+ 2*r1*c3+2*r2*c3+2*r2*c4+2*r1*c4)j.*2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c4+r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4+2*r 1*r2*r3*c1*c2*c4+2*r1*r2*r3*c3*c2*c4+2*r1*r2*r3*c1*c3*c4+2*r1*r4*r3*c3*c2*c4 +2*r1*r2*r4*c3*c2*c4+2*r1*r2*r4*c1*c3*c4))); l=20.*log10(a); m=20.*log10(d); RdeCin=abs(l-m); plot(w,RdeCin,'k :')% xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title('Gain mismatch influenced by component mismatch','FontSize', 14) A3.4 Source Code for Analysis of Phase Mismatch Influenced by Component Mismatch A.3.4.1 Source Code for Analysis of Phase Mismatch Influenced by Component Mismatch in 2-stage RF CMOS PPFs global f_1; global f_2; global rt_1; global rt_2; global ct_1; global ct_2; global cm; global pt; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string'));%get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); 200 Appendix 3 Source Code of PPFANA ct_2=findobj(gcf,'Tag','ct_2'); ct_2=str2double(get(ct_2,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01;else cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rt_1), rt_1=223.5; else rt_1=rt_1; end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2; end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end figure hold on w=f_2.*(1+0.1):f_2./20:f_2.*(1+0.2); c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1;r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./(1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi. *w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1*c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RinCin=(m-k).*180./pi+90; plot(w,RinCin,'g -s') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RdeCde=(m-k).*180./pi+90; plot(w,RdeCde,'b -*') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RinCde=(m-k).*180./pi+90; plot(w,RinCde,'r -^') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); 201 Appendix 3 Source Code of PPFANA c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RdeCin=(m-k).*180./pi+90; plot(w,RdeCin,'k -d') legend('RinCin','RdeCde','RinCde','RdeCin') w=f_1.*(1-0.2):f_1./1e3:f_2.*(1+0.2); c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1+cm).*1e-15; c2_1=ct_1.*(1+cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RinCin=(m-k).*180./pi+90; plot(w,RinCin,'g -') c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RdeCde=(m-k).*180./pi+90; plot(w,RdeCde,'b -.') % % c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1-cm).*1e-15; c2_1=ct_1.*(1-cm).*1e-15; r2_1=rt_1.*(1+cm); r2_2=rt_2.*(1+cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RinCde=(m-k).*180./pi+90; plot(w,RinCde,'r --') % % c2_2=ct_2.*1e-15; c2_1=ct_1.*1e-15; r2_1=rt_1; r2_2=rt_2; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*(1+cm).*1e-15;c2_1=ct_1.*(1+cm).*1e-15;r2_1=rt_1.*(1-cm); r2_2=rt_2.*(1-cm); c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ 202 Appendix 3 Source Code of PPFANA (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); RdeCin=(m-k).*180./pi+90; plot(w,RdeCin,'k :') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by component mismatch','FontSize', 14) A.3.4.2 Source Code for Analysis of Phase Mismatch Influenced by Component Mismatch in 3-stage RF CMOS PPFs global f_1; global f_2; global rth_1; global rth_2; global rth_3; global cth_1; global cth_2; global cth_3; global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01; else cm=str2double(get(cm,'string')); cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rth_1), rth_1=263.9; else rth_1=rth_1; end if isempty(rth_2), rth_2=293.7; else rth_2=rth_2; end if isempty(rth_3), rth_3=315.2; else rth_3=rth_3; end if isempty(cth_1), cth_1=173.8; else cth_1=cth_1; end if isempty(cth_2), cth_2=221.2; else cth_2=cth_2; end if isempty(cth_3), c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i.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); 206 Appendix 3 Source Code of PPFANA c3_3=cth_3.*(1+cm).*1e-15; c3_2=cth_2.*(1+cm).*1e-15; c3_1=cth_1.*(1+cm).*1e-15; r3_1=rth_1.*(1-cm); r3_2=rth_2.*(1-cm); r3_3=rth_3.*(1-cm); t=abs((j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3)+(j.*2.*pi.*w).^3.*r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3 _3)./(1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); l=atan(h); n=atan(t); RdeCin=(l-n).*180./pi+90; plot(w,RdeCin,'k :') % xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by component mismatch','FontSize', 14) A.3.4.3 Source Code for Analysis of Phase Mismatch Influenced by Component Mismatch in 4-stage RF CMOS PPFs global f_1;global f_4;global rf_1;global rf_2;global rf_3;global rf_4; global cf_1;global cf_2; global cf_3;global cf_4;global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_4), f_4=3.47e9; else f_4=f_4; end if isempty(rf_1), rf_1=289.9; else if isempty(rf_2), rf_2=329; else if isempty(rf_3), rf_3=377.4; else if isempty(rf_4), rf_4=390; else if isempty(cf_1), cf_1=158.2; else cf_1=cf_1; end if isempty(cf_2), cf_2=186.9; else cf_2=cf_2; end if isempty(cf_3), cf_3=218.5; else cf_3=cf_3; end if isempty(cf_4), cf_4=283.4; else cf_4=cf_4; end rf_1=rf_1; end rf_2=rf_2; end rf_3=rf_3; end rf_4=rf_4; end figure hold on 207 Appendix 3 Source Code of PPFANA w=f_4.*(1+0.1):f_4./20:f_4.*(1+0.2); c4=cf_4.*1e-15; c3=cf_3.*1e-15; c2=cf_2.*1e-15; c1=cf_1.*1e-15; r1=rf_1; r2=rf_2; r3=rf_3; r4=rf_4; c=abs((1+(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4 *c3) +(2.*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4))./(1-(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3 +r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1*r3*c1*c4+2*r2*r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+r3*c3+r4*c4)+(2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c 4 +r1*r3*r4*c1*c3*c4+r3*r2*r4*c3*c2*c4))./(1(2.*pi.*w).^2.*(r1*r2*c1*c2+r1*r3*c1*c3+r2*r3*c2*c3+r1*r4*c1*c4+r2*r4*c2*c4+r4*r3*c4*c3+2*r1* r3*c1*c4+2*r2*r3*c2*c4+2*r1*r2*c2*c4+2*r1*r2*c1*c4+2*r1*r3*c3*c4+2*r2*r3*c3*c4+2*r1*r3*c2* c3+2*r1*r2*c2*c3+2*r1*r4*c2*c4+2*r1*r4*c3*c4+2*r2*r4*c3*c4+2*r1*r2*c1*c3+4*r1*r3*c2*c4)+(2 .*pi.*w).^4.*(r1*r2*r3*r4*c1*c2*c3*c4)+(j.*2.*pi.*w).*(r1*c1+r2*c2+r3*c3+r4*c4+2*r3*c4+2*r1*c2+ 2*r1*c3+2*r2*c3+2*r2*c4+2*r1*c4)(j.*2.*pi.*w).^3.*(r1*r2*r3*c1*c2*c3+r1*r2*r4*c1*c2*c4+r1*r3*r 4*c1*c3*c4+r3*r2*r4*c3*c2*c4+2*r1*r2*r3*c1*c2*c4+2*r1*r2*r3*c3*c2*c4+2*r1*r2*r3*c1*c3*c4+2 *r1*r4*r3*c3*c2*c4 +2*r1*r2*r4*c3*c2*c4+2*r1*r2*r4*c1*c3*c4))); h=atan(c);n=atan(b);RdeCin=(n-h).*180./pi+90;plot(w,RdeCin,'k :')% xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase difference influenced by component mismatch','FontSize', 14) A3.5 Source Code for Analysis of Gain Mismatch in the Worst-Case Simulation A.3.5.1 Source Code for Analysis of Gain Mismatch in the Worst-Case Simulation of 2-stage RF CMOS PPFs global f_1;global f_2;global rt_1;global rt_2;global ct_1;global ct_2;global cm; global pt; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string'));%get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); ct_2=findobj(gcf,'Tag','ct_2'); ct_2=str2double(get(ct_2,'string')); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01;else cm=str2double(get(cm,'string')); cm=cm; end if isempty(f_1), f_1=1.44e9; else if isempty(f_2), f_2=3.47e9; else f_1=f_1; end f_2=f_2; end 212 Appendix 3 Source Code of PPFANA if isempty(rt_1), rt_1=223.5; else rt_1=rt_1; end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2; end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function electFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana2stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables b_1=f_1; b_2=f_2; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana2stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; fmax=x; f=f_1+(f_2-f_1)./2; ptt=fmax./f; pt_two=1-sqrt(1./ptt); figure w=f_1.*(1-0.3):f_1./1e3:f_2.*(1+0.3); c2_2=ct_2.*1e-15+ct_2.*1e-5.*pt_two; c2_1=ct_1.*1e-15+ct_1.*1e-15.*pt_two; r2_1=rt_1+rt_1.*pt_two; r2_2=rt_2+rt_2.*pt_two; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*1e-15+ct_2.*1e-15.*(1+cm).*pt_two; c2_1=ct_1.*1e-15+ct_1.*1e-15.*(1+cm).*pt_two; r2_1=rt_1+rt_1.*(1+cm).*pt_two; r2_2=rt_2+rt_2.*(1+cm).*pt_two; c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=20.*log10(b); k=20.*log10(c); wcga=abs(m-k); plot(w,wcga,'b -') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case gain mismatch of 2-stage RF CMOS PPFs','FontSize', 14) A.3.5.2 Source Code for Analysis of Gain Mismatch in the Worst-Case Simulation of 3-stage RF CMOS PPFs global f_1; global f_2; global rth_1; global rth_2; global rth_3; global cth_1; global cth_2; global cth_3; global cm; 213 Appendix 3 Source Code of PPFANA f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rth_1), rth_1=263.9; else rth_1=rth_1; end if isempty(rth_2), rth_2=293.7; else rth_2=rth_2; end if isempty(rth_3), rth_3=315.2; else rth_3=rth_3; end if isempty(cth_1), cth_1=173.8; else cth_1=cth_1; end if isempty(cth_2), cth_2=221.2; else cth_2=cth_2; end if isempty(cth_3), cth_3=350.7; else cth_3=cth_3; end cm=cm; end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana3stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables % b_1=f_1./(1-2.*pt); % b_2=f_2./(1+2.*pt); b_1=f_1; b_2=f_2; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana3stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found x;% endPop is the ending population%endPop; % trace is a trace of the best value and average value of generations trace; % Lets increase the population size by running the defaults rand('seed',0); ermOps=[100]; x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; max=x; f=f_1+(f_2-f_1)./2;ptt=fmax./f; pt_three=1-sqrt(1./ptt);figure w=f_1.*(1-0.3):f_1./1e3:f_2.*(1+0.3);c3_3=cth_3.*(1+pt_three).*1e-15; c3_2=cth_2.*(1+pt_three).*1e-15;c3_1=cth_1.*(1+pt_three).*1e-15; 214 Appendix 3 Source Code of PPFANA r3_1=rth_1.*(1+pt_three);r3_2=rth_2.*(1+pt_three);r3_3=rth_3.*(1+pt_three); c=abs((1+(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2))./ (1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); c3_3=cth_3.*(1+pt_three).*(1+cm).*1e-15;c3_2=cth_2.*(1+pt_three).*(1+cm).*1e-15; c3_1=cth_1.*(1+pt_three).*(1+cm).*1e-15;r3_1=rth_1.*(1+pt_three).*(1+cm); r3_2=rth_2.*(1+pt_three).*(1+cm);r3_3=rth_3.*(1+pt_three).*(1+cm); b=abs((j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3)+(j.*2.*pi.*w).^3.*r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3 _3)./(1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); m=20.*log10(c); k=20.*log10(b); wcga3=abs(m-k); plot(w,wcga3,'r-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case gain mismatch of 3-stage RF CMOS PPFs','FontSize', 14) A.3.5.3 Source Code for Analysis of Gain Mismatch in the Worst-Case Simulation of 4-stage RF CMOS PPFs global f_1;global f_4;global rf_1;global rf_2;global rf_3;global rf_4; global cf_1;global cf_2;global cf_3;global cf_4;global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_4), f_4=3.47e9; else f_4=f_4; end if isempty(rf_1), rf_1=289.9; else rf_1=rf_1; end 215 Appendix 3 Source Code of PPFANA if isempty(rf_2), rf_2=329; else rf_2=rf_2; end if isempty(rf_3), rf_3=377.4; else if isempty(rf_4), rf_4=390; else if isempty(cf_1), cf_1=158.2; else cf_1=cf_1; end if isempty(cf_2), cf_2=186.9; else cf_2=cf_2; end if isempty(cf_3), cf_3=218.5; else cf_3=cf_3; end if isempty(cf_4), cf_4=283.4; else cf_4=cf_4; end rf_3=rf_3; end rf_4=rf_4; end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana4stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables % b_1=f_1./(1-2.*pt); % b_2=f_2./(1+2.*pt); b_1=f_1; b_2=f_4; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana4stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; fmax=x; f=f_1+(f_4-f_1)./2; ptt=fmax./f; pt_four=1-sqrt(1./ptt); w=f_1.*(1-0.3):f_1./1e3:f_4.*(1+0.3); c1=cf_1.*1e-15; c2=cf_2.*1e-15; c3=cf_3.*1e-15; c4=cf_4.*1e-15; dr_1=pt_four.*rf_1; dr_2=pt_four.*rf_2; dr_3=pt_four.*rf_3; dr_4=pt_four.*rf_4; dc_1=pt_four.*c1; dc_2=pt_four.*c2; dc_3=pt_four.*c3; dc_4=pt_four.*c4; dr_11=cm*rf_1; dr_22=cm*rf_2; dr_33=cm*rf_3; dr_44=cm*rf_4; dc_11=cm*c1; dc_22=cm*c2; dc_33=cm*c3; dc_44=cm*c4; r1=rf_1+dr_1+dr_11; r2=rf_2+dr_2+dr_22; r3=rf_3+dr_3+dr_33; r4=rf_4+dr_4+dr_44; c41=c1+dc_1+dc_11; c42=c2+dc_2+dc_22; c43=c3+dc_3+dc_33; c44=c4+dc_4+dc_44; d=F_amplitudew_in(w,r1,c41,r2,c42,r3,c43,r4,c44); n=20*log10(d); r1=rf_1+dr_1+dr_11; r2=rf_2+dr_2+dr_22; r3=rf_3+dr_3+dr_33; r4=rf_4+dr_4+dr_44; c41=c1+dc_1+dc_11; c42=c2+dc_2+dc_22; c43=c3+dc_3+dc_33; c44=c4+dc_4+dc_44; b=F_amplitudew_qu(w,r1,c41,r2,c42,r3,c43,r4,c44); m=20*log10(b); gmis=abs(m-n); figure plot(w,gmis,'m-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case gain mismatch of 4-stage RF CMOS PPFs','FontSize', 14) 216 Appendix 3 Source Code of PPFANA A3.6 Source Code for Analysis of Phase Mismatch in the Worst-Case Simulation A.3.6.1 Source Code for Analysis of Phase Mismatch in the Worst-Case simulation of 2-stage RF CMOS PPFs global f_1; global f_2; global rt_1; global rt_2; global ct_1; global ct_2;global cm; global pt; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rt_1=findobj(gcf,'Tag','rt_1'); rt_1=str2double(get(rt_1,'string')); rt_2=findobj(gcf,'Tag','rt_2'); rt_2=str2double(get(rt_2,'string')); ct_1=findobj(gcf,'Tag','ct_1'); ct_1=str2double(get(ct_1,'string')); ct_2=findobj(gcf,'Tag','ct_2'); ct_2=str2double(get(ct_2,'string')); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01; else cm=str2double(get(cm,'string')); cm=cm; end if isempty(f_1), f_1=1.44e9; else f_1=f_1; end if isempty(f_2), f_2=3.47e9; else f_2=f_2; end if isempty(rt_1), rt_1=223.5; else rt_1=rt_1; end if isempty(rt_2), rt_2=265.6; else rt_2=rt_2; end if isempty(ct_1), ct_1=205.2; else ct_1=ct_1; end if isempty(ct_2), ct_2=416.7; else ct_2=ct_2; end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana2stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables b_1=f_1; b_2=f_2; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana2stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults 217 Appendix 3 Source Code of PPFANA rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; fmax=x; f=f_1+(f_2-f_1)./2; ptt=fmax./f; pt_two=1-sqrt(1./ptt); figure w=f_1.*(1-0.3):f_1./1e3:f_2.*(1+0.3); c2_2=ct_2.*1e-15+ct_2.*1e-15.*pt_two;c2_1=ct_1.*1e-15+ct_1.*1e-15.*pt_two; r2_1=rt_1+rt_1.*pt_two;r2_2=rt_2+rt_2.*pt_two; b=abs(((1+(2.*pi.*w).^2.*r2_1*r2_2*c2_1*c2_2)./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); c2_2=ct_2.*1e-15+ct_2.*1e-15.*(1+cm).*pt_two; c2_1=ct_1.*1e-15+ct_1.*1e-15.*(1+cm).*pt_two; r2_1=rt_1+rt_1.*(1+cm).*pt_two; r2_2=rt_2+rt_2.*(1+cm).*pt_two; c=abs(((j*(2.*pi.*w).*(r2_1*c2_1+r2_2*c2_2))./ (1+j*(2.*pi.*w)*(r2_1*c2_1+r2_2*c2_2)+2*j*(2.*pi.*w)*r2_1*c2_2+(j*(2.*pi.*w)).^2*r2_1*r2_2*c2_1 *c2_2))); m=atan(b); k=atan(c); wcga=(m-k).*180./pi+90; plot(w,wcga,'r -') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case phase mismatch of 2-stage RF CMOS PPFs','FontSize', 14) A.3.6.2 Source Code for Analysis of Phase Mismatch in the Worst- Case simulation of 2-stage RF CMOS PPFs global f_1;global f_2;global rth_1;global rth_2;global rth_3; global cth_1;global cth_2;global cth_3;global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string'));%get the value from GUI input f_2=findobj(gcf,'Tag','f_2'); f_2=str2double(get(f_2,'string')); rth_1=findobj(gcf,'Tag','rth_1'); rth_1=str2double(get(rth_1,'string')); rth_2=findobj(gcf,'Tag','rth_2'); rth_2=str2double(get(rth_2,'string')); rth_3=findobj(gcf,'Tag','rth_3'); rth_3=str2double(get(rth_3,'string')); cth_1=findobj(gcf,'Tag','cth_1'); cth_1=str2double(get(cth_1,'string')); cth_2=findobj(gcf,'Tag','cth_2'); cth_2=str2double(get(cth_2,'string')); cth_3=findobj(gcf,'Tag','cth_3'); cth_3=str2double(get(cth_3,'string')); cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=0.01;else cm=str2double(get(cm,'string')); cm=cm;end if isempty(f_1), f_1=1.44e9;else f_1=f_1;end if isempty(f_2), f_2=3.47e9;else f_2=f_2;end if isempty(rth_1), rth_1=263.9;else rth_1=rth_1;end if isempty(rth_2), rth_2=293.7;else rth_2=rth_2;end if isempty(rth_3), rth_3=315.2;else rth_3=rth_3;end if isempty(cth_1), cth_1=173.8;else cth_1=cth_1;end 218 Appendix 3 Source Code of PPFANA if isempty(cth_2), cth_2=221.2;else cth_2=cth_2;end if isempty(cth_3), cth_3=350.7;else cth_3=cth_3;end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana3stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables % b_1=f_1./(1-2.*pt); % b_2=f_2./(1+2.*pt); b_1=f_1; b_2=f_2; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana3stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found%x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; fmax=x; f=f_1+(f_2-f_1)./2; ptt=fmax./f; pt_three=1-sqrt(1./ptt); figure w=f_1.*(1-0.3):f_1./1e3:f_2.*(1+0.3); c3_3=cth_3.*(1+pt_three).*1e-15; c3_2=cth_2.*(1+pt_three).*1e-15; c3_1=cth_1.*(1+pt_three).*1e-15; r3_1=rth_1.*(1+pt_three); r3_2=rth_2.*(1+pt_three); r3_3=rth_3.*(1+pt_three); c=abs((1+(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2))./ (1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); c3_3=cth_3.*(1+pt_three).*(1+cm).*1e-15; c3_2=cth_2.*(1+pt_three).*(1+cm).*1e-15; c3_1=cth_1.*(1+pt_three).*(1+cm).*1e-15;r3_1=rth_1.*(1+pt_three).*(1+cm); r3_2=rth_2.*(1+pt_three).*(1+cm);r3_3=rth_3.*(1+pt_three).*(1+cm); b=abs((j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3)+(j.*2.*pi.*w).^3.*r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3 _3)./(1+j.*2.*pi.*w.*(r3_1.*c3_1+r3_2.*c3_2+r3_3.*c3_3) 219 Appendix 3 Source Code of PPFANA +2.*j.*2.*pi.*w.*(r3_1.*c3_2+r3_1.*c3_3+r3_2.*c3_3)(2.*pi.*w).^2.*(r3_1.*r3_2.*c3_1.*c3_2+r3_1.*r3_3.*c3_1.*c3_3+r3_3.*r3_2.*c3_3.*c3_2 +2.*r3_1.*r3_3.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_3.*c3_2+2.*r3_1.*r3_2.*c3_1.*c3_3)+(j.*2.*pi.*w).^3. *r3_1.*r3_2.*r3_3.*c3_1.*c3_2.*c3_3)); m=atan(c); k=atan(b); wcph3=(m-k).*180./pi+90; plot(w,wcph3,'b-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case phase mismatch of 3-stage RF CMOS PPFs','FontSize', 14) A.3.6.3 Source Code for Analysis of Phase Mismatch in the Worst-Case simulation of 4-stage RF CMOS PPFs global f_1;global f_4;global rf_1;global rf_2;global rf_3; global rf_4; global cf_1;global cf_2;global cf_3;global cf_4;global cm; f_1=findobj(gcf,'Tag','f_1'); f_1=str2double(get(f_1,'string')); %get the value from GUI input f_4=findobj(gcf,'Tag','f_4'); f_4=str2double(get(f_4,'string')); rf_1=findobj(gcf,'Tag','rf_1'); rf_1=str2double(get(rf_1,'string')); rf_2=findobj(gcf,'Tag','rf_2'); rf_2=str2double(get(rf_2,'string')); rf_3=findobj(gcf,'Tag','rf_3'); rf_3=str2double(get(rf_3,'string')); rf_4=findobj(gcf,'Tag','rf_4'); rf_4=str2double(get(rf_4,'string')); cf_1=findobj(gcf,'Tag','cf_1'); cf_1=str2double(get(cf_1,'string')); cf_2=findobj(gcf,'Tag','cf_2'); cf_2=str2double(get(cf_2,'string')); cf_3=findobj(gcf,'Tag','cf_3'); cf_3=str2double(get(cf_3,'string')); cf_4=findobj(gcf,'Tag','cf_4'); cf_4=str2double(get(cf_4,'string')); cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end if isempty(f_1), f_1=1.44e9;else f_1=f_1;end if isempty(f_4), f_4=3.47e9;else f_4=f_4;end if isempty(rf_1), rf_1=289.9;else if isempty(rf_2), rf_2=329;else if isempty(rf_3), rf_3=377.4;else if isempty(rf_4), rf_4=390; if isempty(cf_1), cf_1=158.2;else if isempty(cf_2), cf_2=186.9;else cf_2=cf_2;end if isempty(cf_3), cf_3=218.5;else cf_3=cf_3;end if isempty(cf_4), cf_4=283.4;else cf_4=cf_4;end rf_1=rf_1;end rf_2=rf_2;end rf_3=rf_3;end rf_4=rf_4;end cf_1=cf_1;end h = waitbar(0,'Simulation is processing, please wait'); for x=1:100, waitbar(x/100,h), end close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover';xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations 220 Appendix 3 Source Code of PPFANA % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'ppfana4stage'; evalOps = []; %type gaMichEval3stage; % Bounds on the variables % b_1=f_1./(1-2.*pt); % b_2=f_2./(1+2.*pt); b_1=f_1; b_2=f_4; bounds = [b_1 b_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'ppfana4stage',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts, termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps, selectFn,selectOps); % x is the best solution found x; fmax=x; f=f_1+(f_4-f_1)./2; ptt=fmax./f; pt_four=1-sqrt(1./ptt); figure w=f_1.*(1-0.3):f_1./1e3:f_4.*(1+0.3); c1=cf_1.*1e-15; c2=cf_2.*1e-15; c3=cf_3.*1e-15; c4=cf_4.*1e-15; dr_1=pt_four.*rf_1; dr_2=pt_four.*rf_2; dr_3=pt_four.*rf_3; dr_4=pt_four.*rf_4; dc_1=pt_four.*c1; dc_2=pt_four.*c2; dc_3=pt_four.*c3; dc_4=pt_four.*c4; dr_11=cm*rf_1; dr_22=cm*rf_2; dr_33=cm*rf_3; dr_44=cm*rf_4; dc_11=cm*c1; dc_22=cm*c2; dc_33=cm*c3; dc_44=cm*c4; r1=rf_1+dr_1+dr_11; r2=rf_2+dr_2+dr_22; r3=rf_3+dr_3+dr_33; r4=rf_4+dr_4+dr_44; c41=c1+dc_1+dc_11; c42=c2+dc_2+dc_22; c43=c3+dc_3+dc_33; c44=c4+dc_4+dc_44; a=F_phasew_in(w,r1,c41,r2,c42,r3,c43,r4,c44); r1=rf_1+dr_1+dr_11; r2=rf_2+dr_2+dr_22; r3=rf_3+dr_3+dr_33; r4=rf_4+dr_4+dr_44; c41=c1+dc_1+dc_11; c42=c2+dc_2+dc_22; c43=c3+dc_3+dc_33; c44=c4+dc_4+dc_44; d=F_phasew_qu(w,r1,c41,r2,c42,r3,c43,r4,c44); wcph4=d-a+90; plot(w,wcph4,'r-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\itgain} / dB','FontSize', 14) title(' Worst case phase mismatch of 4-stage RF CMOS PPFs','FontSize', 14) 221 Appendix 4 Source Code of PPFOPTIMA Appendix 4 Source Code of PPFOPTIMA A4.1 Source Code for an Implementation of Genetic Algorithm function [x,endPop,bPop,traceInfo] = ga(bounds,evalFN,evalOps,startPop,opts,... termFN, termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps) % GA runs a genetic algorithm % Output Arguments: % x - the best solution found during the course of the run % endPop - the final population % Input Arguments: % bounds - a matrix of upper and lower ounds on the variables % evalFN - the fitness function % evalOps - options to pass to the evaluation function ([NULL]) % startPop - a matrix of solutions that can be initialized % from initialize.m % termFN - name of the .m termination function (['maxGenTerm']) % termOps - options string to be passed to the termination function % selectFN - name of the .m selection function % selectOpts - roulette selection % xOverFNS – simpleXover % xOverOps - A matrix of options to pass to Xover.m files with the % first column being the number of that xOver to perform % similiarly for mutation % mutFNs – binaryMutation % mutOps - A matrix of options to pass to Xover.m files with the % first column being the number of that xOver to perform % similiarly for mutation n=nargin; if n<2 n==6 n==10 n==12 disp('Insufficient arguements') end if n<3 %Default evalation opts. evalOps=[]; end if n<5 opts = [1e-6 1 0]; end if isempty(opts) opts = [1e-6 1 0]; end if any(evalFN<48) %Not using a .m file e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',... evalFN ';']; else %Are using a .m file e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' evalFN ... '(x,[gen evalOps]); ndPop(j,:)=[f2b(x,bounds,bits) v];']; end if n<6 %Default termination information termOps=[100]; termFN='maxGenTerm'; end if n<12 %Default muatation information mutFNs=['binaryMutation']; mutOps=[0.05]; end if n<10 %Default crossover information xOverFNs=['simpleXover']; xOverOps=[0.6]; end if n<9 %Default select opts only i.e. roullete wheel. selectFN=['roulette']; selectOps=[]; end if n<6 %Default termination information termOps=[100]; termFN='maxGenTerm'; end if n<4 %No starting population passed given startPop=[]; end if isempty(startPop) %Generate a population at random %startPop=zeros(80,size(bounds,1)+1); startPop=initializega(80,bounds,evalFN,evalOps,opts(1:2)); end if opts(2)==0 %binary bits=calcbits(bounds,opts(1)); end xOverFNs=parse(xOverFNs); mutFNs=parse(mutFNs); xZomeLength = size(startPop,2); %Length of the xzome=numVars+fitness numVar = xZomeLength-1; %Number of variables popSize = size(startPop,1); %Number of individuals in the pop endPop = zeros(popSize,xZomeLength); %A secondary population atrix c1 = zeros(1,xZomeLength); %An individual c2 = zeros(1,xZomeLength); %An individual numXOvers = size(xOverFNs,1); %Number of Crossover operators numMuts = size(mutFNs,1); %Number of Mutation operators epsilon = opts(1); %Threshold for two fittness to differ oval = 222 Appendix 4 Source Code of PPFOPTIMA max(startPop(:,xZomeLength)); %Best value in start pop FoundIn = 1; %Number of times best has changed done = 0; %Done with simulated evolution gen = 1; %Current Generation Number collectTrace = (nargout>3); %Should we collect info every gen floatGA = opts(2)==1; %Probabilistic application of ops display = opts(3); %Display progress while(~done) %Elitist Model [bval,bindx] = max(startPop(:,xZomeLength)); %Best of current pop best = startPop(bindx,:); if ( (abs(bval oval)>epsilon) (gen==1)) %If we have a new best sol if display fprintf(1,'\n%d %f\n',gen,bval); %Update the display end bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)... startPop(bindx,xZomeLength)]; bFoundIn=bFoundIn+1; %Update number of changes oval=bval; %Update the best val else if display fprintf(1,'%d ',gen); %Otherwise just update num gen end end endPop = feval(selectFN,startPop,[gen selectOps]); %Select for i=1:numMuts, for j=1:mutOps(i,1), a = round(rand*(popSize-1)+1); c1 = feval(deblank(mutFNs(i,:)),endPop(a,:),bounds,[gen mutOps(i,:)]); if c1(1:numVar)==endPop(a,(1:numVar)) c1(xZomeLength)=endPop(a,xZomeLength); else %[c1(xZomeLength) c1] = feval(evalFN,c1,[gen evalOps]); eval(e1str); end endPop(a,:)=c1; end end else %We are running a probabilistic model of genetic operators for i=1:numXOvers, xN=deblank(xOverFNs(i,:)); %Get the name of crossover function cp=find(rand(popSize,1)<xOverOps(i,1)==1); if rem(size(cp,1),2) cp=cp(1:(size(cp,1)-1)); end cp=reshape(cp,size(cp,1)/2,2); for j=1:size(cp,1) a=cp(j,1); b=cp(j,2); [endPop(a,:) endPop(b,:)] = feval(xN,endPop(a,:),endPop(b,:),... bounds,[gen xOverOps(i,:)]); end end for i=1:numMuts mN=deblank(mutFNs(i,:)); for j=1:popSize endPop(j,:) = eval(mN,endPop(j,:),bounds,[gen mutOps(i,:)]); eval(e1str); end end end gen=gen+1; done=feval(termFN,[gen termOps],bPop,endPop); %See if the ga is done startPop=endPop; %Swap the populations [bval,bindx] = min(startPop(:,xZomeLength)); %Keep the best solution startPop(bindx,:) = best; %replace it with the worst end [bval,bindx] = max(startPop(:,xZomeLength)); if display fprintf(1,'\n%d %f\n',gen,bval); end x=startPop(bindx,:); if opts(2)==0 %binary x=b2f(x,bounds,bits); bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)... startPop(bindx,xZomeLength)]; else bPop(bFoundIn,:)=[gen startPop(bindx,:)]; end A4.2 Source Code of Monte Carlo Simulation A4.2.1 Source Code for Monte Carlo Simulation of 2-stage RF CMOS PPFs % load optimization results load twostageppfopt.mat r_1 r_2 c_1 c_2; global f; w=f; global r_1; global r_2; global c_1; global c_2; global pt_r; global pt_c; global cm; global m2_mu; % visiable waitbar h = waitbar(0,'Simulation is processing, please ait...'); for x=1:100, % computation here % waitbar(x/100,h) end close(h) % get the value of resistor process tolerance from input pt_r=findobj(gcf,'Tag','pt_r'); pt_r=str2double(get(pt_r,'string')); if isempty(pt_r), pt_r=0.16; else pt_r= pt_r; end 223 Appendix 4 Source Code of PPFOPTIMA % get the value of capacitor process tolerance from input pt_c=findobj(gcf,'Tag','pt_c'); pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end % get the value of maximum component mismatch from input cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end % get the number of runs of MC from input m2_mu=findobj(gcf,'Tag','m2_mu'); m2_mu=str2double(get(m2_mu,'string')); if isempty(m2_mu), m2_mu=200; else m2_mu=m2_mu; end % caculate maximum R & C variant dc_1=c_1.*pt_c.*1e-15; dc_2=c_2.*pt_c.*1e-15; dr_1=r_1.*pt_r; dr_2=r_2.*pt_r; % generate random numbers with truncated Gaussian distribution amm_2=0; pmm_2=0; for i=1:m2_mu; i=i+1; N=2000; % size of random numbers M=1; mu=0; % mean value sig=0.3; % standard deviation xlo=-1; % low truncation point xhi=1; % high truncation point s=truncnormrnd(N,M,mu,sig,xlo,xhi); N=2000; M=1; mu=0; sig=0.3; xlo=-1; xhi=1; t=truncnormrnd(N,M,mu,sig,xlo,xhi); % MC simulations of gain mismatch and phase difference r2_1=r_1+dr_1.*s; r2_2=r_2+dr_2.*s; c2_1=c_1.*1e-15+dc_1.*s; c2_2=c_2.*1e-15+dc_2.*s; d=T_amplitudept_in(w,r2_1,c2_1,r2_2,c2_2); m=T_phasept_in(w,r2_1,c2_1,r2_2,c2_2); r2_1=(r_1+dr_1.*s).*(1+cm.*t); r2_2=(r_2+dr_2.*s).*(1+cm.*t); c2_1=(c_1.*1e-15+dc_1.*s).*(1+cm.*t); c2_2=(c_2.*1e-15+dc_2.*s).*(1+cm.*t); b=T_amplitudept_qu(w,r2_1,c2_1,r2_2,c2_2); n=T_phasept_qu(w,r2_1,c2_1,r2_2,c2_2); amm_1=abs(20.*log10(b)-20.*log10(d)); t1=sort(amm_1); amm_2=amm_2+t1; pmm_1=n-m+90; t2=sort(pmm_1); pmm_2=pmm_2+t2; end amm=amm_2./m2_mu; pmm=pmm_2./m2_mu; % caculate standard deviation kerse_1=std(amm) kerse_1=round(kerse_1.*1000)./1000; st1=findobj(gcf,'Tag','kerse_1'); set(st1,'String',[num2str(kerse_1)]) kerse_2=std(pmm-90) kerse_2=round(kerse_2.*1000)./1000; stm=findobj(gcf,'Tag','kerse_2'); set(stm,'String',[num2str(kerse_2)]) figure subplot(2,1,1); % plot gain mismatch histogram of gain mismatch hist(amm) xlabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Monte Carlo Simulation for 2-stage RF CMOS PPF','FontSize', 14) ylabel('Number of Samples','FontSize', 14) subplot(2,1,2); % plot phase difference histogram of gain mismatch hist(pmm) xlabel('{\itd}-{\rmphase} / degree','FontSize', 14) ylabel('Number of Samples','FontSize', 14) A4.2.2 Source Code for Monte Carlo Simulation of 3-stage RF CMOS PPFs load threestageppfopt.mat r1 r2 r3 c1 c2 c3; global f; w=f; global r1; global r2; global r3; global c1;global c2; global c3; global pt_r; global pt_c; global cm; global m3_mu; h = waitbar(0,'Simulation is processing, please wait...'); for x=1:100, % computation here % pt_r=findobj(gcf,'Tag','pt_r'); if isempty(pt_r), waitbar(x/100,h) pt_r=str2double(get(pt_r,'string')); pt_r=0.16; else pt_r= pt_r; end dr_1=r1.*pt_r; dr_2=r2.*pt_r; dr_3=r3.*pt_r; pt_c=findobj(gcf,'Tag','pt_c'); 224 end close(h) Appendix 4 Source Code of PPFOPTIMA pt_c=str2double(get(pt_c,'string')); if isempty(pt_c), pt_c=0.21; else pt_c=pt_c; end dc_1=c1.*pt_c.*1e-15;dc_2=c2.*pt_c.*1e-15; dc_3=c3.*pt_c.*1e-15 cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=str2double(get(cm,'string')); cm=0.01; else cm=cm; end; m3_mu=findobj(gcf,'Tag','m3_mu'); m3_mu=str2double(get(m3_mu,'string')); if isempty(m3_mu), m3_mu=200; else m3_mu=m3_mu; end amm_2=0; pmm_2=0; for i=1:m3_mu; i=i+1; N=2000; M=1; mu=0; sig=0.3; xlo=-1; xhi=1; s=truncnormrnd(N,M,mu,sig,xlo,xhi); N=2000; M=1; mu=0; sig=0.3; xlo=-1; xhi=1; t=truncnormrnd(N,M,mu,sig,xlo,xhi); r3_1=r1+dr_1.*s; r3_2=r2+dr_2.*s; r3_3=r3+dr_3.*s; c3_1=(c1.*1e-15)+dc_1.*s; c3_2=(c2.*1e-15)+dc_2.*s; c3_3=(c3.*1e-15)+dc_3.*s; d=Th_amplitudept_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); m=Th_phasept_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); r3_1=(r1+dr_1.*s).*(1+cm.*t); r3_2=(r2+dr_2.*s).*(1+cm.*t); r3_3=(r3+dr_3.*s).*(1+cm.*t); c3_1=((c1.*1e-15)+dc_1.*s).*(1+cm.*t); c3_2=((c2.*1e-15)+dc_2.*s).*(1+cm.*t); c3_3=((c3.*1e-15)+dc_3.*s).*(1+cm.*t); b=Th_amplitudept_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); n=Th_phasept_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); amm_1=abs(20.*log10(d)-20.*log10(b)); t1=sort(amm_1); amm_2=amm_2+t1; pmm_1=(m-n)+90; t2=sort(pmm_1); pmm_2=pmm_2+t2; end amm=amm_2./m3_mu; pmm=pmm_2./m3_mu; figure subplot(2,1,1); hist(amm) xlabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Monte Carlo Simulation of 3-stage RF CMOS PPF','FontSize', 14) ylabel('Number of Samples','FontSize', 14) subplot(2,1,2); hist(pmm) xlabel('{\itd}-{\rmphase} / degrees','FontSize', 14) ylabel('Number of Samples','FontSize', 14) A4.2.3 Source Code for Monte Carlo Simulation of 4-stage RF CMOS PPFs load fourstageoptrc.mat; global f; w=f; global r4_1; global r4_2; global r4_3; global r4_4; global c4_1; global c4_2; global c4_3; global c4_4; global pt_r; global pt_c; global cm; global m4_mu; r_1=r4_1; r_2=r4_2; r_3=r4_3; r_4=r4_4; c_1=c4_1*1e-15; c_2=c4_2*1e-15; c_3=c4_3*1e-15; c_4=c4_4*1e-15; h = waitbar(0,'Simulation is processing, please wait...'); for x=1:100, % computation here % pt_r=findobj(gcf,'Tag','pt_r'); if isempty(pt_r), waitbar(x/100,h) pt_r=str2double(get(pt_r,'string')); pt_r=0.16; else pt_r= pt_r; end 225 end close(h) Appendix 4 Source Code of PPFOPTIMA pt_c=findobj(gcf,'Tag','pt_c'); if isempty(pt_c), pt_c=str2double(get(pt_c,'string')); pt_c=0.21; else pt_c=pt_c; end cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end m4_mu=findobj(gcf,'Tag','m4_mu'); if isempty(m4_mu), m4_mu=str2double(get(m4_mu,'string')); m4_mu=200; else amm_2=0; pmm_2=0; for i=1:m4_mu; m4_mu=m4_mu; end i=i+1; N=2000; M=1;mu=0; sig=0.3; xlo=-1; xhi=1; t=truncnormrnd(N,M,mu,sig,xlo,xhi); N=2000; M=1; mu=0; sig=0.3; xlo=-1; xhi=1; s=truncnormrnd(N,M,mu,sig,xlo,xhi); dr4_1=r_1.*pt_r; dr4_2=r_2.*pt_r; dr4_3=r_3.*pt_r; dr4_4=r_4.*pt_r; dc_1=c_1.*pt_c; dc_2=c_2.*pt_c; dc_3=c_3.*pt_c; dc_4=c_4.*pt_c; c1=c_1+dc_1.*t; c2=c_2+dc_2.*t; c3=c_3+dc_3.*t; c4=c_4+dc_4.*t; r4_1=r_1+dr4_1.*t; r4_2=r_2+dr4_2.*t; r4_3=r_3+dr4_3.*t; r4_4=r_4+dr4_4.*t; d=F_amplitudept_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); m=F_phasept_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); c1=(c_1+dc_1.*t).*(1+cm.*s); c2=(c_2+dc_2.*t).*(1+cm.*s); c3=(c_3+dc_3.*t).*(1+cm.*s); c4=(c_4+dc_4.*t).*(1+cm.*s); r4_1=(r_1+dr4_1.*t).*(1+cm.*s); r4_2=(r_2+dr4_2.*t).*(1+cm.*s); r4_3=(r_3+dr4_3.*t).*(1+cm.*s); r4_4=(r_4+dr4_4.*t).*(1+cm.*s); b=F_amplitudept_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); n=F_phasept_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); amm_1=abs(20.*log10(d)-20.*log10(b)); t1=sort(amm_1); amm_2=amm_2+t1; pmm_1=(m-n)+90; t2=sort(pmm_1); pmm_2=pmm_2+t2; end amm=amm_2./m4_mu; pmm=pmm_2./m4_mu; figure subplot(2,1,1); hist(amm) xlabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Monte Carlo Simulation of 3-stage RF CMOS PPF','FontSize', 14) ylabel('Number of Samples','FontSize', 14) subplot(2,1,2); hist(pmm) xlabel('{\itd}-{\rmphase} / degrees','FontSize', 14) ylabel('Number of Samples','FontSize', 14) A4.3 Source Code of the Worst-Case Simulation A4.3.1 Source Code for the Worst-Case Simulation of 2-stage RF CMOS PPFs % load optimization results load twostageppfopt.mat r_1 r_2 c_1 c_2; global f_1; global f_2;global f; global r_1; global r_2; global c_1; global c_2; global cm; global irrt; % get the value of maximum component mismatch from input cm=findobj(gcf,'Tag','cm'); cm=str2double(get(cm,'string')); if isempty(cm), cm=0.01; else cm=cm; end % visiable waitbar 226 Appendix 4 Source Code of PPFOPTIMA h = waitbar(0,'Simulation is processing, please wait...'); for x=1:100, % computation here % waitbar(x/100,h), end close(h) % search worst IRR corresponding frequency point with R&C nominal values rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'gaMichEval2stage2'; evalOps = []; b_1=f_1; b_2=f_2; bounds = [b_1 b_2]; gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'gaMichEval2stage2',[],[1e-6 0]); % lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts,... termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps,... selectFn,selectOps); % x is the best solution found x; fmax=x; w=fmax; % caculate worst case IRR r2_1=r_1; r2_2=r_2; c2_1=c_1*1e-15; c2_2=c_2*1e-15; d=T_amplitude_qu(w,r2_1,c2_1,r2_2,c2_2); k=T_phase_qu(w,r2_1,c2_1,r2_2,c2_2); n_1=(d); p1_1=(k); b=T_amplitude_in(w,r2_1,c2_1,r2_2,c2_2); h=T_phase_in(w,r2_1,c2_1,r2_2,c2_2); p2_1=(h); m_1=(b); a_delta_1=abs(m_1-n_1); p_delta_1=abs((p2_1-p1_1).*pi./180); r2_1=r_1; r2_2=r_2; c2_1=c_1*1e-15; c2_2=c_2*1e-15; d=T_amplitude_in(w,r2_1,c2_1,r2_2,c2_2); k=T_phase_in(w,r2_1,c2_1,r2_2,c2_2); n_2=(d); p1_2=(k); dr_11=cm*r_1; dr_22=cm*r_2; dc_11=cm*c_1*1e-15; dc_22=cm*c_2*1e-15; r2_1=r_1+dr_11; r2_2=r_2+dr_22; c2_1=c_1*1e15+dc_11; c2_2=c_2*1e-15+dc_22; b=T_amplitude_in(w,r2_1,c2_1,r2_2,c2_2); h=T_phase_in(w,r2_1,c2_1,r2_2,c2_2); p2_2=(h); m_2=(b); a_delta_2=abs(m_2-n_2); a=sqrt(m_2.^2+n_2.^2); p_delta_2=abs((p2_2-p1_2).*pi./180); a_delta=(a_delta_1+a_delta_2); p_delta=(p_delta_1+p_delta_2); irrt=ImageRR(a_delta,a,p_delta); irrw=round(irrt.*10)./10; hh=findobj(gcf,'Tag','irrw'); set(hh,'String',[num2str(irrw)]) % load IRR of design specification load designspeci.mat irrspec; % compare with worst case IRR if irrw<irrspec, warndlg('Two-stage PPF IRR can not satisfy the design specification, please use higher stage PPF.','Warning') end % caculate corresponding process tolerance of R&C ptt=fmax./f; pt_two=1-sqrt(1./ptt); % caculate R & C variant dr_1=r_1*pt_two; dr_2=r_2*pt_two; dc_1=c_1*pt_two*1e-15; dc_2=c_2*pt_two*1e-15; % caculate gain mismatch and phase difference r2_1=r_1+dr_1; r2_2=r_2+dr_2; c2_1=c_1*1e-15+dc_1; c2_2=c_2*1e-15+dc_2; w=f_1*(1-0.2):f_1./1e4:f_2*(1+0.2); d=T_amplitude_in(w,r2_1,c2_1,r2_2,c2_2); k=T_phase_in(w,r2_1,c2_1,r2_2,c2_2); n=20*log10(d); p1=(k); dr_11=cm*r_1;dr_22=cm*r_2; dc_11=cm*c_1*1e-15;dc_22=cm*c_2*1e-15; r2_1=r_1+dr_1+dr_11; r2_2=r_2+dr_2+dr_22; c2_1=c_1*1e-15+dc_1+dc_11; c2_2=c_2*1e-15+dc_2+dc_22; b=T_amplitude_qu(w,r2_1,c2_1,r2_2,c2_2); h=T_phase_qu(w,r2_1,c2_1,r2_2,c2_2); p2=(h); m=20*log10(b); gmis=abs(m-n); figure % polt gain mismatch plot(w,gmis,'m-') xlabel('{\itf} / Hz','FontSize', 14) ylabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Gain Mismatch in 2Stage RF CMOS PPF','FontSize', 14) figure pmis=-p1+p2+90; % plot phase difference 227 Appendix 4 Source Code of PPFOPTIMA plot(w,pmis,'m-') xlabel('{\itf} / Hz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase Difference in 2-Stage RF CMOS PPF','FontSize', 14) A4.3.2 Source Code for the Worst-Case simulation of 3-stage RF CMOS PPFs load threestageppfopt.mat r1 r2 r3 c1 c2 c3 we; global f_1; global f_2; global f; global r1; global r2; global r3; global c1; global c2; global c3; global cm; global irrth; cm=findobj(gcf,'Tag','cm'); if isempty(cm), cm=str2double(get(cm,'string')); cm=0.01; else cm=cm; end h = waitbar(0,'Simulation is processing, please wait...'); for x=1:100, waitbar(x/100,h) end % computation here % close(h) rand('seed',0); % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'gaMichEval3stage2'; evalOps = []; bounds = [f_1 f_2]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'gaMichEval3stage2',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts,... termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps,... selectFn,selectOps); % x is the best solution found x; fmax=x; w=fmax; r3_1=r1; r3_2=r2; r3_3=r3; c3_1=c1*1e-15; c3_2=c2*1e-15; c3_3=c3*1e-15; d=Th_amplitude_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); k=Th_phase_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); n=(d); p1=(k); b=Th_amplitude_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); h=Th_phase_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); p2=(h); m=(b); a_delta_1=abs(m-n); p_delta_1=abs((p2-p1).*pi./180); a=n; r3_1=r1; r3_2=r2; r3_3=r3; c3_1=c1*1e-15; c3_2=c2*1e-15; c3_3=c3*1e-15; d=Th_amplitude_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); k=Th_phase_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); n=(d); p1=(k); dr_11=cm*r1; dr_22=cm*r2; dr_33=cm*r3; dc_11=cm*c1*1e-15; 228 Appendix 4 Source Code of PPFOPTIMA dc_22=cm*c2*1e-15; dc_33=cm*c3*1e-15; r3_1=r1+dr_11; r3_2=r2+dr_22; r3_3=r3+dr_33; c3_1=c1*1e-15+dc_11; c3_2=c2*1e-15+dc_22; c3_3=c3*1e-15+dc_33; b=Th_amplitude_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); h=Th_phase_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); p2=(h); m=(b); a_delta_2=abs(m-n); % a=sqrt(m.^2+n.^2); p_delta_2=abs((p2-p1).*pi./180); p_delta=p_delta_1+p_delta_2; a_delta=a_delta_1+a_delta_2; irrth=ImageRR(a_delta,a,p_delta); irrw=round(irrth.*10)./10; hh=findobj(gcf,'Tag','irrw'); set(hh,'String',[num2str(irrw)]) %save threestageppfirr.mat irrth; load designspeci.mat irrspec; if irrw<irrspec, warndlg('Three-stage PPF IRR can not satisfy the design specification, please use higher stage PPF.','Warning') end ptt=fmax./f; pt_three=1-sqrt(1./ptt); a=pt_three; w=f_1*(1-0.3):f_1./1e4:f_2*(1+0.5); dr_1=r1*pt_three; dr_2=r2*pt_three; dr_3=r3*pt_three; dc_1=c1*pt_three*1e-15; dc_2=c2*pt_three*1e-15; dc_3=c3*pt_three*1e-15; r3_1=r1+dr_1; r3_2=r2+dr_2; r3_3=r3+dr_3; c3_1=c1*1e-15+dc_1; c3_2=c2*1e-15+dc_2; c3_3=c3*1e-15+dc_3; d=Th_amplitude_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); k=Th_phase_in(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); n=20*log10(d); p1=(k); dr_11=cm*r1; dr_22=cm*r2; dr_33=cm*r3; dc_11=cm*c1*1e-15; dc_22=cm*c2*1e-15; dc_33=cm*c3*1e-15; r3_1=r1+dr_1+dr_11; r3_2=r2+dr_2+dr_22; r3_3=r3+dr_3+dr_33; c3_1=c1*1e-15+dc_1+dc_11; c3_2=c2*1e-15+dc_2+dc_22; c3_3=c3*1e-15+dc_3+dc_33; b=Th_amplitude_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); h=Th_phase_qu(w,r3_1,c3_1,r3_2,c3_2,r3_3,c3_3); p2=(h); m=20*log10(b); % gmis=we.*abs(m-n); gmis=abs(m-n); figure subplot(2,1,1); plot(w,gmis,'m-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Gain Mismatch in 3-Stage RF CMOS PPF','FontSize', 14) subplot(2,1,2); pmis=-p1+p2+90; plot(w,pmis,'m-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase Mismatch in 3-Stage RF CMOS PPF','FontSize', 14) A4.3.3 Source Code for the Worst-Case simulation of 4-stage RF CMOS PPFs load fourstageoptrc.mat; global f_1; global f_4; global f; global r4_1; global r4_2; global r4_3; global r4_4; global c4_1; global c4_2; global c4_3; global c4_4; global cm; global irrf; h = waitbar(0,'Simulation is processing, please wait...'); waitbar(x/100,h) end cm=findobj(gcf,'Tag','cm'); if isempty(cm), close(h) cm=str2double(get(cm,'string')); cm=0.01; else f_1=findobj(gcf,'Tag','f_1'); f_4=findobj(gcf,'Tag','f_4'); f=findobj(gcf,'Tag','f'); for x=1:100, cm=cm; end f_1=str2double(get(f_1,'string')); f_4=str2double(get(f_4,'string')); f=str2double(get(f,'string')); rand('seed',0); 229 % computation here % Appendix 4 Source Code of PPFOPTIMA % Crossover Operators xFns = 'simpleXover'; xOpts = [.4]; % Mutation Operators mFns = 'binaryMutation'; mOpts = [0.005]; % Termination Operators termFns = 'maxGenTerm'; termOps = [100]; % 200 Generations % Selection Function selectFn = 'roulette'; selectOps = []; % Evaluation Function evalFn = 'gaMichEval4stage2'; evalOps = []; bounds = [f_1 f_4]; % GA Options [epsilon float/binar display] gaOpts=[1e-6 0 1]; % Generate an intialize population of size 20 startPop = initializega(20,bounds,'gaMichEval4stage2',[],[1e-6 0]); % Lets run the GA [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,startPop,gaOpts,... termFns,termOps,selectFn,selectOps,xFns,xOpts,mFns,mOpts); % x is the best solution found %x; % endPop is the ending population %endPop; % trace is a trace of the best value and average value of generations %trace; % Lets increase the population size by running the defaults rand('seed',0); termOps=[100]; [x endPop bestPop trace]=ga(bounds,evalFn,evalOps,[],gaOpts,termFns,termOps,... selectFn,selectOps); % x is the best solution found x; fmax=x; w=fmax; c1=c4_1*1e-15; c2=c4_2*1e-15; c3=c4_3*1e-15; c4=c4_4*1e-15; r4_1=r4_1; r4_2=r4_2; r4_3=r4_3; r4_4=r4_4; d=F_amplitude_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); k=F_phase_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,4); n=(d); p1=(k); b=F_amplitude_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); h=F_phase_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); p2=(h); m=(b); a_delta_1=abs(m-n); p_delta_1=abs((p2-p1).*pi./180); c1=c4_1*1e-15;c2=c4_2*1e-15; c3=c4_3*1e-15; c4=c4_4*1e-15; r4_1=r4_1; r4_2=r4_2; r4_3=r4_3; r4_4=r4_4; d=F_amplitude_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); k=F_phase_in(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); n=(d); p1=(k); dr_11=cm*r4_1; dr_22=cm*r4_2; dr_33=cm*r4_3; dr_44=cm*r4_4; dc_11=cm*c1; dc_22=cm*c2; dc_33=cm*c3; dc_44=cm*c4; r4_1=r4_1+dr_11; r4_2=r4_2+dr_22; r4_3=r4_3+dr_33; r4_4=r4_4+dr_44; c1=c1+dc_11; c2=c2+dc_22; c3=c3+dc_33; c4=c4+dc_44; b=F_amplitude_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); h=F_phase_qu(w,r4_1,c1,r4_2,c2,r4_3,c3,r4_4,c4); p2=(h); m=(b); a_delta_2=abs(m-n); p_delta_2=abs((p2-p1).*pi./180); a=sqrt(m.^2+n.^2); a_delta=a_delta_1+a_delta_2; p_delta=p_delta_1+p_delta_2; irrf=ImageRR(a_delta,a,p_delta); irrw=round(irrf.*10)./10; hh=findobj(gcf,'Tag','irrw'); set(hh,'String',[num2str(irrw)]) %save fourstageppfirr.mat irrf; load designspeci.mat irrspec; if irrw<irrspec, warndlg('Four-stage PPF IRR can not satisfy the design specification, this tool box can not help you any more, please use Double Quadrature Transceiver architecture.','Warning') end ptt=fmax./f; pt_four=1-sqrt(1./ptt); a=pt_four; load fourstageoptrc.mat; w=f_1.*(1-0.30):f_1./1e4:f_4.*(1+0.30); c1=c4_1.*1e-15; c2=c4_2.*1e-15; c3=c4_3.*1e-15; 230 Appendix 4 Source Code of PPFOPTIMA c4=c4_4.*1e-15; dr_1=pt_four.*r4_1; dr_2=pt_four.*r4_2; dr_3=pt_four.*r4_3; dr_4=pt_four.*r4_4; dc_1=pt_four.*c1; dc_2=pt_four.*c2; dc_3=pt_four.*c3; dc_4=pt_four.*c4; dr_11=cm*r4_1; dr_22=cm*r4_2; dr_33=cm*r4_3; dr_44=cm*r4_4; dc_11=cm*c1; dc_22=cm*c2; dc_33=cm*c3; dc_44=cm*c4; r1=r4_1+dr_1; r2=r4_2+dr_2; r3=r4_3+dr_3; r4=r4_4+dr_4; c41=c1+dc_1; c42=c2+dc_2; c43=c3+dc_3; c44=c4+dc_4; d=F_amplitudew_in(w,r1,c41,r2,c42,r3,c43,r4,c44); k=F_phasew_in(w,r1,c41,r2,c42,r3,c43,r4,c44);n=20*log10(d); p1=(k); r1=r4_1+dr_1+dr_11; r2=r4_2+dr_2+dr_22; r3=r4_3+dr_3+dr_33; r4=r4_4+dr_4+dr_44; c41=c1+dc_1+dc_11; c42=c2+dc_2+dc_22; c43=c3+dc_3+dc_33; c44=c4+dc_4+dc_44; b=F_amplitudew_qu(w,r1,c41,r2,c42,r3,c43,r4,c44); h=F_phasew_qu(w,r1,c41,r2,c42,r3,c43,r4,c44); p2=(h); m=20*log10(b); gmis=abs(m-n); figure subplot(2,1,1); plot(w,gmis,'m-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itm}-{\rmgain} / dB','FontSize', 14) title('Gain Mismatch in 4-Stage RF CMOS PPF','FontSize', 14) subplot(2,1,2); pmis=-p1+p2+90; plot(w,pmis,'m-') xlabel('{\itf} / GHz','FontSize', 14) ylabel('{\itd}-{\rmphase} / degrees','FontSize', 14) title('Phase Mismatch in 4-Stage RF CMOS PPF','FontSize', 14) 231