510 likes | 645 Views
ID 024C: Auto Code Generation: The Shortest Distance From Idea to Implementation. Christopher Myers. Director of Software Development. 12 October 2010. Version: 1.1. Christopher Myers cmyers@simuquest.com. Director of Software Development
E N D
ID 024C: Auto Code Generation: The Shortest Distance From Idea to Implementation Christopher Myers Director of Software Development 12 October 2010 Version: 1.1
Christopher Myers cmyers@simuquest.com • Director of Software Development • Responsible for designing and managing development of SimuQuest product lines • Lead Developer of QuantiPhi, a line of code generation tools that bring a hardware interface into the Simulink modeling environment. PREVIOUS EXPERIENCE: • Working in the area of model-based development using MATLAB / Simulink since 2003. • Production automotive and consumer electronics experience at Motorola since 2000. • Designed high-performance network appliances designed to provide unparalleled visibility into network usage while at Arbor Networks, Inc. • MS, BS from the University of Michigan
Renesas Technology and Solution Portfolio Microcontrollers& Microprocessors#1 Market shareworldwide * SolutionsforInnovation Analog andPower Devices#1 Market sharein low-voltageMOSFET** ASIC, ASSP& MemoryAdvanced and proven technologies * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis).
Renesas Technology and Solution Portfolio Microcontrollers& Microprocessors#1 Market shareworldwide * SolutionsforInnovation Analog andPower Devices#1 Market sharein low-voltageMOSFET** ASIC, ASSP& MemoryAdvanced and proven technologies * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis). 4
Microcontroller and Microprocessor Line-up • Up to 1200 DMIPS, 45, 65 & 90nm process • Video and audio processing on Linux • Server, Industrial & Automotive Superscalar, MMU, Multimedia • Up to 500 DMIPS, 150 & 90nm process • 600uA/MHz, 1.5 uA standby • Medical, Automotive & Industrial High Performance CPU, Low Power • Up to 165 DMIPS, 90nm process • 500uA/MHz, 2.5 uA standby • Ethernet, CAN, USB, Motor Control, TFT Display High Performance CPU, FPU, DSC • Legacy Cores • Next-generation migration to RX R32C H8S H8SX M16C General Purpose Ultra Low Power Embedded Security • Up to 25 DMIPS, 150nm process • 190 uA/MHz, 0.3uA standby • Application-specific integration • Up to 10 DMIPS, 130nm process • 350 uA/MHz, 1uA standby • Capacitive touch • Up to 25 DMIPS, 180, 90nm process • 1mA/MHz, 100uA standby • Crypto engine, Hardware security 5
Microcontroller and Microprocessor Line-up • Up to 1200 DMIPS, 45, 65 & 90nm process • Video and audio processing on Linux • Server, Industrial & Automotive Superscalar, MMU, Multimedia All Of Them! • Up to 500 DMIPS, 150 & 90nm process • 600uA/MHz, 1.5 uA standby • Medical, Automotive & Industrial High Performance CPU, Low Power • Up to 165 DMIPS, 90nm process • 500uA/MHz, 2.5 uA standby • Ethernet, CAN, USB, Motor Control, TFT Display High Performance CPU, FPU, DSC • Legacy Cores • Next-generation migration to RX R32C H8S H8SX M16C General Purpose Ultra Low Power Embedded Security • Up to 25 DMIPS, 150nm process • 190 uA/MHz, 0.3uA standby • Application-specific integration • Up to 10 DMIPS, 130nm process • 350 uA/MHz, 1uA standby • Capacitive touch • Up to 25 DMIPS, 180, 90nm process • 1mA/MHz, 100uA standby • Crypto engine, Hardware security 6
Innovation: Innovate Faster Innovate Faster!
Model-Based Design Model-Based Design and Automatic Code Generation is the future of embedded controls. SimuQuest believes that as companies across all industries realize the innovation advantage that it provides, it will play a part in the design of nearly all embedded systems worldwide.
Agenda • Introduction to modeling and auto-code • Examples of Simulink / Stateflow • Exploration of design concerns • Fixed-point vs. floating point • Integrating hand code with auto-code • Modeling an entire application: One-Touch code generation • Q&A
Agenda (in other words) • Make the case for modeling and auto-code • Show you what modeling and auto-code is all about • Show you just how far it can be taken • Answer questions
Key Takeaways • Models helps define requirements • Models can be auto-coded • You can use that C code flexibly • Auto-coding is powerful • Auto-coding saves you time
Auto-Code Generation: Why Controls Perspective Software Perspective Innovate Faster!
Modeling: A Software Perspective Controls Perspective Software Perspective
Typical Project Effort Time Delivery Kick-Off
Ideal Project Effort Time Delivery Kick-Off
Dollars and Cents Advantage SOFTWARE DEFECT COSTS
Or… Use Case 1 Use Case n Why Typical Approaches Don’t Work! Req 1.6.5.9.1.2.3 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut orci nulla. Aenean nulla metus, blandit eget blandit vitae, commodo sit amet metus. Mauris lacinia varius dui, quis dictum nisi aliquet vitae. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nisi nunc, blandit vitae porta vitae, faucibus sit amet neque… Still ambiguous! Not Executable!
Understand the system we’ll be interacting with. Model it. Develop executable models of system requirements Integrate early and often Bring pre-tested hardware drivers into the modeling environment Auto-generate code A Model-Based Approach
Modeling: A Controls Perspective Controls Perspective Software Perspective
Modeling: Auto-Coding Controls Perspective Software Perspective
Our Auto-Coding Toolbox MATLAB Base computing platform Simulink & Stateflow Modeling platform RTW Embedded Coder QuantiPhi Auto-code generation Provides MCU configuration and device drivers.
Feature Building Block: The Feature Determine a set point Compute value for an actuator Detect a fault Condition a user input triggers outputs inputs
An Example Feature Model [In Simulink]
What About Integrating the Code? New Concerns! Feature Data Types Target Variables File Naming Legacy Code
What About Integrating the Code? Feature Data Types Target Variables File Naming Legacy Code
C to Simulink Mappings C Types unsigned char unsigned char char unsigned short int short int unsigned long int long int float double Simulink Types boolean uint8 int8 uint16 int16 uint32 int32 single double + additional fixed-point types available
Data Types: Floating and Fixed Point float my_var = 3.57; float my_var = 3.57; FPU No FPU
Data Types: Floating and Fixed Point Value to represent: 3.57 float* 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 0 0 0 1 (0.5 + 0.0625) 3 . uint16 ufix16_En4 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 Artificial binary point uint16 ufix16_Sp01 3 57 Artificial decimal point (understood that number is 100x higher than real value) *IEEE754
Data Types (+Fixed Point) in Simulink [In Simulink]
Auto-Coding for Different-Sized Targets Feature Data Types Target Variables File Naming Legacy Code
More Control Over Generated Code Feature Data Types Target Variables File Naming Legacy Code
More Control Over Generated Code • Simple: Can control variable’s: • Placement in RAM / ROM • Class (const, volatile, etc) • Naming • Scope (global vs. local) • Advanced: Can control variable’s: • Declaration • Definition • Code needed to read • Code needed to write
More Control Over Generated Code (Cont’d) • Simple: Can control subsystem’s: • Name of the file containing its code • Name of the generated function • Advanced: Can control subsystem’s: • Placement in memory (near vs. far for example) • RAM / ROM variable placement in memory
Legacy Code Feature Data Types Target Variables File Naming Legacy Code
Feature Backed By Legacy Code Legacy Code triggers outputs inputs Step 2: Code Generation Behavior Step 1: Simulation Behavior [Go to Simulink]
Feature Typical Auto-Coding Methodologies Effort =
Feature 1 Feature n Typical Auto-Coding Methodologies “Application Layer” Effort =
Feature 1 Feature n Hardware Interface Typical Auto-Coding Methodologies Effort =
Feature 1 Feature n Hardware Interface The Next Step
pwm0 PA0 RPM Interfacing With Hardware A C B QuantiPhi
Hardware Abstraction Layer • Example of a digital debounce:
Another Hardware Abstraction Layer Example • Example of analog counts to engineering units:
A “One Touch” Example Using QuantiPhi [In Simulink]
Innovation: Innovate Faster Innovate Faster!
Related Lab 021L: Model Based Control Design and Auto Code Generation using the R8C [In Simulink]