Lecture 6. Simulator Architectural Design

27
2010-9-27 Slide 1 INTRODUCTION TO CIRCUIT SIMULATION INTRODUCTION TO CIRCUIT SIMULATION Lecture 6. Lecture 6. Simulator Architectural Design Simulator Architectural Design Guoyong Shi, PhD [email protected] School of Microelectronics Shanghai Jiao Tong University Spring 2010

Transcript of Lecture 6. Simulator Architectural Design

Page 1: Lecture 6. Simulator Architectural Design

2010-9-27 Slide 1

INTRODUCTION TO CIRCUIT SIMULATIONINTRODUCTION TO CIRCUIT SIMULATION

Lecture 6. Lecture 6. Simulator Architectural DesignSimulator Architectural Design

Guoyong Shi, [email protected]

School of MicroelectronicsShanghai Jiao Tong University

Spring 2010

Page 2: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 2

OutlineOutline• Basic constructs• Model & Device Classes• Device loading• Object-oriented programming• Model Compiler

Page 3: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 3

A Detailed Simulator FlowA Detailed Simulator Flow

NetlistParser

(Save all ckt infoto a symbol table;

Check circuit integrity;Report error, etc.)

Parser(Save all ckt info

to a symbol table;Check circuit integrity;

Report error, etc.)

Prepare for Analysis(Create void stamps

for all devices)

Run Analysis(Fill stamps according

to analysis type)

Run Analysis(Fill stamps according

to analysis type)

Save and Present

Simulation ResultGUIGUI

AlgorithmsAlgorithms

Higher-levelDescriptionLanguage

ModelsModels

Page 4: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 4

Node versus TerminalNode versus Terminal• “Node” is a circuit

attribute: Each node is connected to a list of devices.

• “Terminal” is a device attribute:

Each device has a list of terminals.

• A device terminalbecomes a circuit nodewhen it is connected in a circuit.

• Multiple device terminalsmay share the same node.

• Each device terminalidentifies a branch current.

kNode /

Terminal

Device

Device Device

Device

Page 5: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 5

Node versus DeviceNode versus Device

• Each Node Object manages a list of devices connected to it.

• Each Device Objectmanages a list of nodes as its terminals.

• Such information is directly used in the MNA matrix stamping.

knode

Device

DeviceDevice

Device

Page 6: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 6

ExampleExample

class DEVICE

class RES class INDclass CAP

R1

R2

R3

.

.

C1

C2

C3

.

.

L1

L2

L3

.

.Instances Instances

Page 7: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 7

Simulator ConstructionSimulator Construction• The simulator should manage the following lists:

List of modelsList of devicesList of analyses analysis[0]

analysis[1]analysis[3]analysis[4]analysis[5]analysis[6]analysis[7]analysis[8]

analysis type

device[0]device[1]device[3]device[4]device[5]device[6]

device type

model[0]model[1]model[3]model[4]model[5]model[6]

model type

mod_inst[0]

mod_inst[2]

mod_inst[1]

device[0]device[1]device[3]device[4]device[5]device[6]

device type

device[0]device[1]device[3]device[4]device[5]device[6]

device type

Page 8: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 8

Model & Device ClassesModel & Device ClassesModelModel

Model_Res

Model_MOS3Model_MOS1

Model_Vsrc

Model_Ind

Model_Isrc

Model_Cap

Model_MOS2

DeviceDevice

Res

MOS3MOS1

Vsrc

Ind

Isrc

Cap

MOS2

······

······

MOSMOSJust need one class for MOS device

Multiple MOS models

Page 9: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 9

Device InstancesDevice Instances• Device instances are divided into two

categories:1. Instances without models2. Instances with models

These two types of instances are managed by the Circuit Object.

Page 10: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 10

Device Instances without ModelDevice Instances without Model

Device instances without models

D_type[0]D_type[1]D_type[3]D_type[4]D_type[5]D_type[6]D_type[7]D_type[8]

Device type

Managed by the Circuit object

CapRes Res

IndInd

Spice takes a model-driven device instantiating strategy.

Spice creates a default model for the same type devices without a model.

This means all device instances have models.

Page 11: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 11

Device Instances with ModelDevice Instances with ModelModelModel

Model_ResModel_Res

Model_MOS3Model_MOS1

Model_Vsrc

Model_Ind

Model_Isrc

Model_Cap

Model_MOS2

······

Model instances

Model_Res_Inst_1Model_Res_Inst_1

Model_Res_Inst_2Model_Res_Inst_2

Model_Res_Inst_3Model_Res_Inst_3

ResRes

Res

Res Res

Device instances with models

Model_BSIM1 Model_BSIM3

Page 12: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 12

Links among Models & Devices Links among Models & Devices

device[0]device[1]device[3]device[4]device[5]device[6]

device type

model[0]model[1]model[3]model[4]model[5]model[6]

model type

mod_inst[0]

mod_inst[2]

mod_inst[1]

device[0]device[1]device[3]device[4]device[5]device[6]

device type

device[0]device[1]device[3]device[4]device[5]device[6]

device type

Includingdefaultdefaultmodels

Page 13: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 13

ModelModel--based Device Instancesbased Device Instances• If a device does not have a model, a default model is

created for it.• The same type devices without model share the same

default model.• The parameters for a default model are not assigned.• Spice uses XXXtemp() function to evaluate the stamp,

which uses the temperature information.If a default model, the model parameters are not used at all. Only the lumped parameter given in the netlist is used for evaluation.

Page 14: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 14

Analysis ClassesAnalysis Classes

analysis[0]analysis[1]analysis[3]analysis[4]analysis[5]analysis[6]analysis[7]analysis[8]

analysis type

AnalysisAnalysis

Analysis_DC

Analysis_NoiseAnalysis_OP

Analysis_Disto

Analysis_Tran

Analysis_Sens

Analysis_AC

Analysis_PZ

arranged in listarranged in list

Page 15: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 15

Models and Devices Models and Devices • A netlist may have a list of devices (identified by

device types)• Each type of device may have a list of models• Each device model may have a list of instances

* This data structure will be used during circuit loading!

cktckt M_type[0]M_type[0] M_type[1]M_type[1] M_type[typeM_type[type]]

M_instM_inst--00

M_inst-1

M_inst-2

D_inst_0D_inst_0

D_inst_1D_inst_1

D_inst_2D_inst_2 D_inst_0D_inst_0

D_inst_1D_inst_1D_inst_0D_inst_0

M_inst_0M_inst_0

M_inst_1

M_inst_2

Page 16: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 16

Referencing Model and InstancesReferencing Model and Instances• Each model instance may be linked with a list of

device instances.• Each device instance has a back pointer pointing at

the belonging model instance.

MODELMODEL

dev instdev inst--11 dev instdev inst--22 dev instdev inst--kk......

* One model supports multiple devices.

back link

Page 17: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 17

Device LoadingDevice Loading

cktckt mod type[0] mod type[1] mod type[K ]

mod instmod inst--00dev inst-0

dev inst-1

dev inst-2 dev inst-0dev inst-1

dev inst-0Each instant is a

physicaldevice in circuit.

* This whole structure is scanned during device loading.

mod instmod inst--11

mod instmod inst--22

mod instmod inst--00

mod instmod inst--11

mod instmod inst--22

dev inst-0dev inst-1

dev inst-2 dev inst-0dev inst-1

dev inst-0

Page 18: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 18

Device ModelsDevice Models• Semiconductor devices are described by a

set of analytical equations.• One model may take several hundreds of

pages (BSIM3/4).• Can be written in description language –

Verilog-AMS.• Have to be translated into C/C++ code.

Page 19: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 19

Typical Modeling FlowTypical Modeling Flow

VendorB

VendorD

VendorC

DeviceModel

DeveloperDesigner

Foundry

VendorA

VendorE

Model Parameter Extraction New Effect Found

New Effect Found

Repeat...

Repeat...

Independent implementations

Verified Design

Page 20: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 20

Model ImplementationModel Implementation• Refer to C implementation of model equations;

including derivative computations (Jacobian matrix, ...)• Model implementation is more difficult, time

consuming and error-prone than model creation (writing math eqns).

• Simulator vendors have to develop their own implementations (IP issues)

• Model implementation is also costly.

• Designers have less control over models.• Designers may identify flaws in models while

using simulators.

Page 21: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 21

Designers Want ...Designers Want ...• Accurate and robust models.• Models covering all cases likely to appear in

real design.• Models that can be simulated efficiently.

• Sometimes want to modify the model equations in their own favor ...

Page 22: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 22

Model Compiler Can Help !Model Compiler Can Help !A Model Compiler is a CAD tool that supports automatic

implementation of compact device model.

Model CompilerInput in Compact

Description

Output (ready for simulator)

1. Input: compact device models in a description language -Verilog-AMS

2. Output: device code in C/C++ that can be directly compiled in Spice-like simulators.

Page 23: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 23

Convert to C code

Device Model Implementation Flow Device Model Implementation Flow New device & Equations

Initial coding in MATLAB

Purchase by design company & qualification

Release new simulator

Designers use new models

Install & test model in simulator

Update new effectsUpdate new effects

Model Compiler

New modificationNew modification

Page 24: Lecture 6. Simulator Architectural Design

2010-9-27 Slide 24

INTRODUCTION TO CIRCUIT SIMULATIONINTRODUCTION TO CIRCUIT SIMULATION

APPENDIX APPENDIX ----ObjectObject--Oriented ProgrammingOriented Programming

Page 25: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 25

ObjectObject--Oriented ProgrammingOriented Programming• Data and functions associated with the same

object are collected in one classSo-called “encapsulation”Provides modularity of code.

Page 26: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 26

Use PolymorphismUse Polymorphism• Define object interface in the base classes

using virtual functions in C++ for polymorphism.

• Implementation of objects defined in the derived classes.

• Better code readability / flexibility, and • Easier code management.

• Polymorphism is very suitable for model interfacing and device methods.

Page 27: Lecture 6. Simulator Architectural Design

2010-9-27 Lecture 06 slide 27

Modular DevelopmentModular Development• Make the numerical methods, modeling, and

analysis independent from each other as much as possible.

• Make the Solver Module independent of the analysis algorithms; so that it is easier to update the solver.

• Make device models Independent of the simulator analysis engine;