Académique Documents
Professionnel Documents
Culture Documents
UNU/IIST (United Nations University International Institute for Software Technology) is a Research and Training
Centre of the United Nations University (UNU). It is based in Macau, and was founded in 1991. It started oper-
ations in July 1992. UNU/IIST is jointly funded by the Governor of Macau and the governments of the People’s
Republic of China and Portugal through a contribution to the UNU Endownment Fund. As well as providing two-
thirds of the endownment fund, the Macau authorities also supply UNU/IIST with its office premises and furniture
and subsidise fellow accommodation.
The mission of UNU/IIST is to assist developing countries in the application and development of software tech-
nology.
1. Advanced development projects, in which software techniques supported by tools are applied,
2. Research projects, in which new techniques for software development are investigated,
3. Curriculum development projects, in which courses of software technology for universities in developing
countries are developed,
4. University development projects, which complement the curriculum development projects by aiming to
strengthen all aspects of computer science teaching in universities in developing countries,
5. Courses, which typically teach advanced software development techniques,
6. Events, in which conferences and workshops are organised or supported by UNU/IIST, and
7. Dissemination, in which UNU/IIST regularly distributes to developing countries information on interna-
tional progress of software technology.
Fellows, who are young scientists and engineers from developing countries, are invited to actively participate in
all these projects. By doing the projects they are trained.
At present, the technical focus of UNU/IIST is on formal methods for software development. UNU/IIST is an
internationally recognised center in the area of formal methods. However, no software technique is universally
applicable. We are prepared to choose complementary techniques for our projects, if necessary.
UNU/IIST produces a report series. Reports are either Research R , Technical T , Compendia C or Adminis-
trative A . They are records of UNU/IIST activities and research and development achievements. Many of the
reports are also published in conference proceedings and journals.
Please write to UNU/IIST at P.O. Box 3058, Macau or visit UNU/IIST home page: http://www.iist.unu.edu, if
you would like to know more about UNU/IIST and its report series.
Abstract
Hardware/Software Interface plays an important role in co-design of the embedded computer system. It
links the software part and the hardware part of the system. The design process supports software inter-
face implementation and hardware interface synthesis. This report shows how the hardware and software
interfaces can be implemented by using bus extended technology in embedded computer system, which
includes the primitive interface, the synchronous interface and the data communication protocol between
the hardware and the software.
Chen Chang is a Fellow of UNU/IIST, on leave form the Department of Computer Science and Technol-
ogy, East China Normal University, Shanghai, where he is a senior engineer. E-mail: chc@iist.unu.edu
He Jifeng is a Senior Research Fellow of UNU/IIST, on leave of absence from East China Normal Uni-
versity, Shanghai, where he is a professor. His research interest lies in the sound methods of specification
of computer system, communications, application and standards, and the techniques for designing and
implementing those specifications in software and/or hardware, with high reliability and at low cost.
E-mail: jifeng@iist.unu.edu
Copyright c 2002 by UNU/IIST, Chen Chang and He Jifeng
Contents i
Contents
1 Introduction 1
6 Conclusion 14
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Introduction 1
1 Introduction
Hardware/Software Co-design technique supports the simultaneous design of both hardware and soft-
ware to implement a desired function. It has widely been used in design of Embedded Computer Sys-
tem(ECS). With hardware and software co-design methodology, a system specification is partitioned into
hardware and software parts according to the system architecture.
specification
HW/SW patation
In this vertical partition processing, the formal method [1] can be used for ensuring the system de-
sign correct. Hardware/Software Interface links the software part and the hardware part in the system.
Hardware/Software Interface design includes software interface implementation and hardware interface
synthesis.
Embedded Computer System usually requires high performance at low cost. To meet such requirements
in application, powerful chips, such as Micro-Processors (MP), Micro-controllers (MC) and Digital Sig-
nal Processors (DSP), and high level programming languages are used to facilitate the software design.
Meanwhile, Hardware Description Languages (HDL) are adopted to improve the efficiency in hardware
design,
Bus is used for dispatching information in computers, through which address, data and control messages
all can be transmitted. The relationship of these signals is based on the architecture of the processor in
system. Use of bus technology in design of the hardware/software interface of embedded systems can
reduce the link number of wires and devices, and make the system easy to be extended.
This paper shows how the hardware and software interfaces can be implemented using bus extended
technology, and discusses in detail the primitive interface, the synchronous interface and the data com-
munication protocol between the hardware and the software. The reminder of this paper is organized as
follows. Section 2 briefly describes the Bus extended technology used in the communication interface
design. Section 3 presents the primitive hardware/software interfaces. Section 4 deals with the design of
the synchronous interface. Section 5 gives the examples of the data communication interface design.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
2 Bus Extended Technology
A standard Bus is composed of the data Bus, the address Bus and the control Bus. The Bus width is
determined by the processor architecture. The data Bus transmits data messages and normally its width
is 8Bit, 16Bit or 32Bit. The address Bus transmits address messages and its width determines the access
space of processor. The control Bus transmits system control signals.
Reading and writing are two primitive functions in the Bus. The reading protocol sees figure 2 and the
writing protocol sees figure 3.
addr addr
Bus Bus
data data
Bus Bus
RD RD
WR WR
In the reading and writing protocol, a specific address is first sent through the address Bus to identify the
location where the data is fetched from or is stored to. Then the data is present in the data Bus and the
control signal or in the control Bus. When the signal is in place, the processor reads the
data from the data Bus. When the signal is valid, the data is output from the processor to the data
Bus. However, and can not be valid at the same time. When and both are absent, the
Bus is in the
state.
We use the following notations to represent the reading and writing functions in the later discussion.
where the channel is selected by the Bus address, and the number of the channels available for commu-
nication is determined by the width of the address Bus.
The primitive interface implements input and output, where the input interface supports the reading
function, and the output interface the writing function.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Primitive Interface Design 3
The input interface for processor is composed of the hardware interface and the software interface.
In this program, line 1 defines the Bus width. Line 2 introduces the module ‘ ’ as an input
hardware interface, where the parameter stands for input, ! for output and " for control. A digital
device ‘$#&%' -(')$*" ’ has the same behaviour as the hardware interface
g
x y
The gate has its input wire directly connected to the input source, whose selection is determined by
the address value sent by the software input interface shown below. Its output wire ! and control wire
" are linked to the data Bus and the control Bus respectively. If " is valid, ! is assigned the value of ,
otherwise ! is equal to 3 (which denotes high impedance).
The software interface reads the data from the hardware interface. It is implemented as a procedure
5) 6'798&: :;=< , where its value parameters and identify the selected address and the control
signal, and the result parameter 8 is the holder of the incoming message.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
4 Primitive Interface Design
To perform a primitive reading function >> , the application program can invoke the software interface
procedure.
In the multi-input hardware interface, the selection of the input can be implemented in two ways. One is
based on the control signal, see figure 5. The other one is based on the input source, see figure 6.
x1
g1 x1
selector
data y x x2
data y
x2 Bus ......
Bus
g2 g
...... ...... RD xn
xn addr
gn Bus
In figure 5, the multi-input hardware interface is a collection of the three-state gates connected to the
Bus in parallel. As in the case of single three-state gate, the inputs AL :NMOMOMO: &P are connected to their input
sources. The control wire "DQ becomes valid only when both signal and the corresponding address
are available. The behaviour of this multi-input hardware interface can be modelled by
UT V ;b cc
"Z L Y !,+.- [ L\B cc
R S ?-
WW
WW "] Y !,+.- ] B c
WX MOMOMOMOMOM
" PY !+.- &PB d
^ " L`_ ^ "] _ MOMOM _ ^ " PaY !,+.-F3 B
T[
where the input message passed to the data Bus is selected by the control signals " Q . To avoid interference
between multiple inputs, we must ensure that only one of control signals can be active at any time.
In figure 6, the multi-input hardware interface is built by a three-state gate together with a selector. The
input wires AL :NMOMOMO: P are connected to their corresponding input resource. One of them is selected by
the address and linked to the input wire of the three-state gate. The control wire " is solely controlled
by the signal. This multi-input hardware interface can be modelled by the program
UT V b;cc
97 )% @A(f-F)% L < Y [L'B
cc
WW 79)% @A(f-F)%>]D< Y ]B c /
R S e ?- !,+.- WW MOMOMOMOMOM i143
WX 79)% @A(f-F
)
% P< Y &PB d
79)% @A(5h g )% L MOM P < Y 3B
T[
where the input message assigned to ! is selected by the address. To avoid interference between multiple
inputs, users must ensure that only one of addresses can be active and must be active at any time.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Primitive Interface Design 5
The procedure 5j 6'798&: :;=< can also be used to implement the multi-input software interface.
These input interfaces for processor are the typical asynchronous interfaces. They require that the input
data should be ready before the processor executes the reading function.
The output interface for processor is composed of the hardware interface and the software interface. The
hardware interface can be described by the Verilog program
A digital device ‘
k # ’ has the same behaviour as the hardware interface
x
y
k
Figure 7: Latch
where the output wire ! is directly connected to output destination. The input wire and the control wire
l are linked to the data Bus and the control Bus respectively. When l is valid, the value of propagates
to the output wire ! , otherwise ! remains unchanged.
The software interface writes data to the hardware interface, and is implemented by the procedure
‘5) %D9$m7 :n&:o2< ’
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
6 Primitive Interface Design
where the parameter gives the output message, delivers the selected address and outputs a control
signal for writing. The procedure is invoked when an application program wants to perform the writing
function &r .
For the multi-output interface, the selection of the output in the hardware interface can be implemented
in two ways. One is based on the control signal, see figure 8. The other one is based on the output
destination, see figure 9. In figure 8, the multi-output hardware interface is composed of a collection of
y1 y1
k1
y2
selector
x data x y
data
Bus Bus ......
k2 y2
WR yn
...... ...... k
addr
kn yn Bus
the latches connected to the Bus. As in the case of single latch, each output wire !DQ is linked to its own
l
output destination. The control wire Q is valid after both signal and the address become available.
The behaviour of this multi-output hardware interface can be modelled by the multiple assignment
In figure 9, the multi-output hardware interface is composed of a single latch connected to the Bus. This
kind of the multi-output hardware interface can be modelled by,
UT V b;cc
79)% 2 @ A(f-F)% L < Y ! L c
R s ?- WW 79)% 2 @ A(f-F)%>]C< Y ! ]
WX MOMOMOMOMOM d +.- 0/ x14! B
79)% 2 @ A(f-F)% P < Y ! P
T[
where the output control signal is a . The output message from the data Bus is determined by the
address. In this interface, at least one of the address must be active at any time.
The multi-output software interface can invoke the procedure j a%D9$m7 m:;&:p2< to write the data
to the multi-output hardware interface. All these output interfaces for processor are the typical asyn-
chronous output interfaces. As the simplest case, the constraint of using these interfaces is that the
receiver should be ready when the data is output by the processor.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Primitive Interface Design 7
The primitive inout interface is composed of the hardware interface and the software interface. The
hardware component of the inout interface is made up of the modules Q & and 5))yz&{
defined in the previous sections.
The structure of the inout interface is shown in figure 10, where the input interface and the output inter-
face link to the same data Bus.
x
data
Bus w
y
The software interface interacts with the hardware interface by invoking the procedures j 6'798&: :;|<
and 5) %D9)7 :; :pa2< to perform the reading and writing functions.
The inout interface can only sever as either input interface or output interface (but not both) at any time.
If the reading and the writing occur at the same time, the data Bus and the three-state gate will output to
the same wire. This may damage the circuit when one outputs ‘1’ and the other outputs ‘0’. To exclude
the interference between the input and the output, users are required to maintain the invariant
" _ l -~}6
9(C
The multi-inout interface can be built in a very similar way as the multi-input interface and the multi-
output interface. Its hardware component encompasses a number of primitive input and output devices,
all of which are linked to the same Bus. The figure 11 is an example of the multi-inout interface, where
the input source and the output destination is selected by the control signal "Q and address.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
8 Synchronous Interface design
g1
x1
...... ..........
gm
data w xm
Bus
y1
y y2
WR ......
addr k
yn
Bus
The multi-inout software interface is the same as the primitive inout software interface. The inout in-
terface for processor is asynchronous. Its correct function assumes that the input data has been ready
before it is read by the processor, and that the receiver is willing to input when the data is output by the
processor.
yes
The synchronous interface is used in support of synchronous communication between the software com-
ponent and the hardware component of an embedded system.
In synchronous interface, a flag is introduced to synchronise the parallel execution of its hardware com-
ponent and software component, i.e., a communication can occur only after the flag is set indicating both
sender and receiver are ready for it.
1 module Flag( S, R, Q );
2 input S, R ;
3 output Q ;
4 reg Q ;
5 always @ (posedge S or posedge R)
6 begin if (R) Q = 1’b0; else Q = 1’b1; end
7 endmodule
where the flag is set by the positive edge signal from , and reset by the positive edge signal from .
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Synchronous Interface design 9
The hardware component of the synchronous input interface is made up of the flag and the primitive
input interface.
Its structure is shown below 12. The software component of the synchronous interface inputs data from
data y x
Bus
g
RD Flag
R S
F
the hardware component, and is devised as a procedure (\! %D'798&: :;|< , where the parameter 8 is
the holder of the input message, is the selected address and is a control signal for reading. defined
as follows,
Here, the program waits for the flag } to be set to indicate availability of an input data on the data Bus.
The reset wire of the flag is linked to the control wire " , which is driven by the control signal . The
assignment %D
@(6+.-F in the procedure %D'798&: :;|< has the effect of resetting the flag.
The synchronous multi-input interface is also composed of the hardware interface and the software inter-
the input
face. source is component
Its hardware selected by isthe address value.
constructed using a multi-input interface and a flag indicator 13. where
The software component of the synchronous multi-input interface invokes the procedure (\! %> 798 : ;: |<
to read the data from the multi-input hardware interface synchronously.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
10 Synchronous Interface design
addr
Bus
x1
y x x2
......
data
Bus xn
g
RD Flag
R S
F
The hardware of the synchronous output interface is made up of the primitive output interface and the
flag indicator.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Synchronous Interface design 11
data x y
Bus
k
WR Flag
S R
F
The software component of the synchronous output interface is responsible for writing data to the hard-
ware component, and coded as a procedure (\! %D9$m7 m:;&:p2< , where the parameter is the output
message, is the selected address and is a control signal for writing.
In this program, the data can only be written after the flag } is reset. Notice that in the hardware
l
component the (CN wire of the flag indicator is linked to the control wire of the latch, which is driven
by the control signal . The assignment %D
@(E+.-K in the procedure 5) %D9)7 :; :pa2< ,
has the effect of setting the flag } .
The architecture of the hardware component of the synchronous multi-output interface is similar to that
of the hardware component of the synchronous multi-input interface. 15.
addr
Bus
y1
x y y2
data
Bus ......
yn
k
WR Flag
S R
F
The software component of the synchronous multi-output interface is the same as that of the synchronous
output interface.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
12 Hand Shaking Protocol for Embedded Computer System
This section explores two communication protocols used for transmitting data between the components
of the hardware/software mixed systems, where
The sender is not allowed to transmit a new data before the previous one has been input by the
receiver.
The receiver can input a data once after it has been output by the sender.
We propose the following hand shaking protocol to synchronise the hardware and software components
in an embedded system.
As a result, the hardware component of an embedded system will be in the following form
where the function will be fired after
is set, and the flag }6 is rising on its completion. In this
protocol, all flags is reset initially. Firstly the data is sent by the software component and processed by
the hardware component, then the result will be read by the software component. As one of the imple-
mentations, the structure of the protocol sees figure 16, where the wires 5) -C from the software
component connects to the input port of the hardware component. The wires j - of the software
component links to the output port ! of the hardware component. The address bus links to the hardware
directly.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
Hand Shaking Protocol for Embedded Computer System 13
R rst
S S
WR Fout ST-flag ST
k
Data-out
x
HW
data
Bus
Data-in y
g
RD Frdy FN
R S
Frdy
addr
Bus
In figure 16, the protocol for the software component is composed of the primitive output interface, the
synchronous input interface, the data output flag }EC which is set by the control signal and reset
by the signal %D(' , and the start flag
which is set by the output of }6D& in the rising edge of the clock
and reset after one clock cycle. The behaviour of
can be described using the Verilog module
To support synchronous communication in a multiple processor system we adopt the following protocol
Using this protocol, all flags is reset initially. where the wires 5) -D from the software component
connects to the input port of the hardware component. The wires 5j - of the software component
links to the output port ! of the hardware component. The address bus links to the hardware directly.
The structure of the protocol sees figure 17. where the component in the upper dashed box, composed
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
14 Conclusion
F12
WR S R
Flag RD’
k1 g2
w1 y2
x1
data data
Bus Bus’
y1 x2
w2
g1
k2
RD Flag WR’
R S
F21
P1 P2
of the synchronous output interface and the synchronous input interface, is used for transmitting data
from the processor to the co-processor, The component in the lower dashed box, used for transmitting
data from the co-processor back to the processor, is composed of the synchronous input interface and the
synchronous output interface.
As an example of using this protocol, we assume that the application system is made up of two pro-
cessors. The one is the main processor running the main program. The other one is the co-processor
managing the input and output devices, such as the keyboard and the LCD screen. In the system, the
co-processor can input and process the information from the keyboard, and then transmit it to the proces-
sor synchronously using the component in the lower dashed box. On the other hand, the processor can
display some outcomes of the main program in the LCD screen by transmitting them to the co-processor
synchronously using the component in the upper dashed box.
6 Conclusion
This paper shows how to apply the Bus extended technology in design of the communication interface for
the embedded systems. Firstly, we build the primitive input and output interfaces for processor, and then
implement the synchronous input and output interface. Finally as their applications, we devise a hand-
shaking protocol for the hardware and software components of the embedded systems, and a synchronous
communication protocol between the processor and the co-processor. The technique discussed in the
report can also be used in design of various links between the components of the hardware/software
mixed systems.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau
References 15
References
[1] Qin Shengchao and He jifeng, ‘An algebraic Approach to Hardware/Software Portioning’, In the
proceeding of IEEE conference ICECS’2K, the IEEE press, Lebanon, Dec., 2000.
[2] Rockson Huang. ‘Embedded Tools Target MPU/MCU Interface’. Aisys Inc., Electronic News, Oct
9,2000.
[3] Rolf Ernst. ‘Codesign of Embedded System: Status and Trends’. IEEE Design & Test of Comput-
ers. 1998
[4] Ulrich Golze. ‘VLSI Chip Design with the Hardware Description Language VERILOG’. Springer-
Verlag Berlin Heidelberg, 1996.
[5] Bob Moore. ‘SOC Should Mean ‘Software-on-a-Chip’ ’. CoWare Inc., Electronic News, Oct
23,2000.
[6] M. Chiodo et al. ‘Hardware-Software Codesign of Embedded Systems’. IEEE micro, Vol.14, No.4,
Jul.-Aug. 1994.
[7] J.Van den Hurk and J.Jess. ‘System-Level Hardware-Software Codesign’. Kluwer Academic,1998.
[11] Synopsys,Inc., ‘FPGA Compiler II/FPGA Express Verilog HDL Reference Manual’. May 1999.
Report No. 244, October 2001 UNU/IIST, P.O. Box 3058, Macau