Application of Design Patterns for Hardware Design

advertisement
APPLICATION OF DESIGN PATTERNS
FOR HARDWARE DESIGN
Speaker: Prof. Vytautas ŠTUIKYS,
Software Engineering Department,
Kaunas University of Technology,
Kaunas, Lithuania
E-mail: vystu@if.ktu.lt
Phone: 370-37-300399
Content

Design Domain Analysis: System-level Design
Processes in HW Design

Design Domain Analysis: Design Patterns in SW/HW
Design Domains
Implementation of System-level Design Processes &
Design Patterns





Metaprogramming and Design Pattern-based Design
Framework
Experiments
Analysis, Evaluation and Problems
Conclusions
2
Design Domain Analysis: Aims

To specify and understand the generally approved
trends in design domain (SW/HW)

To identify and characterize the well-understood
sub-domains in HW design domain
To understand how approved solutions in SW
domain can be applied for HW design


To gain guidelines for achieving higher reusability,
adaptability & productivity (including the ones for
building domain generators)
3
Design Domain Analysis: Findings

Trends:



Well-understood sub-domains (models):



Shift towards Integration-based Design (reuse, IP)
Blurring boundaries between HW & SW design
Interface-based design using well-defined
communication models (Handshake, FIFO, etc.)
Fault-tolerant design using well-defined
redundancy models (TRM, etc.)
Essential features of the designs:

Solutions for common problems (System-level
Design Processes and Design Patterns)

Explicitly separated variant and invariant parts
4
Hardware Design Processes


Register Transfer-level design processes
System-level design processes
SoC
System-level (SL)
design processes
IP
IP
IP
Register Transfer-level (RTL)
design processes
5
Layers of System-level Design Processes

Specification processes deal with the analysis
and specification of design problems




separation of concerns,
composition,
generalization.
Implementation processes are concerned with
the aspects of implementation of design
solutions that deal with design problems

customization (e.g.,wrapping).
6
Design Pattern: Definitions

The design pattern is ...




… “descriptions of communicating objects and
classes that are customized to solve a general
design problem in a particular context” [E.
Gamma et al., 1995]
… “the abstraction from a concrete form which
keeps recurring in specific non-arbitrary
contexts” [Riehle and Zullighoven, 1996]
… “a named nugget of insight that conveys the
essence of a proven solution to a recurring
problem within a certain context amidst
competing concerns” [B. Appleton, 2000]
… “both a process and a thing; both a
description of a thing which is alive, and a
description of the process which will generate
that thing” [C. Alexander, 1979]
7
Motivation of Using Design Patterns

Raising the level of abstraction


Easing the communication between different design
teams
Ensuring higher HW design quality
Increasing HW design automation and productivity

Accelerating design reuse, sharing and transfer

8
System-level Design Processes and
Design Patterns

The subject of the object-oriented HW design should
be not physically existing objects, but abstract
concepts such as design processes
 SW design patterns are used to describe the
common SW architectures
 HW design patterns should be used to describe the
commonly used System-level HW design processes
in an abstract way
 A Design Pattern is UML-based representation of a
System-level Design Process
9
Design Patterns in Hardware Design (1)

Pattern-like solutions

models of computation:


data flow models:


Finite State Machine
protocol
communication models:
bus
 communication coprocessor


wrappers:
reliability wrapper
 bus wrapper
 protocol wrapper
 memory wrapper

10
Design Patterns in Hardware Design (2)

Design patterns

Adapted from SW design
Abstract Factory, State [Yoshida]
 Resource Manager [Vanmeerbeeck et al.]
 Composite, Object Adaptor, Abstract Factory and
Decorator [Åström et al.]
 Singleton [Charest and Aboulhamid]


New HW design patterns

Bus-Protocol, DLX Processor Architecture [Doucet
and Gupta]
11
Application of the OO Concepts for VHDL





Abstract class - VHDL entity
A class that implements an abstract class - VHDL
architecture
The composition relationship - VHDL port map
statement
Class attributes - VHDL ports and signals
Class methods –VHDL processes
12
Wrapper Design Pattern

Allows adapting an interface and behavior of the IP
component to the context of a given application

Can be nested
13
Implementation of Design Pattern



We implement HW design patterns using the
metaprogramming techniques.
Metaprogramming is a higher-level programming
technique, which provides a means for
manipulating with other programs as data.
The metaprogramming abstractions can be
categorized into two large groups:


Homogeneous metaprogramming is based on the
implicit separation of concerns.
Heterogeneous metaprogramming is based on the
explicit separation of concerns.
14
Principles of Metaprogramming






CI
R
S
P
I
MP
– Component Instance (IP)
– Requirements for modification
– Separation of concerns
– Parameterization
– Integration of concerns
– Metaprogram
Metaprogramming Domain
P
CI
S
R
P
I
MP
P
15
Heterogeneous Metaprogramming

Heterogeneous metaprogramming is based on the
usage of two different languages in the same generic
specification.

Domain language is
used for expressing
basic domain
functionality.

Metalanguage is used
for expressing
generalization and
describing domain
program modifications.
Metalanguage
Domain Language
Modification
Algorithm
Domain
Algorithm
+
Interface
Signals
Metaprogram
Domain
Program
Metaprogramming Domain
Programming Domain
16
Aim of Metaprogramming


Create a metaprogram – a program generator for a
narrow application domain.
Metaprogram consists of a family of the related
domain program instances encapsulated with their
modification algorithm.
 Modification algorithm describes the generation of a
particular instance depending upon the values of the
generic parameters.
 Metalanguage is used as a higher-level abstraction to
integrate the different domain program instances and
make up a metaprogram.
 Metaprogram is used as a set of instructions for a
metalanguage processor to generate the specific
domain program instances.
17
Relationship Between Design Process,
Design Pattern and Metaprogramming

We implement a particular HW Design Pattern by
developing a parameterized code generator
(metaprogram) that applies a respective Systemlevel Design Process to a given soft IP.
SL Design Process
IP <<a>>
HW Design Pattern
wrapping
Metaprogramming
IP
Wrapper
Generator
(Metaprogram)
IP
Wrapper
18
Detailed Framework of Our Approach




(0) Extract from design domain analysis (DDA): SL DP/ Design
pattern, requirements and IP.
(1) Extract the IP interface parameters from the soft IP interface
and use them as generic parameters for metaprograms (MP).
(2) Design a MP, where a metalanguage (ML) performs the
required domain program code modifications depending upon
the values of the generic parameters.
(3) Generate the IP wrapper using a ML processor.
DDA
SL Design
Process
Design step (0)
Design
Pattern
pre-designed
metaprograms
Design step (0)
soft IP
Requirements
MP1
DL
parser
Syntax
Tree
Design step (1)
Extract
Parameters
MP2
MPn
Design step (2)
ML
processor
IP
wrapper
Design step (3)
19
Role of Metaprogramming Techniques

To serve as a bridge between the abstract
description of the System-level HW Design Process
and its implementation.
 To provide abstractions for describing generic
components and domain program modifications.
 To provide a means and guidelines for developing
domain code generators (especially, wrapper
generators).
20
Experiments

Communication interface synthesis



Handshake Wrapper [DAC 03]
FIFO Wrapper [INFORMATICA, see Ref. in DAC03]
Fault-tolerant design [submitted, not presented
here]



Space Redundancy Wrapper
Time Redundancy Wrapper
Data Redundancy Wrapper
21
Handshake Wrapper


The IP communicates with a
micro-controller (MC), which
drives the IP through a channel
(bus) using a handshake data
protocol (DP) (a)
Our aim is to adapt the IP for
handshaking in order to establish
a direct communication between
the MC and the IP (b)
SoC
(a)
DATA
MC
DATA
DP
DP DATA
IP
REQ
ACK
Channel
Server side
Client side
(b)
SoC
DATA
MC
REQ
ACK
wrapped
IP
Channel
IP
Dragonfly
Area, cells
(IP)
5883
Area, cells Increase, Power, uW Power, uW Decrease,
(IP+Wr)
%
(IP)
(IP+Wr)
%
6804
16
19.9421
14.6646
26
HC11
7394
8951
i8051
24266
25282
21
19.0632
14.6237
23
4
50.5518
33.8819
33
22
FIFO Wrapper

The FIFO protocol is used in the producer-consumer
communication model to smoothen bursts in the
requests for a service

To deal with such bursts,
the FIFOs are inserted
between the data producer
and the data consumer

FIFO wrapper
CLK
Data_in
The FIFOs store the surplus
data, which is read in the
same order in which it was
written in
IP
Free-6502
Dragonfly
DLX
Data_in
Push
Full
Empty
Area, cells
(IP+FIFO (4))
Increase,
%
4670
5883
20118
6880
10451
25735
47
44
22
Power, uW
(IP)
8.2693
19.9421
23.2075
Control_
logic
Data_out
Pop
Empty
clk_gen
Pop
Area, cells
(IP)
IP Data_out
Push
Full
Power, uW
(IP+FIFO (4))
13.2107
25.3074
28.3474
Increase,
%
37
21
18
23
Analysis and Evaluation (1)

The advantages of using HW design patterns:




The design content is captured immediately and
intuitively.
The pattern-based design can be supported by the
automated validation and code generation tools.
The level of abstraction is raised to the system
level.
The usage of the Wrapper design pattern



allows separating explicitly and implementing
different design concerns separately,
enables the integration of the soft IPs into different
HW systems,
facilitates the greater reusability of the soft IPs.
24
Analysis and Evaluation (2)

The usage of the metaprogramming techniques
allows us to develop metaprograms (wrapper
generators), which



encapsulate common domain solutions
(communication protocols),
adapt soft IPs to the different communication
models.
Metaprogramming allows us



to raise the level of abstraction,
to increase the reusability and customizability of
the soft IPs,
to generate automatically the communication
interfaces.
25
Problems Solved by Using Design Patterns
and Metaprogramming

The design content is captured immediately and
intuitively, thus increasing design comprehensibility

The pattern-based design can be easily supported by
the automated design validation and code generation
tools, thus increasing design reuse, quality and
productivity

The level of abstraction is raised to the system level,
which allows dealing with growing complexity of HW
designs
26
Problems yet to be solved



How the System-level design processes
described using the UML-based HW design
patterns could be (semi-) automatically
transformed into metaprograms?
How the physical constraints (such as the timing
ones) should be reflected in an object-oriented
model (design pattern)?
How objects or even entire design patterns
could be directly synthesized to RTL?
27
Conclusions



We expect that the application of design
patterns will contribute to the increase in HW
design reuse, quality and productivity.
The implementation of HW design patterns
using the heterogeneous metaprogramming
techniques should contribute to the increase in
HW design automation.
Future work will focus on the discovery of other
HW design patterns and the development of the
HDL code generators for their implementation.
28
APPLICATION OF DESIGN PATTERNS
FOR HARDWARE DESIGN
Thank You
for Your attention !
Download