Qucs. A Tutorial. Transient Domain Flip-Flop Models for Mixed-Mode Simulation. Mike Brinson. Copyright c 2006 Mike Brinson <mbrin72043@yahoo.co.



Similar documents
Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Module 3: Floyd, Digital Fundamental

Lecture 8: Synchronous Digital Systems

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Counters and Decoders

CHAPTER 11: Flip Flops

Theory of Logic Circuits. Laboratory manual. Exercise 3

Sequential Logic Design Principles.Latches and Flip-Flops

Digital Logic Design Sequential circuits

ASYNCHRONOUS COUNTERS

Lesson 12 Sequential Circuits: Flip-Flops

Master/Slave Flip Flops

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Counters. Present State Next State A B A B

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

Memory Elements. Combinational logic cannot remember

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

Chapter 9 Latches, Flip-Flops, and Timers

Counters & Shift Registers Chapter 8 of R.P Jain

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

CS311 Lecture: Sequential Circuits

Chapter 8. Sequential Circuits for Registers and Counters

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Contents COUNTER. Unit III- Counters

Modeling Latches and Flip-flops

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

CHAPTER 11 LATCHES AND FLIP-FLOPS

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

A Lesson on Digital Clocks, One Shots and Counters

A Lesson on Digital Clocks, One Shots and Counters

The enable pin needs to be high for data to be fed to the outputs Q and Q bar.

7. Latches and Flip-Flops

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Sequential Logic: Clocks, Registers, etc.

ECE380 Digital Logic

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

Flip-Flops, Registers, Counters, and a Simple Processor

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Engr354: Digital Logic Circuits

BINARY CODED DECIMAL: B.C.D.

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

The components. E3: Digital electronics. Goals:

EXPERIMENT 8. Flip-Flops and Sequential Circuits

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

DEPARTMENT OF INFORMATION TECHNLOGY

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

Asynchronous Counters. Asynchronous Counters

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Digital Logic Elements, Clock, and Memory Elements

A New Paradigm for Synchronous State Machine Design in Verilog

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Chapter 5. Sequential Logic

Digital Electronics Detailed Outline

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

CHAPTER 3 Boolean Algebra and Digital Logic

Combinational Logic Design Process

Asynchronous counters, except for the first block, work independently from a system clock.

Accurate Measurement of the Mains Electricity Frequency

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Step Response of RC Circuits

A Digital Timer Implementation using 7 Segment Displays

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Fig1-1 2-bit asynchronous counter

Lecture-3 MEMORY: Development of Memory:

Positive Feedback and Oscillators

Decimal Number (base 10) Binary Number (base 2)

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Use and Application of Output Limiting Amplifiers (HFA1115, HFA1130, HFA1135)

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

Upon completion of unit 1.1, students will be able to

Chapter 2 Logic Gates and Introduction to Computer Architecture

Digital Fundamentals

DATA SHEET. HEF40193B MSI 4-bit up/down binary counter. For a complete data sheet, please also download: INTEGRATED CIRCUITS

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

3.Basic Gate Combinations

Napier University. School of Engineering. Electronic Engineering A Module: SE42205 Digital Design

Laboratory 4: Feedback and Compensation

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

路 論 Chapter 15 System-Level Physical Design

CSE140: Components and Design Techniques for Digital Systems

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

Wiki Lab Book. This week is practice for wiki usage during the project.

Counters are sequential circuits which "count" through a specific state sequence.

The 104 Duke_ACC Machine

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

6-BIT UNIVERSAL UP/DOWN COUNTER

Set-Reset (SR) Latch

PLL frequency synthesizer

Philadelphia University Faculty of Information Technology Department of Computer Science Semester, 2007/2008.

Interfacing Analog to Digital Data Converters

Lecture 7: Clocking of VLSI Systems

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package.

Transcription:

ucs A Tutorial Transient Domain Flip-Flop Models for Mixed-Mode Simulation Mike Brinson Copyright c 26 Mike Brinson <mbrin7243@yahoo.co.uk> Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version. or any later version published by the Free Software Foundation. A copy of the license is included in the section entitled GNU Free Documentation License.

Introduction One of the primary aims of the ucs project is the development of a universal circuit simulator that allows circuit performance to be investigated from DC to microwave frequencies. Adding performance analysis in the digital domain makes ucs a truly universal simulator. ucs..8 was the first release to include digital simulation. ucs digital simulation centres around VHDL using the FreeHDL VHDL compiler to generate a machine code simulation of a circuit under test. Release..8 includes built-in models for the basic digital gates and a number of the common sequential flip-flops. The ucs gate models can be used in both digital and transient simulation. Unfortunately, the flip-flop models are only available in digital simulation. The current version of ucs models flip-flops using VHDL and does not provide domain models for transient simulation. This is an important omission which limits the ucs simulator mixed-mode simulation capabilities. Mixed-mode simulation is a term commonly employed to describe the simulation of circuits that contain both analogue and digital components. In the real world circuits are, of course, not subdivided into neat boxes labelled analogue, S-parameter, digital or any other physical domain. So it is of some importance that ucs device modelling be developed to allow circuits consisting of a range of different analogue and digital components, to be simulated at the same. Normally such systems are simulated in the domain using large signal transient simulation. Performance data being both analogue and digital expressed in tabular or graphical form. This tutorial note presents a number of transient simulation models for flip-flops based on structural digital circuits, describes their use, and outlines a number of example simulations derived from practical circuits. Latches and flip-flops Sequential digital devices generically known as flip-flops (SR, D, JK and T types) are commonly classified into three major groups. Latches: basic or gated Pulse triggered flip-flops: master slave devices with or without data-lockout Edge-triggered flip-flops: leading or trailing edge triggered. As the speed of electronic systems has increased so has the popularity of the single edge-triggered flip-flops over the slower master slave devices. Today most IC designs are based on D type edge-triggered devices rather than the earlier JK master slave devices. Our concern here is the development of a consistant set of models that allow the common flip-flops to be modelled accurately, and reliably,

in the transient domain. In order to keep these models simple the D gated and edge-triggered devices have been chosen as the fundamental building blocks for the transient domain ucs models. Using basic Boolean logic concepts it is straightforward to show that JK and T edge-triggered flip-flop models can be derived from the D flip-flop models. The gated D latch The circuit diagram for a gated D latch constructed from two input nand gates is shown in Fig.. Outputs and not (B in Fig. ) are derived from the two cross coupled nand gates connected as a basic SR nand latch. Fig. 2 shows the performance characteristics for this circuit. These were obtained using the simple test configuration shown in Fig. 3. Logic one digital signals are represented by V and logic signals by V in the transient analysis domain. Propagation delays through the various circuit gates can be set by changing the delay for each gate. Cross coupled gates are often a cause of simulation failure due to the fact that DC analysis fails to converge to a stable solution at the start of a transient simulation. One approach that helps to force a stable DC solution is to set and B to known values, say logic and logic, at the start of a simulation. In circuits like the basic gated D latch shown in Fig., where asynchronous set and reset inputs are not included, this is not possible. However, flip-flops with asynchronous set and reset inputs do allow the state of a flip-flop to be determined at a given in a simulation. In the examples that follow, whenever possible, the state of the latch or flip-flop devices is set at the start of a simulation. In the majority of the example circuits, device delays have also been set to zero. It therefore follows that most waveform plots show functional data rather than accurate timing characteristics. In many mixed-mode simulations the digital elements present in a design are often modelled as functional devices whose primary task is to generate the signals needed for the overall circuit to function. A more detailed discussion of the effects on transient simulation caused by including device timing delays is presented in a later section of these notes. Richard S. Sandige, Modern Digital Design, 99, McGraw-Hill International Editions. 2

D D s=2ns; 2ns C s=5ns; 5ns Y5 C Y4 Y3 Y Y2 B transient simulation TR Type=lin Start= Stop= ns Figure : Gated D latch with digital signal generators D and C D.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 C.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 B.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 Figure 2: Gated D latch simulation waveforms 3

D C Num=2 D C D C B SUB File=gated_d_latch.sch transient simulation TR Type=lin Start= Stop=2 ns Figure 3: Gated D latch test circuit 4

Edge-triggered D type flip-flop The schematic for a positive edge-triggered D flip-flop is shown in Fig. 4 2. Asynchronous set (SET) and reset (RESET) control inputs allow the flip-flop outputs and not (B in Fig. 4) to be set to known values at the start of a simulation. The nand gates forming each of the cross coupled SR latches have their delay s set at ns. The edge-triggered D device is a building block for both the JK and T types of flip-flop. A typical set of transient simulation test results for the D flip-flop model are illustrated in Fig. 5. These where obtained using the basic test configuration shown in Fig. 6. SET SET Y7 I RESET I RESET CLOCK Y8 Y CLOCK Num= I2 B B Y Y2 I3 DIN DIN Num=2 Y9 Figure 4: Positive edge-triggered D flip-flop circuit 2 David A. Hodges and Horace G. Jackson, Analysis and Design of Digital Integrated Circuits, 998, Second edition, McGraw-Hill Book Company. 5

DIN.Vt CLOCK.Vt.Vt R.Vt B.Vt 5e-8 e-7.5e-7 2e-7 2.5e-7 3e-7 3.5e-7 4e-7 4.5e-7 5e-7 5e-8 e-7.5e-7 2e-7 2.5e-7 3e-7 3.5e-7 4e-7 4.5e-7 5e-7 5e-8 e-7.5e-7 2e-7 2.5e-7 3e-7 3.5e-7 4e-7 4.5e-7 5e-7 5e-8 e-7.5e-7 2e-7 2.5e-7 3e-7 3.5e-7 4e-7 4.5e-7 5e-7 5e-8 e-7.5e-7 2e-7 2.5e-7 3e-7 3.5e-7 4e-7 4.5e-7 5e-7 Figure 5: Transient waveforms for the circuit shown in Fig. 6 S4 s=4ns; 4ns CLOCK S2 s=5ns; 5ns DIN R D SUB2 S B R SUB transient simulation TR Type=lin Start= Stop=5 ns S3 s=2ns; ns Figure 6: D flip-flop test circuit 6

The edge-triggered JK flip-flop A leading edge-triggered JK flip-flop can be constructed using a positive edgetriggered D flip-flop and external logic 3. The external logic generates the required JK flip-flop characteristic equation given by + = J. + K. Were,, J and K are the current state values of the device signals and + is the next state value of following the rising edge of the device clock pulse. The schematic diagram for the edge triggered flip flop is shown in Fig. 7 and a typical set of test waveforms in Fig. 8. These were obtained using the test circuit shown in Fig. 9. SET J Y Y2 D S B CLOCK K Y4 Y3 R SUB File=dff_sr.sch RESET Figure 7: Positive edge-triggered JK flip-flop circuit 3 M. Morris Mano and Charles R Kime, Logic and Computer Design Fundamentals, 24, Third edition, Pearson Education International, Prentice Hall 7

RESET.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7 CLOCK.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7 B.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7 Figure 8: Transient waveforms for the circuit shown in Fig. 9 SUB2 CLOCK S J transient simulation CLOCK Num= K R B TR Type=lin Start= Stop= ns RESET SUB RESET Figure 9: JK flip-flop test circuit showing JK operating in toggle mode 8

The edge-triggered T flip-flop The characteristic equation for a leading edge-triggered flip-flop is 4 + = T where the symbols have the same meaning as the JK flip-flop. The circuit diagram, test waveforms and test circuit for the edge-triggered flip-flop are given in Figures to 2. SET SET TFF = D S TFF Y CLOCK B B CLOCK R R SUB File=dff_sr.sch R Figure : Positive edge-triggered T flip-flop circuit 4 See footnote 2. 9

SET.Vt CLOCK.Vt TFF.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7.Vt B.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 Figure : Transient waveforms for the circuit shown in Fig. 2 SET s= ns; ns T s=3 ns; 6 ns CLOCK CLOCK s=5 ns; 5 ns TFF SET S T R B transient simulation SUB2 SUB File=Logic_one.sch File=tff.sch Figure 2: T flip-flop test circuit TR Type=lin Start= Stop=2ns IntegrationMethod=Trapezoidal Order=2

Two example digital circuits A synchronous BCD up-counter: Figure 3 shows a synchronous BCD up-counter constructed from four edge-triggered JK flip flops connected as toggle flip-flops. The input signal waveforms and the corresponding counter outputs,, 2 and 3 are illustrated in Fig. 4. These simulation results were obtained using the default trapezoidal integration method with order 2. SUB5 File=Logic_one.sch Y Y2 Y3 S J 2 S S J J S J 3 CLOCK CLOCK s=5 ns; 5ns K R K R K R K R COUNT COUNT Y4 s=5 ns; ns CLEAR CLEAR Num=3 Y5 s= ns; ns SUB File=jkff.sch transient simulation SUB2 File=jkff.sch TR Type=lin Start= Stop=2ns IntegrationMethod=Trapezoidal Order=2 SUB3 File=jkff.sch SUB4 File=jkff.sch Figure 3: Synchronous BCD up-counter circuit At the start of simulation signal CLEAR is set to logic which in turn causes the counter to be reset to. Similarly signal COUNT has to be set to for counting to take place. Notice that the counter counts from to 9 and then resets to. A simple state machine: Figure 5 shows a simple sequential state machine with input X and outputs Y and Y2. The outputs are synchronised to the input clock. The state equations for this example are J = X, K =, Y =.X, Y 2 =

CLEAR.Vt CLOCK.Vt COUNT.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 3.Vt 2.Vt.Vt.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 Figure 4: Transient waveforms for the circuit shown in Fig. 3 2

X X s=ns; Y2 2ns CLOCK CLOCK s=5ns; 5ns S J K R SUB File=jkff.sch SUB4 File=Logic_one.sch D S R Y2 transient simulation TR Type=lin Start= Stop=35 ns IntegrationMethod=Trapezoidal SUB2 Order=2 File=dff_sr.sch RESET RESET s=5ns; ns Y D S R Y SUB3 File=dff_sr.sch digital simulation Digi Type=TimeList =35 ns Figure 5: A simple state machine 3

CLOCK.Vt RESET.Vt X.Vt Y.Vt Y2.Vt 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2.2e-7 2.4e-7 2.6e-7 2.8e-7 3e-7 3.2e-7 3.4e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2.2e-7 2.4e-7 2.6e-7 2.8e-7 3e-7 3.2e-7 3.4e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2.2e-7 2.4e-7 2.6e-7 2.8e-7 3e-7 3.2e-7 3.4e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2.2e-7 2.4e-7 2.6e-7 2.8e-7 3e-7 3.2e-7 3.4e-7 2e-8 4e-8 6e-8 8e-8 e-7.2e-7.4e-7.6e-7.8e-7 2e-7 2.2e-7 2.4e-7 2.6e-7 2.8e-7 3e-7 3.2e-7 3.4e-7 Figure 6: Transient waveforms for the circuit shown in Fig. 5 4

VHDL code for the transient domain flip-flop models Although the primary purpose for developing the transient domain flip-flop models is the simulation of mixed-mode circuits, it is worth noting that because the models have been constructed from ucs gate primitives using a bottom-up design approach, ucs can also use the models for digital simulation. Moreover, provided the circuit being simulated does not contain any purely analogue components ucs will generate a VHDL model testbench that describes the function and test sequence for the circuit being simulated. Shown in Fig. 7 is a digital list waveform plot for the synchronous BCD up-counter introduced in the previous section of these notes. Listing lists the VHDL code generated by ucs for the synchronous BCD up-counter example. d clear.x count.x clock.x q.x q.x q2.x q3.x 5n n 5n 2n 25n 3n 35n 4n 45n 5n 55n 6n 65n 7n 75n 8n 85n 9n 95n Figure 7: Digital TimeList waveforms for the circuit shown in Fig. 3 Listing : VHDL testbench code for the circuit shown in Fig. 3 ucs.. 9 /mnt/hda2/ D i g i t a l S u b c i r c u i t s p r j /Sync BCD counter. sch entity Sub Logic one i s port ( nnout L : out b i t ) ; end entity ; use work. a l l ; architecture Arch Sub Logic one of Sub Logic one i s signal gnd, L : b i t ; begin gnd <= ; L <= not gnd ; nnout L <= L or ; 5

end architecture ; entity S u b d f f s r i s port (CLOCK: in b i t ; DIN : in b i t ; nnout : out b i t ; nnout B : out b i t ; RESET: in b i t ; SET: in b i t ) ; end entity ; use work. a l l ; architecture Arch Sub dff sr of S u b d f f s r i s signal I, I2, I, I3, B, : b i t ; begin nnout B <= B or ; nnout <= or ; I <= not (CLOCK and RESET and I ) ; I 3 <= not (DIN and I 2 and RESET) ; B <= not (RESET and I 2 and ) ; <= not ( I and B and SET ) ; I <= not ( I3 and I and SET ) ; I2 <= not (CLOCK and I3 and I ) ; end architecture ; entity S u b j k f f i s port ( nnnet6 : in b i t ; nnnet : in b i t ; nnnet8 : in b i t ; nnout nnnet3 : out b i t ; nnout nnnet7 : out b i t ; nnnet9 : in b i t ; nnnet : in b i t ) ; end entity ; 6

use work. a l l ; architecture Arch Sub jkff of S u b j k f f i s signal nnnet, nnnet2, nnnet4, nnnet5, nnnet7, nnnet3 : b i t ; begin nnnet <= not nnnet ; nnnet2 <= nnnet3 and nnnet ; nnnet4 <= nnnet2 or nnnet5 ; nnnet5 <= nnnet6 and nnnet7 ; nnout nnnet7 <= nnnet7 or ; nnout nnnet3 <= nnnet3 or ; SUB : entity S u b d f f s r port map ( nnnet8, nnnet4, nnnet3, nnnet7, nnnet, nnnet9 ) ; end architecture ; entity TestBench end entity ; use work. a l l ; i s architecture Arch TestBench of TestBench i s signal CLEAR, COUNT, CLOCK, 3,,, 2, nnnet, nnnet, nnnet2, nnnet3, nnnet4, nnnet5, nnnet6, nnnet7, nnnet8, 7

nnnet9 : b i t ; begin SUB5 : entity Sub Logic one port map ( nnnet ) ; nnnet <= and nnnet2 ; nnnet3 <= and nnnet ; nnnet4 <= 2 and nnnet3 ; SUB2 : entity S u b j k f f port map ( nnnet, nnnet, nnnet5,, nnnet6, nnnet, nnnet7 ) ; SUB3 : entity S u b j k f f port map ( nnnet3, nnnet3, nnnet5, 2, nnnet8, nnnet, nnnet7 ) ; SUB : entity S u b j k f f port map ( nnnet, nnnet, nnnet5,, nnnet9, nnnet, nnnet7 ) ; nnnet5 <= COUNT and CLOCK; nnnet7 <= not CLEAR; CLEAR: process begin CLEAR <= ; wait for ns ; CLEAR <= ; wait for ns ; end process ; COUNT: process begin COUNT <= ; wait for 5 ns ; COUNT <= ; wait for ns ; end process ; CLOCK: process begin CLOCK <= ; wait for 5 ns ; CLOCK <= ; wait for 5 ns ; end process ; SUB4 : entity S u b j k f f port map ( nnnet4,, nnnet5, 3, nnnet2, nnnet, nnnet7 ) ; end architecture ; 8

Generating a library of mixed-mode digital components The ucs project facilities offer users a simple and convenient approach to developing libraries of components that are linked by a common theme; in these notes this is digital component models for transient simulation. To form a library create a new folder, at a point on a disk file system that users have read/write access, giving it a suitable name, for example f l i p f l o p models tran sim p r j. Next move into the new library folder a copy of each of the schematic capture files for the flip-flop models introduced in these notes. These are: d f f s r. sch, j k f f. sch, t f f. sch, and gated d l a t c h. sch. A copy of the schematic for setting nodes to logic one is also required ( l o g i c one. sch ). These models are then freely available for use in any projects which users are working on. They can be copied into such projects using the Add files to Project... menu button found under the ucs Project drop-down menu. Similarly any new models developed as part of a project can be added to the library and used again in the future. Digital component propagation delays and transient simulation numerical stability Transient simulation is in general much slower than digital simulation using VHDL generated machine code. The large signal transient simulation models of flip-flops and other sequential digital devices are intended for use in mixed-mode circuit simulation rather than being used for pure digital circuit simulation. An interesting, and indeed very important question, relates to the efficiency, and accuracy, of the numerical analysis algorithms employed in the integration routines that are central to transient circuit simulation. ucs allows users to select the algorithm they wish to employ for transient simulation. The available algorithms are Trapezoidal, Euler, Gear and Adams Moulton; in each case the algorithm order can be set from to 6. The second order Trapezoidal integration algorithm is used by ucs as the default for transient simulation. To test which of these algorithms offers the most efficient solution to the transient simulation of digital circuits, that include flip-flops, the BCD counter shown in Fig. 3 was used as a test case and repeatedly simulated using different integration routines and algorithm orders. 9

Order Trapezoidal Euler Gear Adams Moulton.62.65.62 2.62.44 4.62.28.39 6.62.28.8 Table : Relative simulation s for the circuit shown in Fig. 3 Order Number or rejections Average step 47 5.7737e-2 2 75 9.4585e-2 4 454 2.866e- 6 6 5.76646e- Table 2: Number of rejections and average step data for the Adams Moulton algorithm The test results are shown in Table. Very little difference was found between circuits where the cross coupled gates both had zero propagation delays and the case where one gate had.5ns delay and the other zero delay. One obvious fact emerges from the data given in Table ; namely that the Adams Moulton higher order integration routines appear to be faster than the default trapezoidal algorithm. This is corroborated by the average step and number of rejection data points output by ucs at the end of a simulation. Table 2 lists this data for the Adams Moulton algorithm tabulated in Table. Table 2 points to the increase in average step and the dramatic reduction in the number of simulation solution rejections as the probable reason for the reduction in transient simulation when using the higher order Adams Moulton integration routines. However, other factors may influence the choice of integration routine. Often speed is not the only criteria that is of importance when simulating large complex circuits. Consider the following case (the circuit shown in Fig. 3 with order 6 Adams Moulton transient analysis integration); setting one of the gate delays to ns, and the other to ns, in each of the RS latches in the edgetriggered D flip-flop yields the signal waveforms illustrated in Fig. 8. Clearly here the solution is incorrect pointing to probable numerical instability caused by the choice of integration routine. 2

CLEAR.Vt CLOCK.Vt COUNT.Vt.Vt.Vt 2.Vt 3.Vt e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 e-8 2e-8 3e-8 4e-8 5e-8 6e-8 7e-8 8e-8 9e-8 e-7.e-7.2e-7 Figure 8: Digital TimeList waveforms for the circuit shown in Fig. 3 Mixed-mode example simulations Mixed-mode simulation involves the simulation of circuits that contain electronic devices and circuits from different physical domains; the most obvious being circuits with a mixture of analogue and digital components. ucs has developed to a point where it can handle this type of circuit given device models that can span across the different physical domains. In the future such circuits are likely to incorporate components from other domains, including for example, digital signal processing components (DSP) and possibly nano mechanical devices. Multi-domain simulation adds additional complexity to the simulation process not normally found in single domain simulation. Each domain usually represents signal data in a specific way attributed to a given domain; voltage and current for analogue quantities, boolean and for digital signals and floating point numbers for DSP. Hence, signals passing from one domain to another have to be converted from one format to another. These conversion elements are often called node-bridges and form an essential part of the mixed-mode simulation process. The three examples that are introduced in this section of these notes have been chosen to illustrate a number of the basic ideas concerned with mixed-mode simulation of circuits containing analogue and digital components, and to show how ucs deals with this type of simulation. In the last section the importance of correct selection of integration routine when simulating circuits in the domain was stressed. Mixed-mode 2

circuits often include a wide diversity of components that exhibit widely differing constants. This makes the problem of numerical stability versus simulation run even more critical. With the explicit numerical integration routines, like the trapezoidal routine, numerical instability results if the simulation step becomes much larger than the smallest constant in a circuit. Hence, to achieve successful completion of a simulation the integration step must be reduced which in turn makes the overall simulation increase significantly. The implicit Gear algorithm 5 does not suffer from this problem and is the natural choice for circuits with components that have widely differing constants. Example : Analogue waveform driven digital devices with output nodebridge. The circuit in Fig. 9 shows an analogue voltage source driving a digital inverter with a node-bridge element processing the inverter output signal. The input signal is a sinusoidal voltage of amplitude V peak. The inverter output signal, V in Fig. 9, has an nonsymmetrical mark to space ratio because the threshold point for the inverter is set at.5v; the halfway point for the two logic levels. The node-bridge element is basically a voltage controlled voltage source where the device gain and delay can be programmed. In this first example the gain has been set to 5 and the delay to.5ns. Figure 2 illustrates the simulation TimeList waveforms for this example mixed-mode circuit. The node-bridge shown in Fig. 9 is a very basic device. Moreover, by adding additional features, parameters like fall and rise can set to specific values. The next example demonstrates the use of an active node-bridge. 5 The Gear integration algorithm is a powerful method for solving stiff systems of differential equations, see Donald A. Calahan, Computer Aided Network Design, Revised edition, 972, McGraw-Hill. 22

transient simulation TR Type=lin Start= Stop=2us IntegrationMethod=Gear Order=6 V U= V Vin V V5D Y VINP VINN D to A Node Bridge VOUTP VOUTN SUB File=a_node_bridge.sch Figure 9: Analogue waveform driven digital device with output node-bridge Vin.Vt 2e-6 4e-6 6e-6 8e-6 e-5.2e-5.4e-5.6e-5.8e-5 2e-5 V.Vt V5D.Vt 2e-6 4e-6 6e-6 8e-6 e-5.2e-5.4e-5.6e-5.8e-5 2e-5 5 2e-6 4e-6 6e-6 8e-6 e-5.2e-5.4e-5.6e-5.8e-5 2e-5 Figure 2: Digital TimeList waveforms for the circuit shown in Fig. 9 23

Example 2: Pulse driven digital inverter with an active node bridge. Illustrated in Fig. 2 is a similar circuit to the previous example. In Fig. 2 a pulse generator drives a digital inverter. The inverter output signal is processed by an active node-bridge derived from a basic BJT switching amplifier. The output waveforms for this circuit are shown in Fig. 22. Notice that the pulse rise and fall s are determined by the node-bridge amplifier and that the resulting analogue signal amplitude is set to 5V. transient simulation TR Type=lin Start= Stop=3ns IntegrationMethod=Gear Order=6 R2 R=4.7 k Ohm VC V2 U=5 V VPIN V3 U= V Y U2= V T=5ns T2=2ns V R R=k Ohm VB T Type=npn Is=e-6 Nf= Vaf= Bf= C C=. pf Figure 2: Pulse driven digital inverter with active node-bridge 24

VPIN.Vt V.Vt 2e-9 4e-9 6e-9 8e-9 e-8.2e-8.4e-8.6e-8.8e-8 2e-8 2.2e-8 2.4e-8 2.6e-8 2.8e-8 3e-8 2e-9 4e-9 6e-9 8e-9 e-8.2e-8.4e-8.6e-8.8e-8 2e-8 2.2e-8 2.4e-8 2.6e-8 2.8e-8 3e-8 VB.Vt 6 2e-9 4e-9 6e-9 8e-9 e-8.2e-8.4e-8.6e-8.8e-8 2e-8 2.2e-8 2.4e-8 2.6e-8 2.8e-8 3e-8 VC.Vt 4 2 2e-9 4e-9 6e-9 8e-9 e-8.2e-8.4e-8.6e-8.8e-8 2e-8 2.2e-8 2.4e-8 2.6e-8 2.8e-8 3e-8 Figure 22: Digital TimeList waveforms for the circuit shown in Fig. 2 Example 3: A more complex mixed-mode simulation example. The circuit shown in Fig. 23 brings together a number of the ideas outlined in these tutorial notes. A 4-bit digital signal is generated from a simple asynchronous binary counter operated from a digital clock signal. The counter output is transformed to the analogue domain using a simple node-bridge, of the type introduced in mixed-mode example. A 4-bit binary weighted DAC converts the transformed node-bridge signals into the final analogue output signal. The DAC operational amplifier is modelled as a gain block with a single pole frequency response and DC voltage output limiting. The output waveforms for this example are shown in Fig. 24 and the details of the operational amplifier model in Fig. 25. 25

S SUB5 Num= File=tff.sch CLOCK R S T SUB9 File=Logic_one.sch B VINP VOUTP SUB6 File=tff.sch R S T VINN D to A Node Bridge VOUTN R R=k Ohm A_VOUT B VINP SUB File=a_node_bridge.sch VOUTP R2 R=k Ohm SUB4 File=spole_op_amp.sch SUB7 File=tff.sch R S T VINN D to A Node Bridge VOUTN R R=5k Ohm V- V U=8 V B2 SUB File=a_node_bridge.sch VINP VOUTP + V+ V2 U=8 V SUB8 File=tff.sch S2 Num=2 RESET R S T B3 VINN D to A Node Bridge VOUTN R4 R=2.5k SUB2 File=a_node_bridge.sch VINP D to A Node Bridge VOUTP R5 R=.25k Ohm transient simulation TR Type=lin Start= Stop=4 m IntegrationMethod=Gear Order=6 VINN VOUTN SUB3 File=a_node_bridge.sch Figure 23: A more complex analogue-digital mixed-mode simulation example 26

RESET.Vt CLOCK.Vt B.Vt.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4 B.Vt.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4 B2.Vt.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4 A_VOUT.Vt B3.Vt.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4-2.2.4.6.8..2.4.6.8.2.22.24.26.28.3.32.34.36.38.4 Figure 24: Digital TimeList waveforms for the circuit shown in Fig. 23 27

VDCP Num=4 D Is=e-5 A N= Cj= ff M=.5 Vj=.7 V R5 R=5 Ohm VOUT Num=3 VINP Num= R R=2k Ohm R4 R=k Ohm C C=3.2uF R3 R=5 Ohm R6 R=5 Ohm VINN Num=2 SRC2 G=2k T= SRC G= T= D2 Is=e-5 A N= Cj= ff M=.5 Vj=.7 V VDCN Num=5 Figure 25: Operational amplifier model with Rin = 2k Ω, pole frequency = 5Hz, DC differential gain = 2k and Rout = 5 Ω 28

End Note The examples described in these notes were all simulated using the latest CVS code version of ucs. Since release of version..8, ucs has matured enough to allow it to be used for mixed-mode simulation and many of the known bugs in ucs..8 will be corrected with the release of ucs..9 some in the future. Release..9 will represent another important step in the development of a truly universal simulator. However, much more work needs to be done on the development of models for use across the different physical domains. My thanks to Michael Margraf and Stefan Jahn for all their hard work in correcting the bugs which surfaced while the examples presented in this tutorial note where being tested. 29