SPICE Code Strcture Application Interface of SPICE engine

 ISSN: 1693-6930 TELKOMNIKA Vol. 14, No. 1, March 2016 : 64 – 71 68 With this equivalent substitution, SPICE can develop the nodal equations and find the every node voltages for certain time. Then, SPICE would forward a time step and repeat the same procedure to find the voltages at that time, and so on till the last time. SPICE can set timestepdynamically to trade offsimulation accuracy and speed. If the change of current or voltage is rapid, SPICE would reduce its step to increase the precise of the simulation, and vice versa.

3. SPICE Code Strcture

The simplified block diagram of SPICE engine code structure can be shown in Figure 5, where seven Modules are included. 1 Command Parsing: The kernel of this block is comn structure, which includes the name of the commands and their corresponding functions. The program implemented an array of comn structure that defines the commands which SPICE can parse and its corresponding actions. Whenever a command was input, SPICE parses it and finds its match from the set of commands, and executes the corresponding action. 2 Circuit Description: The most important data structure of this block is CKT circuit structure, where contains the device type, simulation type, temperature, and node information, etc. 3 Sparse Matrix: This block defines SMP element structure to represent the non-zero items of sparse matrix where the items are stored with increasing order as they appear in the row or column of The matrix. 4 Numerical Computation: This block contains two typical numerical methods: Newton- Raphson iteration and numerical integration. In SPICE, they were used to transform the set of differential equations into a set of algebraic equations. Figure 5. Code Structure of SPICE engine 6 Device Block contains two structures, DEV mode land SPICE dev.DEV model lists the models of the device types used in given circuit and SPICE dev contains the complete information of every component in the circuit. 7 Interface: this block is designed to be a generalized and open structure, and used to communicate between the Front and end of simulation system.

4. Application Interface of SPICE engine

SPICE engine can be package to a number of independent code procedures with prescribed interface. In this way, a block can call certain package to complete given work according to the interface. In addition, any block can be maintained, updated , even rewritten independently. Basically, SPICE operates like this: 1 SPICE reads in a text circuit description file “.cir” extension called a netlist, and then sets the corresponding Parameters. 2 SPICE sets the simulation options and performed certain analysis type as given AC, Transient, DC, Noise, etc. by calling the interface of analysis procedure. Lets take transient time analysis for Linear Circuits as an example to investigate. SPICE would call fuctionDCTran first with the given circuit description. Inside this function, and device information would be found according to every device model. An operating point is TELKOMNIKA ISSN: 1693-6930  SPICE Engine Analysis and Circuit Simulation Application Development Bing Chen 69 required for the initial solution to a Transient Analysis. After the initial operating point was found, this function set the timestep and option parameter call the inner loop to solve the Nodal equation. The results is acquired from the sparse matrix and stored in the structure TRANan, where it can be print or draw by .PRINT or.PLOT command.

5. Experiments of using SPICE Engine