An extension to SystemC-A to support mixed-technology systems with distributed components

Chenxu Zhao and Tom J. Kazmierski School of Electronics and Computer Science University of Southampton, UK Email: cz05r,[email protected]

Abstract— This contribution proposes syntax extensions to VHDL-AMSP) has been presented [10]. Pending the develop- SystemC-A that support mixed-technology system modelling ment of a new standard, a preprocessor has been developed to where components might exhibit distributed behaviour modelled convert VHDL-AMSP into the existing VHDL-AMS 1076.1 by partial differential equations. The important need for such extensions arises from the well known modelling difficulties in standard automatically which can be simulated using currently hardware description languages where complex electronics in a available simulators. In this paper, we propose the first full mixed-technology system interfaces with distributed components implementation of the PDE extension to SystemC-A where from different physical domains, e.g. mechanical, magnetic or no preprocessor is required. thermal. A digital MEMS accelerometer with distributed me- The proposed extension has particular advantages in mixed chanical sensing element is used as a case study to illustrate modelling capabilities offered by the proposed extended syntax physical technology systems that exhibit distributed physical of SystemC-A. effects. For example, electromechanical Sigma-Delta MEMS sensor designs, e.g. accelerometers and gyroscopes, which I.INTRODUCTION are based on incorporation of mechanical sensing elements into Σ∆ modulator control loops, have attracted great re- SystemC-A [1] is a superset of SystemC intended to extend search interest [12]. The mechanical sensing element, which is the modelling capabilities of SystemC [2] to the analogue usually modeled by the lumped mass-spring-damper model(a domain. It provides constructs to support user defined ordinary second order ODE), is also a part of the loop filter in these differential and algebraic equations(ODAEs), and analogue systems. However, the lumped model only can capture the components to enable modelling of analogue, mixed-signal first resonant mode which is not accurate enough as higher and mixed-domain systems from high level of abstraction order mechanical resonant modes may significantly affect down to the circuit level. Most powerful features of VHDL- the performance and stability of the Σ∆ control loop [6]. AMS [3] and -AMS [4] are provided in SystemC-A Consequently, it is necessary to improve the accuracy of in addition to a number of extra advantages such as high the mechanical model and use partial rather than ordinary simulation speed, support for hardware-software co-design and differential equations. In section III the case study of a MEMS high levels of modeling [1]. SystemC-A is used to model accelerometer embdedded in a Σ∆ control loop is modelled mixed-signal and mixed-physical domain systems such as in the extended SystemC-A to demonstrate the efficiency of automotive seating vibration isolation system [1] and ferro- the new syntax. The accelerometer uses distributed sensing magnetic hysteresis [5]. elements. Although major AMS HDLs such as SystemC-A and VHDL-AMS are very powerful and flexible mixed physical II.SYSTEMC-A SYNTAX EXTENSION AND domain modeling tools, they face a challenge in modelling IMPLEMENTATION mixed-technology microsystem applications such as energy This section describes the new syntax of SystemC-A with harvesting systems and MEMS sensors. This is because current which users can define PDEs. HDLs only support ODAEs modelling. This limits accurate The abstract base class for PDEs is derived from the modelling of systems with distributed effects (mechanical [6], existing SystemC-A abstract base class sc a component. Both electromagnetic(EM) [7], thermal [8], [9], etc.) which can PDEs and their boundary conditions are generated from the not be neglected and may even play vital roles. Thus an new abstract base classes sc a PDE base in the proposed implementation of PDEs in major HDLs is in demand. Some extension. This new abstract base class also inherits the virtual attempts have already been made to implement PDEs within build method which is invoked by the SystemC-A analogue the existing limits of major AMS-HDLs [10], [11], [8]. Among kernel at each time step to build the system matrix from them, a proposal for syntax extension for VHDL-AMS(named contributions of all the components. A sample component class hierarchy with PDE extension is shown in Fig.1. The 978-3-9810801-7-9/DATE11/⃝c 2011 EDAA mechanical component in this example includes user defined Abstract component base class

sc_a_component ......

Circuit level User defined

components component

......

Voltage Mechanical sc_a_capacitor sc_a_resistor Compensator Loop filter sources model

......

Abstract PDE base class PDEs with boundary sc_a_voltageS_square sc_a_voltageS_sin sc_a_PDE_base conditions for mechanics ......

Fig. 1. SystemC-A component hierarchy with PDE extensions.

PDEs and associated boundary conditions which are derived A. Spatial Coordinate and Partial Quantity from the PDE base class. Currently, in SystemC-A, three types of analogue system A finite difference approach is used to discretize the PDEs variables ( node, flow, quantity), which are derived from an with respect to spatial variables and leave the time derivatives abstract base class called sc a system variable, are defined. In unchanged. Consequently, PDEs are converted to a series the proposed PDEs extension, a new type of system variable of ODEs which can be handled by the existing SystemC-A (Partial Quantity), which is also derived from the abstract base analogue solver. The modelling flow in SystemC-A with PDE class, is defined as illustrated in Fig.3. extensions is shown in the Fig.2. The method PDE coordinate Declaration() is used for The following example of a simple one dimensional PDE partial quantity definition and spatial coordinate declaration. demonstrates the new syntax: Multiple coordinate declarations will form a hypercube in the ∂Q(x, t) ∂Q(x, t) multi-dimensional space. As shown in the example code, the + A = B (1) spatial coordinate ”x” with the range R is divided into N node ∂x ∂t segments and the partial quantity ”Q” is discretized and Let the boundary condition be: defined inside the function in array format and discretization ∂M+N Q(x, t) = C; (2) step size dx(R/N node) is returned. ∂xM ∂tN The method PDE Quantity() is used to where Q(x, t) is the partial quantity of interest, A is the read a value of a particular partial quantity. For parameter, B is the excitation, C is the right hand side value example,PDE Quantity(”Q”, x) returns the value of of the boundary condition equation, x is a spatial variable and Partial Quantity Q at node x. This function’s counterpart t is time. The boundary condition is defined in Eq.2. in SystemC-A is X() which reads the value of a quantity. The extended SystemC-A code for this example is: Similar to the differentiator (Xdot()) and integrator (INTEG()) operators which can be performed on ordinary sc a PDE example :: sc a PDE example { quantities, the new methods (PDE Quantity dot() and sc a PDE base ( "PDE_example"){ PDE Quantity INIEG()) allow performing these two PDE C o o r d i n a t e Declaration( "Q" ,"x" ,R, operators on partial quantities. N node , dx ) ; } B. Partial Derivatives } If ”Q” is a partial quantity, the function Pdx(N,”Q”,x) repre- void sc a PDE example :: Build { sents the derivative of ”Q” with respect to spatial coordinative Pdxdt Boundary(M,N, "Q" , x , C ) ; at position x. N is an integral number which represents the f o r ( x =1; x<=N node ; x ++) derivative order. For example, Pdx(4,”Q”,x) represents the 4th { 4 order partial derivative ∂ Q . A partial quantity can also have a PDE( x,−Pdx ( 1 , "Q" , x)−A∗ Pdt ( 1 , "Q" , x )+B ) ; ∂x4 } derivative with respect to time, using the attribute dt, so item 5 } ∂Q Pdxdt(3,2,”Q”,x) represents ∂3x∂2t . Start above, M and N determine the order of derivative with respect to coordinate x and time t, x is the specified position Initialization phase where the conditions should apply and C is the right hand side value of the boundary condition equation. As an example, Start Simulation P dxdt Boundary(1, 0, ”Q”, 100.0, 0.0) represents the first sc_strat() order derivative of Q at the user specified spatial boundary (x=100.0) is equal to 0.0.

Initialize Newton iteration D. PDE Formulation Method Function PDE() realizes the automatic equation formulation Scan component and PDE list to build of the PDEs to be modelled. This function is required to be J & RHS implemented in a ”for” loop and the number of loops deter- mined by the number of segments(N node). After providing D Solve J x=RHS using LU method the RHS vector will be provided in the 2nd term of the PDE() function, Jacobian matrix will be automated generated using Update solution a secant finite difference approximation which is defined in D Xn=Xn-1+ X terms of system RHS(fi(xj)) and a scalar ∆x:

No ∂f f (x + ∆x ) − f (x ) Convergence? J = i = i j j i j (3) ij ∂x ∆x Yes j j Threshold No Finally, the function matrix is solved in the embedded crocessing? No Yes SystemC-A analog solver. Next event time? III.EXAMPLE:DISTRIBUTED MEMS ACCELEROMETER * WITH Σ∆ CONTROLLOOP

Digital Process ...... Digital Process A single axis lateral capacitive MEMS accelerometer with a Σ∆ control loop is used as an example to illustrate the SystemC-A syntax extension. Fig.4 shows the block diagram Yes Analog Delta cycle? of this system.

No Input acceleration Accept present time point and update Sampling frequency fs solution Sensing Buffer Compensator -Vm(t) element Output +Vm(t) bitstream Quantizer Calculate next time point Vf1 Vf

No Vf2 Vf 1-bit t>T DAC

Yes Fig. 4. 2nd order electromechanical Sigma-Delta accelerometer End Conventionally, the mechanical sensing element is used as Fig. 2. Simulation cycle with PDE modelling in extended SystemC-A. a loop filter to form the 2nd order electromechanical Σ∆ Abstract base class accelerometer. The mechanical part of a lateral capacitive

sc_a_system_variable MEMS accelerometer(Fig.5) is composed of a proof mass, ...... springs and comb fingers. In the lateral capacitive structure, the proof mass is suspended by springs and it is equipped with sc_a_node quantity sc_a_flow Partial quantity sense and force comb fingers which are placed between fixed ...... fingers to form a capacitive bridge. The sense fingers moves with the proof mass resulting in a differential imbalance in capacitance which is measured. The electrostatic force acting Fig. 3. Analogue system variables on the force fingers is used as the feedback signal to pull the proof mass in the desired direction. C. Boundary Conditions Like most conventional modelling approached, the sensing Boundary condition are declared by method element dynamics in the sense-direction is normally modeled P dxdt Boundary(). As shown in the example code to reflect only one resonant mode by a lumped mass, spring, Proof mass where ε is the permittivity of the gap, d0 is the initial gap between the sense finger and the electrode and Vm(t) is the high frequency carrier voltage. Sense and feedback The boundary conditions at the clamped end and the free force comb drives end are shown in the following equations: At the clamped end (x=0): Spring y(0, t) = z(t) (7) Fixed electrode ∂y(0, t) θ = = 0 (8) Proof mass Sense fingers ∂x At free end (x=l): Fixed electrode Distributed capacitances ∂2y(l, t) M = − = 0 (9) ∂x2 Fig. 5. Mechanical sensing element ∂3y(l, t) Q = − = 0 (10) ∂x3 and damper. which is represented by a simple 2nd order where θ, M and Q denote the slope angle, the bending ordinary differential equation: moment and the shear force respectively, l is the length of the finger. d2y(t) dy(t) The clamped end of the sense fingers moves with the M + D + Ky(t) = Ma (t) + F (t) (4) dt2 dt in feedback lumped proof mass whose deflection z(t) could be modelled by a 2nd order differential equation Eq.(4). where M is the total mass of the structure, D and M are The total distributed sense capacitance between the sense damping and spring coefficients. ain(t) is the input accelera- fingers and electrodes is: tion and Ffeedback(t) is the feedback force. ∫ Distributed mechanical modeling is important in such Lf 1 C1(t) = NsεT − dx (11) MEMS designs with digital control because the dynamics 0 d0 y(x, t) of mechanical components may severely affect the system’s ∫ L performance. It has been well documented that sense fingers in f 1 C2(t) = NsεT dx (12) lateral capacitive accelerometers may vibrate due to their own 0 d0 + y(x, t) dynamics, thus rendering the feedback excitation ineffective, Where Ns is the number of sense fingers. The output voltage causing an incorrect output and a failure of the system [6]. This can be calculated as: failure scenario cannot be modeled by the conventional mass- damper-spring model 2nd order ordinary differential equation. C1 − C2 Vout(t) = Vm(t) (13) The motion of the sense beam can be modeled by the C1 + C2 following partial differential equation (PDE): Where Vm(t) is high frequency carrier voltage applied on ∂2y(x, t) ∂5y(x, t) ∂4y(x, t) the fixed electrode in comb fingers unit. ρS + C I + EI = F (x, t) (5) ∂t2 D ∂x4∂t ∂x4 e A. SystemC-A Code for mechanical sensing element where y(x, t) , a function of time and position, represents The SystemC-A model of the mechanical sensing element the beam deflection, E, I, Cd, ρ, S are physical properties of present below provides an example of how the PDEs discussed the beam: ρ is the material density, S is the cross sectional above are implemented. area (Wf ∗T ), where Wf and T are width and thickness of the PDE sensing :: PDE sensing ( c h a r nameC [ 5 ] , beam), E is Young’s modulus and I is the second moment of s c s i g n a l ∗Output , s c s i g n a l ∗i n p u t , 3 s c s i g n a l ∗feedback , sc s i g n a l ∗Vm){ area which could be calculated as I = TWf /12 and CD is the internal damping modulus. The product EI is usually regarded sc a PDE base ( "sensing"){ as the stiffness . Feedback force is acting on the proof mass, so PDE C o o r d i n a t e Declaration( "Y" ,"x" ,100 e −6 ,10 , dx ) ; Deflection=Output; the sense finger is only deformed by distributed electrostatic a i n s i g = i n p u t ; force and input acceleration. Fe(x, t) in the equation is the f e e d b a c k sig=feedback; electrostatic force per unit length: Vm sig=Vm; // Q u a n t i t i e s f o r lumped mass−damper−s p r i n g model 2 2 z[1] = new Quantity( "z1" ); 1 Vm(t) − Vm(t) z[2] = new Quantity( "z2" ); Fe(x, t) = εWf [ 2 2 ] (6) } 2 (d0 − y(x, t) ) (d0 + y(x, t) ) 0 0

-20 -20

-40 -40

-60 -60 PSD [dB] PSD [dB] -80 -80

-100 -100

-120 -120 2 3 4 2 3 4 10 10 10 10 10 10 Frequency [Hz] Frequency [Hz]

1 1

0.5 0.5 0 0

-0.5 -0.5

-1 -1

0.025 0.026 0.027 0.028 0.029 0.03 [G] acceleration Input 0.025 0.026 0.027 0.028 0.029 0.03 Time [s] Time [s]

()a Conventional model(L=190um) (b) Distributed model (L=190um)

Fig. 6. Failure of the Sigma-Delta control is captured by the distributed model

} Pdxdt Boundary(1,0,0,0); Pdxdt Boundary(2,0,100e −6 ,0); void PDE sensing:: build( void ){ Pdxdt Boundary(3,0,100e −6 ,0);

// P a r a m e t e r s of s e n s i n g elem ent // PDE f u n c t i o n mass =3.57 e −10; f o r ( x =1; xr e a d ( ) ; PDE( x , −1∗ro ∗A∗ Pdxdt ( 0 , 2 , "Y" , x)− f i n =mass∗ a i n ; c∗ Pdxdt ( 4 , 1 , "Y" , x)−E∗ I ∗Pdx ( 4 , "Y" , x ) + ( ( ep∗A2 ) / ( 2 ) ) ∗ (Vm∗Vm/ ( ( d0−Yn[ x ] ) // Get f e e d b a c k f o r c e ; ∗( d0−Yn[ x ])) −Vm∗Vm/(( d0+Yn[x]) ∗ ( d0 Ffeedback=feedback s i g −>r e a d ( ) ; +Yn[ x ] ) ) ) ; } // Get m o d u l a t i o n v o l t a g e Vm; Vm=Vm sig−>r e a d ( ) ; // Average d e f l e c t i o n of t h e s e n s e f i n g e r Y= 0 . 0 ; // D e f l e c t i o n of p r o o f mass (2 n o r d e r ODE) f o r ( x =1; xw r i t e (Y ) ; −( s p r i n g )∗ Zn[1]+fin+Ffeedback ); }

// Boundary c o n d i t i o n s Pdxdt Boundary(0,0,0,Zn[1]); B. Simulation results system’s performance. The efficiency of the new syntax has In this section, simulation results of the distributed model been verified by its application to an electromechanical Sigma- illustrate the distributed effects of the finger dynamics. The Delta accelerometer with distributed mechanical sensing ele- conventional model only contains the dynamics of the lumped ment where the finger dynamics are modeled using a PDE. proof mass as shown in Eq.(4). This means that the sense The well-known failure of the Sigma-Delta control system fingers and lumped mass move together and the sense fingers caused by the sense finger dynamics is correctly captured by do not bend. The frequency is approximately: the extended SystemC-A model while the conventional lumped √ model fails to reflect the true behaviour. K w = (14) REFERENCES 0 M [1] H. Al-Junaid and T. Kazmierski. Analogue and mixed-signal extension In reality, the sense fingers bend to the extent that the per- to systemc. IEE proc.-Circuit Devices Syst., 152(6):682–690, Dec. 2005. formance of the Sigma-Delta control loop might be seriously [2] ’Draft Standard SystemC AMS Extensions Language Reference Man- ual’. Technical report, Open SystemC Initiative (OSCI), 3 Dec. 2008. affected. The first two resonant frequencies of a sense finger [3] ‘IEEE Standard VHDL Analog and Mixed-Signal Extensions-Packages could be calculated as those of the cantilever beam [6]: for Multiple Energy Domain Support’. Technical report, Design Au- √ tomation Standards Committee of the IEEE Computer Society, 2005. ISBN: 0-7381-4645-5. 2 W E [4] Pecheux F., Lallement C., and Vachoux A. ‘VHDL-AMS and Verilog- ωi = α i = 1, 2 (15) i L2 12ρ AMS as alternative hardware description languages for efficient mod- eling of multidiscipline systems’. IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, 24(2):pp.204–225, 2005. α1 = 1.875 α2 = 4.694 (16) [5] Hessa Al-Junaid, Tom Kazmierski, Peter R. Wilson, and Jerzy Bara- nowski. Timeless discretization of magnetization slope in the modeling Where W and L is the width and length of the sense of ferromagnetic hysteresis. EEE Transactions on Computer-Aided fingers respectively. First and second resonant frequencies are Design of Integrated Circuits and Systems, 25:2757 – 2764, 2006. 31KHz and 209KHz respectively if the finger dimensions are: [6] Seeger J.I., Xuesong J., Kraft M., and Boser B.E. ‘Sense finger dynamics in a Σ∆ force feedback gyroscope’. Tech. Digest of Solid State Sensor L = 190µm, W = 1µm, T = 2µm. The effect of the sense and Actuator Workshop, Hilton Head Island, USA., pages pp.296–299, finger dynamics are illustrated in Fig.6 which shows the power Jun 2000. spectrum density (PSD) of the Sigma-Delta modulator output [7] D.A. White and M. Stowell. Full-wave simulation of electromagnetic coupling effects in rf and mixed-signal ics using a time-domain finite- bitstream and time-domain response when applying 200Hz element method. IEEE Trans. Microwave Theory Tech., 52(2):1404– sine wave input acceleration with 1G(9.8m/s2) amplitude 1413, 2004. and 217Hz oversampling frequency to both conventional and [8] E. Normark P.V. Nikitin and C.J.R. Shi. Distributed electrothermal modeling in -ams. International Workshop on Behavioral Modeling proposed distributed system. and Simulation, 2003. BMAS, pages 128–133, 2003. Here, the SystemC-A simulation carries out the time-domain [9] X. Huang and H.A. Mantooth. Event-driven electrothermal modelng of analysis and in the testbench performs a frequency domain mixed-signal circuits. International Workshop on Behavioral Modeling and Simulation, (BMAS), pages 10–15, 2000. FFT analysis to obtain PSD of the output bitstream. As shown [10] L. Wang, C.Zhao, and T.J.Kazmierski. An extension to vhdl-ams for in the Fig.6(b), the failure of the Sigma-Delta control system is ams systems with partial differential equations,. Forum on Specification captured by the distributed model while the Sigma-Delta con- & Design Languages Conference (FDL), 2007. [11] C.R. Shi P.V. Nikitin and B. Wan. Modeling partial differential equations trol loop still works in the conventional model (Fig6(a)). This in vhdl-ams,. In Systems-on- Chip Conference, 2003. Proceedings. IEEE is because the lumped model only contains one resonant mode International, pages 345–348, 2003. caused by the spring-mass-damper system and its frequency [12] Dong Y., Kraft M., Gollasch C., and Redman-White W. ‘A high- performance accelerometer with a fifth-order Sigma-Delta modulator’. response has no relationship with the dimensions of fingers. Journal of Micromechanics and Microengineering, 2:S22–S29, 2005. Thus, effects of the finger dynamics cannot be captured. In other word, this performance degradation of the Sigma-Delta control loop caused by finger dynamics cannot be modeled by lumped model.

IV. CONCLUSION This paper proposes a syntax extension to SystemC-A to provide support for PDE modelling. This is the first full implementation of PDE support in SystemC-A where no preprocessor is required for conversion of user defined PDEs to a series of ODAEs. The proposed PDE extension has particular advantages in modelling of mixed physical-domain systems, especially systems with mechanical parts which frequently exhibit distributed behaviour. Typical systems of this kind are MEMS sensors or kinetic energy harvesters. The distributed ef- fects present in such systems usually can not be neglected, may even play vital roles and be essential to predicting correctly the