A HW/SW Codesign Methodology based on UML



Similar documents
Application of UML in Real-Time Embedded Systems

Applying 4+1 View Architecture with UML 2. White Paper

Designing Real-Time and Embedded Systems with the COMET/UML method

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

How To Develop A Telelogic Harmony/Esw Project

Integrated Development of Distributed Real-Time Applications with Asynchronous Communication

RUP Design. Purpose of Analysis & Design. Analysis & Design Workflow. Define Candidate Architecture. Create Initial Architecture Sketch

Embedded/Real-Time Software Development with PathMATE and IBM Rational Systems Developer

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Weighted Total Mark. Weighted Exam Mark

Modeling a GPS Receiver Using SystemC

Medical Device Design: Shorten Prototype and Deployment Time with NI Tools. NI Technical Symposium 2008

UML for the C programming language.

High-Level Synthesis for FPGA Designs

Getting Embedded C Applications to Market Faster using the Model-Driven Development Technologies of Modeling, Simulation and Code Generation

Applying Use Cases to Microcontroller Code Development. Chris Gilbert Cypress Semiconductor

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

A SoC design flow based on UML 2.0 and SystemC

Chap 1. Introduction to Software Architecture

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

GEDAE TM - A Graphical Programming and Autocode Generation Tool for Signal Processor Applications

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Open Flow Controller and Switch Datasheet

From Control Loops to Software

Chapter 4 Software Lifecycle and Performance Analysis

An Easier Way for Cross-Platform Data Acquisition Application Development

Serial port interface for microcontroller embedded into integrated power meter

Model-Driven Software Development for Robotics: an overview

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

Designing a Home Alarm using the UML. And implementing it using C++ and VxWorks

AGIPD Interface Electronic Prototyping

An Approach to Software Architecture Description Using UML

Eli Levi Eli Levi holds B.Sc.EE from the Technion.Working as field application engineer for Systematics, Specializing in HDL design with MATLAB and

FPGA area allocation for parallel C applications

Component-Oriented Engineering

Chapter 10 Practical Database Design Methodology and Use of UML Diagrams

Linux Driver Devices. Why, When, Which, How?

What is a life cycle model?

Software Design Models, Tools & Processes *

Design a medical application for Android platform using model-driven development approach

Basic Unified Process: A Process for Small and Agile Projects

1. Introduction 1.1 Methodology

Masters of Science in Software & Information Systems

Frameworks of Process Improvement for Mobile Applications

Layered Approach to Development of OO War Game Models Using DEVS Framework

LogiCORE IP AXI Performance Monitor v2.00.a

To introduce software process models To describe three generic process models and when they may be used

International Workshop on Field Programmable Logic and Applications, FPL '99

Software Engineering Reference Framework

CGI-based applications for distributed embedded systems for monitoring temperature and humidity

Arbitration and Switching Between Bus Masters

Serial Communications

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Intel Data Direct I/O Technology (Intel DDIO): A Primer >

System Behaviour Analysis with UML and Ptolemy. Scope and goals

Oracle BI EE Implementation on Netezza. Prepared by SureShot Strategies, Inc.

Control 2004, University of Bath, UK, September 2004

9/14/ :38

PCI Express Overview. And, by the way, they need to do it in less time.

Universal Flash Storage: Mobilize Your Data

Design of a High Speed Communications Link Using Field Programmable Gate Arrays

Analysis of the Specifics for a Business Rules Engine Based Projects

Virtual Platforms Addressing challenges in telecom product development

Requirements engineering

A Software Development Platform for SOA

Operating Systems 4 th Class

Developing SOA solutions using IBM SOA Foundation

Kirsten Sinclair SyntheSys Systems Engineers

Visual Paradigm product adoption roadmap

System i and System p. Customer service, support, and troubleshooting

UML Modelling of Automated Business Processes with a Mapping to BPEL4WS

i. Node Y Represented by a block or part. SysML::Block,

(Refer Slide Time: 01:52)

Embedded Component Based Programming with DAVE 3

Development Methodologies

Contents. System Development Models and Methods. Design Abstraction and Views. Synthesis. Control/Data-Flow Models. System Synthesis Models

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

760 Veterans Circle, Warminster, PA Technical Proposal. Submitted by: ACT/Technico 760 Veterans Circle Warminster, PA

UML TUTORIALS THE USE CASE MODEL

Revel8or: Model Driven Capacity Planning Tool Suite

DB2 Application Development and Migration Tools

Freescale Semiconductor, I

Reconfigurable Architecture Requirements for Co-Designed Virtual Machines

ECU State Manager Module Development and Design for Automotive Platform Software Based on AUTOSAR 4.0

SQL Server 2008 Performance and Scale

How To Design An Information System

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

The Microsoft Windows Hypervisor High Level Architecture

Software Engineering. Software Processes. Based on Software Engineering, 7 th Edition by Ian Sommerville

Networking Remote-Controlled Moving Image Monitoring System

Multiprocessor System-on-Chip

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

µfup: A Software Development Process for Embedded Systems

SCADE System Technical Data Sheet. System Requirements Analysis. Technical Data Sheet SCADE System

UML basics: An introduction to the Unified Modeling Language

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Transcription:

A HW/SW Codesign Methodology based on UML How to apply a model based UML design for an embedded system By Senior Consultant Kim Bjerge (kim.bjerge@teknologisk.dk) Copyright 2008 Danish Technological Institute Preface... 2 UML 2.1 diagrams... 3 UML usage levels... 4 Getting started with UML... 5 Get training... 5 Select a methodology... 5 Select a UML development tool... 5 Start with a simple project... 5 A Model based HW/SW Codesign methodology... 6 System Analysis - Domain and Application... 8 System Analysis Activities... 12 System Analysis Artifacts... 12 System Design - Architecture and Interface... 12 System Design Views... 20 Summary... 20 References... 21 Copyright 2008 Danish Technological Institute Page 1 of 21

Preface The Unified Modeling Language (UML) is a general purpose visual modeling language for system development. Although UML is most often associated with modeling of Object-Oriented software systems, it has a much wider scope such as being used for system design, including both hardware and software elements. This article will try to give a view of the areas for using UML in a HW/SW co-design methodology where focus is on the UML 2.1 standard and tools for real-time and embedded systems. The steps in the UML based HW/SW co-design methodology are illustrated for a measurement system which is implemented on a Xilinx FPGA platform. It includes hardware IP blocks, a PowerPC running Linux covering driver and application software. The audience of this article are software developers and system architects who wish to have an overview of how to use UML for modeling real-time and embedded systems covering both hardware and software elements. The principle of Model-Driven Development (MDD) is a paradigm which promotes the use of models at different levels of abstraction and transformation between them in order to drive a concrete application implementation. MDD promotes the construction of models at a high level which can subsequently be transformed to the final implementation platform. Our approach is Model-Driven Development based on UML which provides the developer with a high level of abstraction with focus being moved from coding, language and platform details to specification and design. It allows an iterative development and verification process on a higher abstraction level than pure coding. The benefits will be an understandable, improved and robust design where focus is on the whole system design covering both hardware and software elements. By using a common visual UML, it is our experience that language improves communication and understanding of the system to be implemented. It becomes clear when discussing the diagrams where things are not understandable or where something is missing. It reduces the number of pitfalls and misunderstandings between project team members. Copyright 2008 Danish Technological Institute Page 2 of 21

UML 2.1 diagrams UML helps you specify, visualize and document models of embedded software systems - including their structure and design - in a way which fulfils the system requirements. It is possible to model just about any type of application, running on any type and combination of hardware, operating system, programming language or network. It is a complex task to gather and analyze the requirements of an application and to incorporate these into a programme design. The industry currently supports many methodologies which define a way to do it. One characteristic UML feature is to strive at being methodology-independent. Regardless of the methodology used to perform analysis and design, UML can be used to express different views of the embedded system. One of the benefits of using UML is that it is a standard maintained by the Object Management Group (OMG) and is widely supported by a range of UML tools. By using XMI (XML Metadata Interchange) it is possible to transfer an UML model from one tool into a repository or into another tool for refinement of the next step in the selected development process - like timing and performance analysis. These are some of the benefits of standardization. UML 2.0 defines a number of diagram types that can be divided into three categories. Structure diagrams includes: class, structure, object, package, component and deployment diagram. They are all basically different, not with regard to the contents of the diagram but with regard to their purpose. Behaviour diagrams focus on specification of behaviour of individual elements covering state machine and activity diagrams. Use-case diagrams are used to emphasize functionality, identification of system interface (actors) and use-case scenarios. They focus on the specification of system usages. Interaction diagrams focus on how elements (objects) collaborate over time to achieve the functional goals. Structure Diagrams Behavior Diagrams Class and Object diagram Composite Structure diagram Package diagram Component diagram Deployment diagram Use-case diagram Activity diagram State Machine diagram Interaction Diagrams Sequence diagram Timing diagram Communication diagram Copyright 2008 Danish Technological Institute Page 3 of 21

UML usage levels The use of UML diagrams for embedded system development can be divided into three levels depending on the ambition of usage and integration of automated code generation. Informal level UML diagrams are used in the analysis and design phases of the project to sketch a few diagrams from where the coding proceeds. In this approach the diagrams are used to get a common understanding of the system to be constructed. UML is only used in the analysis and design phase of the project and is not likely to be updated during the implementation phase. Structural level The UML diagrams are used together with a tool to generate code, and the developer fills in the rest using the model as a guide. This approach saves the programmer for manually creating all the classes and relations identified in the design model. A tool like Enterprise Architect 1 is able to support this development process. It is also possible to import existing code into the UML model. This could be used for reengineering and documentation of existing systems. Executable level This is the Model Driven Development approach. The model views in this approach and the generated source code have a close relation. Analysis, design, implementation and test are all integrated into the UML tool. Very early in the design, it is possible to actually execute and verify the model based on structural and behavioural UML diagrams. This kind of development changes the focus from the art of programming to the application development and abstracts the underlying hardware and operating system. A tool like Rhapsody from Telelogic supports this approach. 1 Enterprise Architect from Sparx Systems, supports UML 2.1 diagrams and code generation Copyright 2008 Danish Technological Institute Page 4 of 21

Getting started with UML How do I best get started using UML in my project? Firstly, you have to decide on the UML usage level you wish to achieve (Informal, Structural or Executable). Secondly, you have to evaluate the level of skills in your team. Do you have sufficient knowledge and experience in object-oriented analyses, design (OOA/OOD) and UML? Does anybody in the team have sufficient experience with UML or model based development? Get training Based on team skills, basic training in UML is recommended. It can be a combination of reading books, articles and participating in a basic 3-5 days UML course. Some of the books and training material on which this article is based are listed in the last chapter. Normally an UML course is based on a methodology since the UML diagrams have no information about how to use them in a development process. A general UML and method course for your team would also give a quick start and a common understanding of how to use a methodology together with the UML diagrams. If you have very little experience and are aiming for a high level of modeling, I can recommend hiring external consultancy or employing an expert in the area of UML and modeling. Select a methodology There are a number of methodologies for using UML diagrams in a development process. You can choose to define your own or use some of the methodologies already described and used in the industry. Below is listed some of the most common methodologies for embedded systems. See references for books describing these methodologies. The Unified Process (UP) The Rapid Object-oriented Process for Embedded Systems (ROPES) The Harmony Process (Latest revision of ROPES) It is recommended to adapt the chosen methodology to one s own needs. In the next chapter a model based HW/SW co-design methodology is described. This methodology is an adapted version of the Unified Process (UP) and ROPES. Select a UML development tool Depending on the UML usage level you wish to achieve, the selection of UML tool is important. Some tools forces you to use a certain methodology, others are purely drawing tools like Visio. In the last chapter you can find links to some of the UML tools available. Start with a simple project Start with a simple project. The best would be if you are planning on a new embedded platform using an object-oriented programming language like C++ or Java. It is recommended to be at least two persons involved in the project since modeling with UML is very much concerned with visual communication and information sharing in the development process. Copyright 2008 Danish Technological Institute Page 5 of 21

A Model based HW/SW Codesign methodology A process is the specification of a sequence set of activities performed by a collaborating set of workers resulting in a coherent set of project artifacts, one of which is the desired system. A methodology consists of a language to specify elements and relations of interest and a process that tells the developer what parts of the language to use, how to use them, and when to use them. Bruce Powel Douglass The purpose of this chapter is to give an example of a methodology based on UML. The objective is not to turn you into an expert in using such a methodology but to give an overview of the steps that could be involved when proceeding from a specification to an UML implementation of an embedded system. This is a HW/SW codesign methodology based on UML where both hardware and software elements of an embedded system are included. The methodology case example is targeting a FPGA platform where one part of the system will be implemented in software and another in hardware. The purpose is to describe the overall system with focus on the partitioning and interfacing between hardware and software elements. UML is used on the informal level in the case example which illustrates the development steps covering analysis and design. The method consists of three main phases and is based on an iterative use-case driven process. The first step is a system specification that may be a pure text document or be based on interviews with the user and customer of the system to be developed. Based on this input, the use-case specification is developed. The system analysis, design and implementation iteration is repeated for a selected number of use cases. The end result is a delivery plan which includes a number of product releases during the development process. This approach ensures that you will be able to get early feedback from the user or customer before completing the entire development process. The methodology includes the following phases for every iteration. System Analysis - Domain and Application o Focus on what to be made System Design - Architecture and Interface o Focus on how to make it System Implementation and Validation o Focus on making and verifying it Only the analysis and design phases are described in this article. Copyright 2008 Danish Technological Institute Page 6 of 21

The figure below illustrates the methodology including the UML diagrams created in each phase. Figure 1 Model based Codesign with UML Copyright 2008 Danish Technological Institute Page 7 of 21

System Analysis - Domain and Application The goal of this phase is to make it clear what to be made. It covers analysis of the system domain including interaction with the environment and required functionality. This phase focuses on a use-case analysis of the application domain. The first step is to identify the external actors interacting with the system. This could be other communication devices, sensors, actuators or system users. The second step would be to identify use cases for each external actor and describe the use-case scenarios. Figure 2 Measurement System use-case diagram is a use-case analysis of a system measuring vibrations from a sensor and calculating a power spectrum (PSD). PSD are averages of sample blocks over a period of time. The PSD result is transmitted to a central server. Each use-case scenario is described in the use-case analysis document. uc Use Case Analysis Measurement System Sensor Collection and processing of measurements Calculation of operation Superv isor «include» «include» Calculation of Power Spectrum Ev aluation of system operation Production expert Instrument Amplifier Collection of control information Transmission of Power Spectrum Central Server Figure 2 Measurement System use-case diagram Copyright 2008 Danish Technological Institute Page 8 of 21

The domain analysis is based on the use-case analysis as a starting point. The domain model identifies the key concepts from the application domain necessary to realize the use-case requirements and to refine them. Classes and objects in the application domain are identified. These classes could be things like the sensor, sample block, power spectrum and instrument amplifier identified from the measurement use-case description. The next step would be to clarify the relations between the classes by examining how they relate to each other. In our case we have decided to use the signal type to describe associations between the identified classes. The result is an UML domain class diagram. See below. class Domain diagrams ADC sampled signal SampleBlock amplified signal buffered signal InstrumentAmp PSD meassured signal computed signal Sensor CentralServ er Figure 3 Measurement System domain class diagram Copyright 2008 Danish Technological Institute Page 9 of 21

The final analysis step is to select a number of use-case scenarios for the first iteration of use cases to be implemented. For every use-case scenario a control class is added to the class diagram and for every actor an interface class is added. The result will be an updated class diagram which contains the domain, control and interface classes. See Figure 4 Measurement System application class diagram for an example. We have added direction of navigability to some of the associations between the application classes to indicate the direction of the message flow in processing the sampled data. class Domain Classes ADCInterface - samplerate: int = 250 - samplewide: int = 18 SampleBlock reads WelchPSD - NumSampleBlocks: int = 41 - SampleBlockSize: int = 512 initialize Controller read SystemConfig serial sampled signal reads ADC ProcessedSampleBlock CommunicationBlock amplified signal Reads InstrumentAmp Server transmit CommunicationPort meassured signal Request Sensor CentralServer Figure 4 Measurement System application class diagram The last step in the application analysis is to select a number of use-case scenarios and describe them in terms of sequence diagrams. The UML sequence diagram provides the behavioural view of the relations between the application objects. See Figure 5 Measurement System application sequence diagram for an example. This sequence diagram covers the use-case scenario Collection of measurements and Calculation of Power Spectrum. Capturing of Quality of Service requirements like schedulability, performance and time is crucial for designing real-time systems. The most differentiating characteristics of real-time systems are their concern and treatment of time. In the analysis of real-time systems, it is important to define the external timeliness requirement to understand the problem. Response performance may be specified into a worst-case deadline and an average response time. In the following case we have calculated the average update rate of the power spectrum (PSD) to 12 times per second. The calculation is based on the sample processing rate of 250 ksps (kilo samples per second) for the measurement of sampled input data. The response of the measurement system is determined by the operating system and the load of the system. The PSD itself has little influence Copyright 2008 Danish Technological Institute Page 10 of 21

due to the number of interrupts from the PSD compared with the transmission rate of the server connection. sd Domain Sequence Processing A2 :ADCInterface S2 :SampleBlock W2 :WelchPSD P2 :PowerSpectrumBlock C2 :Controller loop ADCInput ADC new SerialSample loop CollectInputSamples [n < SampleBlockSize] new Sample loop SumProcessedSampleBlocks [n < NumSampleBlocks] {SampleRate = 250 ksps} new SampleBlock Processing new ProcessedSampleBlock SumBlock signal ProcessedPowerSpectrum Interrupt controller timing calculation interruptrate = samplerate / (SampleBlockSize*NumSampleBlocks) = 250.000 / (512*41) = 12 times/second or 83 ms between interrupts Figure 5 Measurement System application sequence diagram Copyright 2008 Danish Technological Institute Page 11 of 21

System Analysis Activities Below is a brief outline of the 3 analysis steps: Use-Case specification o Actor context description o Use cases o Scenarios Domain analysis o Classes and relations o Domain rules Application analysis o Control and interfaces o Quality of Service (QoS) requirements System Analysis Artifacts Below is listed the documents and UML diagrams produced in the analysis phase: Use-Case analysis document Domain and Application Class Diagrams (Static and relations) Sequence Diagrams (Dynamic and behavioural) System Design - Architecture and Interface The goal of this phase is how to make the architecture for the embedded system. For each iteration, the selected use cases are still the driving factor on where to focus design activities. In the design phase, we will create the HW/SW architecture that can realize the requested functionality based on the outcome of the analysis phase. The architecture is modelled in 4 different views: Process, Logical, Deployment and Implementation which are briefly described in the following case example. Copyright 2008 Danish Technological Institute Page 12 of 21

In the process view we have added information to elements and classes which are executed concurrently. This view focuses on the management of resources and the concurrent aspects of system execution. By concurrent we mean that classes may execute in parallel rather than sequentially. A resource is an element that provides a limited service. For example, it may allow only one process at a time to access its internal data. A decision has to be made based on experience and the chosen target platform for the partitioning of concurrent processing elements into hardware or software. Generally processing elements are suitable in hardware where there is a demand for high speed data processing and the computation is rather simple. Processing elements making complicated decisions or computes in sequence are more suitable in software implementation. In our case study, the target is a FPGA platform including an embedded PowerPC (100 Mhz) running Linux. We have decided to implement the averaging of data blocks and computation of the power spectrum (PSD) in hardware to reduce the load of the embedded processor. In this case, the processor will be interrupted every 83 ms where it has to collect 512 samples for each sensor channel. The alternative would be to implement the PSD in software. However, this would require a much faster embedded processor calculating and collecting samples at a rate of 250 ksps. Implementation in software would require a much faster CPU which would be more expensive than using the FPGA platform. The stereo types <<hwprocess>> and <<swprocess>> are used to indicate processes implemented in hardware or software. The stereo types <<hwressource>> and <<swressource>> are used to indicate resources implemented in hardware or software. See Figure 6 Measurement System refined class diagram with concurrency. class Domain and Application Classes «hwprocess» ADCInterface - samplerate: int = 250 - samplewide: int = 18 + process() : void SampleBlock «hwprocess» WelchPSD - NumSampleBlocks: int = 41 - SampleBlockSize: int = 512 initialize «swprocess» Controller read SystemConfig serial sampled signal reads ADC «hwresource» PowerSpectrumBlock «swresource» CommunicationBlock amplified signal Reads InstrumentAmp serial status «interface» NexusInterface status «swprocess» Service transmit «interface» CommunicationPort meassured signal Request Sensor CentralServer Figure 6 Measurement System refined class diagram with concurrency Copyright 2008 Danish Technological Institute Page 13 of 21

The logical architectural view is concerned with models and how they are organized. This organization can be simple or very complex, depending on the needs and structure of the team using it. In this logical view all classes are divided into abstract packages with a typically layered architecture. Each layer in the logical view of the measurement system addresses the application, driver and real-time layer shown in Figure 7 Measurement System Package diagram. class System Components Application Layer «swprocess» Service SystemConfig read «swprocess» Controller Reads transmit «interface» CommunicationPort Request CentralServ er «swresource» CommunicationBlock driver API Driv er Layer WelchPSDProxy Real Time layer reads initialize «hwresource» PowerSpectrumBlock «hwprocess» WelchPSD - NumSampleBlocks: int = 41 - SampleBlockSize: int = 512 «hwprocess» ADCInterface - samplerate: int = 250 - samplewide: int = 18 + process() : void SampleBlock Figure 7 Measurement System Package diagram The deployment view is documenting the physical devices in the system. This view focuses on how the software and hardware architecture maps onto the physical devices such as FPGA, processors, active sensors/actuators, controllers, displays, I/O devices or central servers. UML uses the concept of a node to represent a physical device. The combination of UML components and deployment nodes are shown in the same diagram. A component is an artifact of development existing at runtime. In the measurement system we have an Copyright 2008 Danish Technological Institute Page 14 of 21

application program (WelchPSD_DataProvider), a linux driver (WelchPSD_Driver) and two HW IP-blocks which are all components deployed on the embedded platform. Our focus it to visualize where the logical concepts, in terms of components, are mapped to the physical architecture. See Figure 8 Measurement System deployment diagram which illustrates a deployment view for creating the partition of HW/SW components on our target platform which is a Xilinx Virtex4 FPGA with an embedded PowerPC processor running Linux 2.6. deployment Nodes Virtex 4 - PowerPC - Linux CentralServ er WelchPSD_Driver WelchPSD_DataProvider Socket Inteface (Ethernet) Memory Map (Bus Interface) Virtex 4 - FPGA ADC Serial Interface ADC_Serial_Interface WelchPSD_IPBlock Figure 8 Measurement System deployment diagram The last step is the implementation view where we are looking at the interface specification between components. It covers interface specification to external devices and between hardware and software objects inside the system. The internal object behaviour in our system is described in this view using state or activity diagrams. A state diagram describes a finite state machine (FSM). A FSM is the case where an object possesses a finite set of conditions of states. A state is defined to be a mutually exclusive condition of existence defined by the set of events it processes and the actions it performs. Objects with state machines react to events in well-defined ways. Incoming events can induce transactions between states. The difference between activity and state diagrams is that state diagrams are used when the classifier progresses primarily from state to state upon receipt of events, whereas activity diagrams are used when the classifier progresses from state to state, primarily when the actions performed in the predecessor state are completed. In practice, state diagrams are used to model reactive behaviour of classes when they proceed via the reception of events. Activity diagrams are used to model control flow behaviour of operations and activities on states. The common use of activity diagrams in real-time and embedded domain is to show computation of algorithms 2. 2 Taken from Real Time UML Third Edition by Bruce Powel Douglass Copyright 2008 Danish Technological Institute Page 15 of 21

In the implementation view we use a combination of component and timing diagrams to describe interfaces. Ports are used to connect components together by using hardware signals. The use of navigation arrows for the connection between ports are used to indicate the direction of the signals. In our measurement case study we will examine one of the hardware components in our design. In this case it is the serial interface that converts an 18 bit serial sample value from the ADC to a parallel sample which is processed by the hardware IP block (WelchPSD-IPBlock). This example illustrates how UML diagrams could be used for a hardware design at a very detailed level. See Figure 9 Analog to Digital Converter (ADC) serial input, combined component and timings diagram as an example of how such an interface specification could be described using UML. cmp ADC_Interface ADC ADC_Serial_Interface WelchPSD_IPBlock sync sync clk sync ready ready ready sdclk sdclk parallel sdout serial sdin data data Cnvstart convert Clock sync 1 0 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 clk 1 0 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 serial Invalid D17 D D D D D D0 Invalid 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 ready 1 0 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 parallel Data Inv alid Data 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Figure 9 Analog to Digital Converter (ADC) serial input, combined component and timings diagram Copyright 2008 Danish Technological Institute Page 16 of 21

The internal behaviour of components and classes is described with UML activity or state diagrams. In the following example you can see how the ADC serial to parallel interface behaviour is described with an UML state diagram. This state diagram concerns the behaviour of the ADC serial interface hardware block. This state machine could be implemented in VHDL or SystemC source code. composite structure ADCInterface States ADCInterface::Process Initial /ready=0 WaitForSyncPos [sync=0] WaitForSyncNeg [sync=1] /ready=0; cnt=data_len [sync=0] [cnt=0 sync=0] /parallel.write; ready=1 WaitForClkNeg [clk=0] /parallel[cnt]=sdin; cnt-- WaitForClkPos [clk=1] Figure 10 ADC internal state diagram Copyright 2008 Danish Technological Institute Page 17 of 21

The final step is to define a memory map describing the data structure to be used as the interface description between the HW block and driver software. In our measurement system we have used a combination of a UML sequence diagram and a textual description to design the interface between the WelchPSD_IPBlock (HW block) and the WelchPSD_Driver software. sd ProcessedBlockBuffer «process» W4 :WelchPSD BC4:BlockController PB4 :PowerSpectrumBlock WP4:WelchPSDProxy «process» C4 :Controller loop Blocks DataReady loop WriteBlock Write Write WriteDone BlockCount++ DataReady loop ReadBlock Read Read BlockCount ReadDone : OverflowState MarkOverflow DataReady Figure 11 WechPSD interface sequence diagram The sequence diagram identifies a number of signals and variables like DataReady, BlockCount and OverflowState which will be described in details in the memory map between the hardware and software layer. The memory map is a structural description of data/register variables to be exchanged between the hardware and software layer. Every variable is named with the same identification used in the UML diagrams. A variable has a number of attributes like: description, words, direction, reset value, range and address. These attributes describe a variable in detail and should be seen as the software application programming interface (API) to the hardware. The direction attribute indicates to the software whether the variable can be written to or read from (W/R). The default reset value is the value which the hardware layer has updated after a reset condition. The range attribute indicates the range in which the software is allowed to modify a variable. All addresses are relative to a base address of the memory mapped hardware block. Copyright 2008 Danish Technological Institute Page 18 of 21

Words Reset Variable Name Description (32bit) Direction value Range Addr. NumSampleBlocks Number of sample blocks to be used in calculation of a PowerSpectrumBlock. 1 W/R 41 32-128 0 Size of sample block. SampleBlockSize (PowerSpectrumBlock) 1 W/R 512 256-1024 1 WindowDWidth Window width of the Welch curve. 1 W/R 1024 512-2048 2 Control Control register for the Welch PSD. 1 W/R 0 3 OverflowState Overflow counter. Incremented every time a block overflow is detected. Cleared automatically by reading. This register will also be used to signal that a new PowerSpectrumBlock has been read. 1 R 0 4 Status Status register for the Welch PSD. 1 R 0 5 BlockCount Incremented each time a new block is updated. Wraps around when upper limit reached. 1 R 0 6 Processed PowerSpectrumBlock. Valid words in block depends on the SampleBlockSize. There will be new data in block when Status register DataReady bit is 1. Buffer is emptied PowerSpectrumBlock by reading NumSampleBlocks. 1 R 0 7 Figure 12 WechPSD interface memory map The table below describes in detail the bits of the control and status registers. Control register Bit Name Description Bit Pos Direction Restart Reset value Control Reset bit - as long this bit is set to 1 the Welch PSD block will stay in reset mode. The Welch PSD block will be enabled setting this bit to 0. 0 W/R 1 InterruptEnable This bit will enable the PowerSpectrumBlock interrupt from the WelchPSD. 1 W/R 0 WindowStart Set to 1 for start updating a new Welch curve. 2 W/R 0 EnableSerialInterface Enable the serial interface. 3 W/R 0 Status register Bit Name Description Bit Pos Direction DataReady Reset value This bit will be set by the Welch PSD when a new PowerSpectrumBlock is processed and ready for reading. Cleared by reading the overflow register. 0 R 0 SampleReady This bit is set to 1 every time a new sample is avaible. Cleared when RawSample is read. 1 R 0 ChannelID Id of the channel for the last spectrum 31-24 R 0 Figure 13 WechPSD interface memory map control and status registers Copyright 2008 Danish Technological Institute Page 19 of 21

System Design Views To give a brief overview of the architecture modelling steps, the four different views are listed below. For every view a number of artifacts (documents and diagrams) will be produced depending on the complexity of the embedded system. The use-case view is the driving factor which is why the system design views are called the 4+1 views. Process View o Adding concurrency and resources o Software resources, processes and threads o Hardware resources and processing blocks o Relations and synchronisation Logical View o Refinement of class diagram o Dividing classes into logical packages Deployment View o Components o Partitioning o Deployment Implementation View o Signals and Timing o Sequence, activity and state diagrams o HW/SW Interfaces (IP memory maps) o External Interfaces Summary This article has described a sample case using a methodology based on UML for modeling real-time and embedded systems, covering both hardware and software elements. The methodology is a guide for the steps to do - coming from a specification to a design based on UML. Our experience is that the use of a common visual UML language improves communication and understanding for the system to be implemented for teams of both hardware and software developers. The methodology ensures that you will be closer to a fine solution as an alternative to starting implementation without a structured coordination of the software and hardware team. The methodology does not guarantee a better result but it helps you to make the right decisions early in the development process. It visualizes the decisions made during the analysis and design phases covering functionality, partitioning, platform and interface specification to ensure a common understanding of how the system should be implemented. We recommend that a development process using this methodology includes design and review meetings where the UML diagrams are reviewed by the customer and hardware and software developers, depending on where you are in the phase of the project. Copyright 2008 Danish Technological Institute Page 20 of 21

References Below are listed some books, training material and tools which are used as background material for this article. Books The following books will serve as a good starting point for learning about UML, Methodologies and Model-Driven Development for real-time systems. UML Distilled, Applying the standard object modeling language by Martin Fowler UML and the Unified Process, Practical Object-Oriented Analysis & Design by Jin Arlow, Ila Neustadt (Describes the Unified Process) Real Time UML Third Edition by Bruce Powel Douglass (Describes the ROPES process) Real-Time UML Workshop for Embedded Systems by Bruce Powel Douglass (Describes the Harmony process) Training The following training material has been used as input for this article: OO analyse, design og realisering med UML, course material, Danish Technological Institute (Describes the Teknologisk Unified Process TUP) Links and UML tools OMG Group web site: http://www.uml.org/ Papyrus (Open Source eclipse based UML tool) web site: http://www.papyrusuml.org/ Sparx System Enterprise Architect (UML tool) web site: http://www.sparxsystems.com.au/ Visual Paradigm Visual UML modeling tool http://www.visual-paradigm.com/ Telelogic - Rhapsody (MDD tool) web site: http://www.telelogic.com/ IBM Rational Systems Developer (MDD tool - Formerly called Rational Rose) web side: http://www.developers.net/ibmshowcase/view/1328 Xilinx FPGA tools and boards web site: http://www.xilinx.com/ Tool versions Enterprice Architect ver. 6.5 Xilinx FPGA tools: EDK and ISE ver. 9.2 Copyright 2008 Danish Technological Institute Page 21 of 21