Pieter J. Mosterman Senior Research Scientist The MathWorks, Inc. © 2005 The MathWorks, Inc. Advanced Technologies to Accelerate Mixed Signal Simulation Agenda Introduction What is Link for ModelSim? Demo Mixed Signal Simulation Summary 2 What is the problem? “Hardware verification is itself become more challenging. Verification times have increased with rising gate count and as overall design complexity grows. According to a survey by Collett International Research in 2002 only 39% of designs were bug free at first silicon, while 60% contained logic or functional flaws. More than 20% required 3 or more silicon spins. A Collett survey also showed that nearly 50% of total engineering time was spent in verification.” Hardware/Software Co-verification by Dr. Jack Horgan http://www.edacafe.com/magazine/index.php?newsletter=1&run_date=29-Mar-2004 3 What are the pains? 1. Time and effort to verify a design: As designs get more complex, the test benches are an order of magnitude more complex, and consume 40-60% of project resources. Test bench HDL code will *not* be synthesized – i.e., will not be a part of the shipping product – “throwaway” code HDL test benches need to run in HDL simulators, and HDL simulators are *extremely* slow 2. Time and effort to construct and maintain test benches: For each line of HDL design code in a design, a user typically needs 10 lines of HDL test bench code to simulate, test, and verify that 1 line of HDL code. Constructing a test bench in a textual language is at least as complex as the original design itself Maintaining the test bench from one generation of a design to the next is very resource-intensive 4 What are the pains? Solutions? Engineers need to verify that ASIC/FPGA implementations correctly match their system specifications. y=f(x) Link Using the Link for ModelSim, these engineers can co-simulate their MATLAB and Simulink designs with equivalent Verilog and VHDL. 5 Agenda Introduction What is Link for ModelSim? Demo Mixed Signal Simulation Summary 6 Link for ModelSim makes system-level hardware verification possible. Fast and bidirectional cosimulation interface between MATLAB and Simulink, and ModelSim 7 Agenda Introduction What is Link for ModelSim? Demo Mixed Signal Simulation Summary 8 Demo Live MATLAB Demo Edge detection demo – Design space exploration using floating point – Conversion to fixed point – Co-simulate with HDL 9 Link for ModelSim allows engineers to share models instead of I/O vectors. The HDL is verified in the context of an entire system and not just as a stand-alone component. System performance metrics, e.g. PER, BER, S/N ratio can be measured. 10 Agenda Introduction What is Link for ModelSim? Demo Mixed Signal Simulation Summary 11 Hybrid Dynamic Systems Two types of behavior – Continuous – Discrete An embedded controller – Plant • • – Continuous-time behavior Sporadic discrete events Controller • • Discrete-time behavior Frequent periodic events 12 Executing a Hybrid Dynamic System Integrate continuous behavior x f ( x, u, t ) Discrete event behavior – Time events • Pre-determined time of occurrence tn nextEventTime() – State events • When a model variable exceeds a threshold g ( x, u , t ) 0 13 How to handle a discrete event Time-driven – Time integrated • • – Sampled time • • Integrate up till event time Inefficient for time events Run scheduler at lowest rate Inefficient for widely spaced events Event-driven – Jump to event time immediately – Does not apply to state events 14 Where do these paradigms apply? Discrete event intensive models – Controller area network (CAN) in automobiles Many events that do not affect continuous behavior Expensive to stop the numerical solver for each of these window dc motor current measurement lights controller roof controller window controller 15 Efficiency Two separate solvers – Time-driven solver • Numerical solver integrates time (step h) k1 hf ( xn , yn ) h k k3 hf ( xn , yn 2 ) 2 2 h k k 2 hf ( xn , yn 1 ) k 4 hf ( xn h, yn k3 ) 2 2 k k k k yn 1 yn 1 2 3 4 O (h 5 ) 6 3 3 6 • – Sampled time event schedule (time up to which to integrate) Event-driven solver • Event calendar 20 [ms] open_tonneau 2020 [ms] move_roof_up_cmd 2150 [ms] move_down_window 2250 [ms] stop_moving_window 16 Event-driven leads time event state event Continuous Time: This sets an event in the event-driven solver This sets a time-event in the time-driven solver This event never occurs, but it is already processed! Scheduled Events: Processed Events: 17 Time-driven leads This event never occurs, but it is already processed! time event state event Continuous Time: This sets a time-event in the time-driven solver This sets an event in the event-driven solver Scheduled Events: Processed Events: 18 Questions Can we restrict the modeling constructs that are allowed? – For example, no state events allowed to trigger events in the event-driven solver What inaccuracy is acceptable? – Not do zero-crossing detection – Run event-driven part at a quick base rate What efficiency is necessary? – Lock step approach – Use one solver all together? • – Other techniques? • Do you lose the ability to handle a batch of discrete events independently? Model differently What is the preferred configuration? – Time-driven leads, store continuous-time state – Event-driven leads, store discrete event state – Alternatives? 19 Agenda Introduction What is Link for ModelSim? Demo Mixed Signal Simulation Summary 20 Summary of key features Integrate system level design with implementation No duplication of testbench design effort Verification of system level properties Advanced Simulation Technologies Are Required 21