You are on page 1of 4

Design, testing and prototyping of a software

programmable 12C/SPI IP on AMBA bus

L. Bacciarelli, G. Lucia, S. Saponara, L. Fanucci M. Forliti


Dept. of Information Engineering, SensorDynamics AG
University of Pisa Via Giuntini 25, 1-56123 Navacchio (Pisa), Italy
Via Caruso, 1-56122, Pisa - ITALY

Abstract- While power consumption and area occupation are of serial protocols are actually used, so if a designer wants to
always critical constrains in System-on-Chip design, at the create a SoC that can communicate using various protocols
same time high communication flexibility is required, due to he must equip his system with a large number of interfaces,
proliferation of communication protocols. In this work a novel despite the fact that when the SoC is on the field usually only
architecture for an 12C/SPI interface for APB AMBA bus is few of the supported protocols will be used. This means that
presented, showing how it is possible to merge flexibility and a large amount of area remains unused and on the system bus
reduced area occupation. Large part of this work is centered are appended various useless structures. At the same time, if
on the testing and FPGA prototyping of this IP. CMOS there is not a pad sharing, a large number of pads remain
synthesis results on 0.18 gm standard cell library are also unused. Moreover a high number of pads lead to a pad-
presented.
limited structure that implies packaging problems and
increased product cost.
I. INTRODUCTION In this work an IP macrocell used as serial interface is
In telecommunications, consumer and industrial presented. The idea is to merge two different interfaces: a
electronics, there are often many similarities between Serial Peripheral Interface (SPI) and an Inter-Integrated
seemingly unrelated designs. For example, nearly every Circuit (12C) one [1] in a unique software programmable
system includes: structure. Taking pad reduction as a priority the pads are
* Some intelligent control, usually a microcontroller
shared between the two modules. The proposed IP cell was
core; originally developed for a single chip used in sensor signal
conditioning integrating a LEON2 [2] processor (32-bit
* General-purpose circuits like LCD drivers, remote SPARCV8 architecture) and several interfaces appended to
I/0 ports, RAM, EEPROM, or data converters; LEON AMBA APB (Advanced Peripheral Bus) bus [3]. In
order to reuse the designed IP it is useful to note that a large
* Application-oriented circuits for communication number of microcontrollers, like the wide spread ARM ones,
interfaces and/or computation intensive task. actually works with AMBA bus [4-6]: AMBA is becoming a
The general trend is to integrate all the components on a defacto standard for System-on-Chip buses.
unique System on Chip (SoC) that collects all available
blocks. In such scenario the reuse of intellectual property II. 12C AND SPI STANDARD SPECIFICATION
(IP) macrocells is becoming the center of gravity for design 12C is a patented protocol developed by Philips
productivity and the key for being able to produce chips that Semiconductors. The 12C bus is a half-duplex, synchronous,
really work. All the integrated components must be multi-master bus requiring only two signal wires: data
connected each other and every SoC must be linked each (SDA) and clock (SCL). It uses an addressable
other in an efficient way that allows a fast and error-free communication protocol that allows the master to
communication. In industrial and automotive environment communicate with individual slaves using a 7-bit or 10-bit
the realization of networks of electronic control units (ECU) address. The 12C protocol allows three communication speed
is becoming even more crucial to handle the high quantity of ranges: standard (less than 100Kbps), fast (up to 400Kbps),
data requested by actual applications. The communication and high-speed (up to 3.4Mbps), each downward compatible.
among SoC is the key to grant high performances: the most 12C bus distances are generally limited to on-board
used solution for interconnecting SoC is a serial bus which communications, although it is possible to use 12C
presents great advantage in terms of costs. Using few wires
to link different devices means few occupied area and successfully over distances of 15 meters. The true limit to
consequently minor costs for the producer. A large number distances is the bit-rate and capacitance of the bus. As such,
for off-board communications, 12C is practically limited to

1-4244-0157-7/06/$20.00 p2006 IEEE 373


less than 3 meters for moderate speeds. As shown in [7-9] lowest one (single IP) and terminating with the highest one
12C protocol is used in various IC with different purpose, (system); particularly the verification process was composed
proof of its high flexibility. by four steps in ascending hierarchy order: block-level, bus-
level, system level simulations and hardware emulation [11]
SPI is a synchronous serial bus protocol developed by as shown in Fig. 2.
Motorola and integrated in many of their microcontrollers
[10]. SPI bus consists of four signals: master out slave in The block- and bus-level simulations aimed to verify the
(MOSI), master in slave out (MISO), serial clock (SCK), and IP functionality when it is considered as stand alone. The
active-low chip select (CS). As a multi-master/slave checks were related to the reset condition (signals and
protocol, communications between the master and selected register values), to the register read/write accesses and to the
slave use the unidirectional MISO and MOSI lines, to IP behaviour while performing its functionality. The IP-level
achieve data rates over 1Mbps in full duplex mode. A simulation requires a master agent (for register accesses), a
disadvantage to SPI is the requirement to have separate CS slave model (to be accessed by the DUT) and for bus
lines for each slave. As consequence for small, low-pin- peripherals a bus functional model (BFM). At this level a
count microcontrollers, a multi-slave SPI interface might not self-checking testbench using VHDL language has been
be a viable solution. written.
The system-level simulation aimed to verify the correct
III. PROPOSED ARCHITECTURE IP behaviour once it is plugged in a system. The main
This 12C/SPI interface is a software programmable difference compared to the previous phases is that in this
device, working as 12C or SPI interface whose internal environment the host CPU was used to perform all
registers are accessible through the AMBA APB bus. A operations needed to verify the IP. This means that software
configuration bit allows the host CPU to switch from one patterns in Assembly language were written to check its
protocol to the other one. System clock division allows wide functionality. The use of software to perform various checks
range of bit rates for both communication protocols. The didn't prevent the self-checking characteristic to be
design is fully synchronous and low power oriented. I/0 exploited: the expected results was written along the
pads and internal registers are shared between 12C and SPI. Assembly code rather than in VHDL; finally the mechanism
to alert the user in case of failure was slightly different, using
The block diagram of the device is shown in Fig. 1. It is some I/0 signals as flag to indicate the status of the test
possible to see that the APB interface and the pin are shared (running, finished, successful or failed).
between the 12C and SPI modules. In this way the amount of
unused area is reduced to the minimum. SPI protocol uses The host core used was the LEON-2 developed by the
more pin than 12C (at least 4 instead of 2) so some pins are European Space Agency (ESA) that is a 32-bit RISC
SPI-dedicated while the others are shared between the two
modules. The IP is described in VHDL language and fully
integrate in the LEON environment; a high number of tests
are developed to grant functionality and compliance with the
standards requests.

IV. . VERIFICATION FLOW AND PROTOTYPING


The validation of the 12C/SPI interface has been
performed at different verification levels, starting from the

Figure 1. Block diagram of the 12C/SPI macrocell


Figure 2. Verification flow

374
designed for embedded applications and targeting both the TABLE I. INTEGER REGISTER
ASIC and FPGA markets. A block diagram of the entire Integer registers Alternate names Group names
system can be seen in Fig. 3. %rO-%r7 %gO-%g7 Global registers
SPARC defines general-purpose integer, floating-point, %r8-%rl 5 %oO-%o7 Output registers
and special state/status registers and 72 basic instruction
operations, all encoded in 32-bit wide instruction formats. %rl 6-%r23 %10-%17 Local register
Particularly the integer units provides thirty-two general
purpose registers and grouped in overlapping register %r24-%r31 %iO-%i7 Input registers
windows. The alternate names of the registers and their
functions are summarized in Table I while the register
windows organisation is shown in Fig. 4.
The procedures of Transmission (TX) and Reception
(RX) that together with the Setup procedure were the main
calls of the interface drivers have been written using the
optimized leaf procedures technique described in the SPARC
V8 architecture manual [12]. A leaf procedure is one that
doesn't call (e.g. via CALL or JMPL) any other procedures.
Non-optimized leaf as well as ordinary procedures use a
SAVE instruction to allocate a stack frame and obtain a
register window for itself, and a corresponding RESTORE
instruction to deallocate it.
Figure 4. Register windows organisation
The time costs associated with this are:
* Possible generation of register-window overflow To improve the performance and to optimize the handle
/underflow traps at runtime. This only happens of the peripheral, saving both time and space, the procedures
occasionally, but when either underflow or overflow used for the 12C/SPI interface were made to operate without
does occur, it costs dozen of machine cycles to their own register window or stack frame, using their caller's
process. instead. According with this policy have been used just
registers that its caller already assumes to be volatile across a
* The two cycles expanded by the SAVE and procedure call, namely, %o0...O%o5, %o7 and %gl.
RESTORE instructions themselves. The last step was the hardware emulation phase: the
The space costs associated with this convention are: system was being mapped onto a prototyping board and all
software patterns written for the system-level simulations
* The space occupied on the stack by the procedure's were compiled and loaded in the board memory. Each test
stack frame. became a program running on the board and produced a
* The two words occupied by the SAVE and positive result in case the test for the interface was passed, or
RESTORE instructions negative result otherwise. This phase allowed useful timing
verification, since the IP was verified at system level in the
Of the above costs, the trap-processing cycles are real hardware environment increasing the level of reliability.
typically the most significant. The board used was a VIRTEX II (XC2V1000-4FG456C)
[13] based development board from Memec design [14]. The
P160 [15] expansion communications module which enables
further application specific prototyping and testing and
provides an 12C port and an SPI port has been also used.
First the LEON-2 core and the new IP added on the APB
BUS have been configured, then the synthesis with
Synplicity Synplify Pro [16] has been performed producing a
file in EDIF format. The synthesis results presented in Table
II are the total amount of lookup tables (LUT) used. In a
Xilinx Virtex-II FPGA circuit the LUT cells can implement
any logic function with up to four input variables. The
XC2V1000 has 10240 LUTs. Xilinx ISE [17] has been used
for place and route and programming phase of the board via
JTAG cable. The maximum working frequency is 33.275
MHz.
Figure 3. Block diagram of the LEON featuring 12C/SPI To probe the 12C BUS and the SPI BUS a digital
oscilloscope has been used then two commercial memories

375
TABLE II. FPGA SYNTHESIS RESULTS TABLE IV. STATE-OF-ART SPI-I2C CONTROLLERS
Components Complexity: 4-input LUTs Module Area Max. Freq
50 MHz SPI/
12C\SPI Module 1049 LUTs SPI Controller 6600 gates 250 MHz
WISHBONE Bus
LEON2 7746 LUTs
LEON2 feat. I2C\SPI 8710 LUTs 12C Controller 4400 gates 3.4 MHz I2C
have been used to check in hardware the functionality of
both interfaces. Particularly a Serial SPI BUS EEPROM Synthesis results on 0.18 ptm CMOS technology are also
M95256 by ST [18] and a Microchip 24LC256 serial (12C) presented and favourably compared with the state-of-art. The
EEPROM [19] have been used. compliance to the 12C/SPI protocols and the interoperability
of the new interface have been fully verified.
V. SYNTHESIS RESULTS ON CMOS TECHNOLOGY
Table III reports synthesis results obtained by logic REFERENCES
synthesis of the proposed IP macrocell on a target 0.18 pim [1] "The 12C Specification," Version 2.1, Philips Semiconductors
CMOS standard-cells library at 1.8 V supply. The achieved [2] The LEON-2 Processor User's Manual, Version 1.0.10 Jan 2003
results demonstrate that the SPI/12C module has limited [3] "AMBATM Specification", Revision 2.0, ARM IHI 0011A, ARM
circuit complexity (less than 5 kgates) and power [4] J. Riesco, J. Diaz, P. Plaza, "The tPP ASIC: design, methodologies
consumption (less than 0.5 mW for typical applications at 20 and tools for a pay phone system-on-a-chip based on an ARM core
MHz on the APB bus) while the speed performance allows and design reuse", IEEE Custom Integrated Circuits, 1999, 16-19
for max possible data rates on the SPI and 12C bus and is May 1999, pp. 635 - 638
well beyond the target clock frequency for the APB bus in [5] J. Park, I. Kim, S. Kim, S. Park, B. Koo, K. Shin, K. Seo, J. Cha,
typical applications. "MPEG-4 video codec on an ARM core and AMBA" Workshop and
Exhibition on MPEG-4, 18-20 June 2001, pp. 95 - 98
The proposed IP well behave when compared to state-of- [6] P. Kiatisevi, L. Azuara, R. Dorsch, H. Wunderlich, "Development of
art 12C or SPI units. For comparison are reported in Table IV an audio player as system-on-a-chip using an open source platform"
IEEE Int. Symposium on Circuits and Systems (ISCAS), 2005, 23-26
area occupation and operating frequency of a commercial May 2005, pp. 2935 - 2938, vol. 3
SPI Flash Controller by ASIC ws [20] and an I2C [7] C.-H. Wei, Y.-C. Lin, "Implementation of local area digital audio
Master/Slave interface [21] on 0.18 ptm CMOS technology: broadcasting system upon 12C network", IEEE MWSCAS '04, 25-28
Since it was not possible to find a commercial IP that merges July 2004, pp. 463-466, vol.3
12C and SPI protocol the comparison was done only with [8] P. Baron et al. "MATE, a single front-end ASIC for silicon strip,
SPI or 12C modules Si(Li) and CsI detectors" IEEE Nuclear Science Symposium
Conference Record, 2003 vol. 1, 19-25 Oct. 2003, pp. 386 - 390
[9] D. Barrettino et al., "Hotplate-based conductometric monolithic
CONCLUSIONS
VI. CMOS gas sensor system", Symposium on VLSI Circuits, 2003, June
A novel 12C/SPI software programmable interface for 2003,pp.1577 160
APB bus has been implemented. The synthesis results show [10] "M68HC1 1 Microcontrollers Reference Manual", v.6, Motorola
an operating frequency comparable with other commercial [11] L. Fanucci, A. Giambastiani, C. Rosadini, "VLSI Design and
IPs and at the same time a reduced area occupation with a Verification Methodologies for Automotive Embedded Systems",
IEEE Int. Symposium on Signals, Circuits & Systems, pp. 261-264,
high flexibility granted by software programmability. An Iasi, Romania, July 10-11, 2003
exhaustive verification flow has been exploited. A fast [12] SPARC International Inc. (1992), "The SPARC Architecture Manual,
prototyping of the whole system (LEON + 12C/SPI interface) Version 8, Rev. SAV080SI9308", SPARC International Inc.,
has been performed on a MicroBlazeTM MB2V1000 http://www.sparc.org/standards/V8.pdf
development board achieving an FPGA occupancy of 8710 [13] "Virtex-II Platform FPGAs: Complete Data Sheet" DS031 (v3.4)
Xilinx LUTS out of the 10240 available. March 1, 2005
[14] "Virtex-IITM V2MB1000 Development Board - User's Guide",
Version 3.0, December 2002
TABLE III. CMOS SYNTHESIS RESULTS
[15] "P160 Communications Module User Guide", v2.0, Dec. 2002
Area 12C/SPI module 4535 gate [16] Synplicity Synplify Pro Reference Manual, June 2003
[17] Xilinx ISE Synthesis and Verification Design Guide
80 MHz (SPI) [18] ST EEPROM M95256 datasheet, www.ST.com
Max. Freq 3.4 MHz (12C) [19] Microchip 24LC256 serial (12C) EEPROM datasheet,
160 MHz (APB bus) www.microchip.com
[20] "SPI Flash Controller", www.asics.ws/doc/spi wb brief.pdf
Dynamic Power |,uW]
450
Dynamic Power IPIWI
(with APB bus clock at 20 MHz) [21] "IIC MS", www.shi-works.com/peripherals.48.0.html
Static Power IpiWi 0.33

376

You might also like