FUZZY INFERENCE SYSTEM

10
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013 1635 CAD Tools for Hardware Implementation of Embedded Fuzzy Systems on FPGAs María Brox, Santiago Sánchez-Solano, Ernesto del Toro, Piedad Brox, and Francisco J. Moreno-Velo Abstract—This paper describes two computer-aided design (CAD) tools for automatic synthesis of fuzzy logic-based inference systems. The tools share a common architecture for efcient hardware implementation of fuzzy modules, but are based on two different design strategies. One of them is focused on the genera- tion of standard VHDL code, which can be later implemented on a recongurable device [eld-programmable gate array (FPGA)] or as an application-specic integrated circuit (ASIC). The other one uses the MATLAB/Simulink environment and tools for devel- opment of digital signal processing (DSP) systems on Xilinx’s FPGAs. Both tools are included in the last version of Xfuzzy, which is a specic environment for designing complex fuzzy systems, and they provide interfaces to commercial VHDL synthesis and verication tools, as well as to conventional FPGA development environments. As demonstrated by the included design example, the proposed development strategies speed up the stages of de- scription, synthesis, and functional verication of embedded fuzzy inference systems. Index Terms—Computer-aided design (CAD) tools, eld-pro- grammable gate arrays (FPGAs), fuzzy inference systems, hardware implementation. I. INTRODUCTION F UZZY logic provides an adequate tool to deal with the uncertainty and imprecision that are typical of the rea- soning system used by the human brain [1]. In particular, the capability of fuzzy systems to capture the knowledge of human experts and translate it into robust control strategies by means of IF–THEN rules similar to those employed in natural lan- guage (without the need for mathematical models) has moti- vated a considerable increase in the number of control appli- cations using techniques based on fuzzy inference in the last Manuscript received August 31, 2011; revised December 30, 2011; accepted October 17, 2012. Date of publication November 21, 2012; date of current ver- sion August 16, 2013. This work was supported in part by Spanish Ministerio de Economía y Competitividad under Project TEC2011-24319 and by Junta de Andalucía under Project P08-TIC-03674 (both with support from FEDER), and by the European Community through the MOBY-DIC Project FP7-INFSO- ICT-248858. The work of P. Brox is supported under the post-doctoral program “Juan de la Cierva” from the Spanish Government. Paper no. TII-11-472. M. Brox is with the Department of Computer Architecture, University of Cór- doba, Córdoba 14071, Spain (e-mail: [email protected]). S. Sánchez-Solano and P. Brox are with the Instituto de Microelectrónica de Sevilla (IMSE-CNM-CSIC), Seville 41092, Spain (e-mail: santiago@imse- cnm.csic.es; [email protected]). E. del Toro is with the Microelectronics Research Center (CIME-CUJAE), Havana 19390, Cuba (e-mail: [email protected]). F. J. Moreno-Velo is with the Department of Applied Physics and Electrical Engineering, University of Huelva, Huelva 21071, Spain (e-mail: francisco. [email protected]). Color versions of one or more of the gures in this paper are available online at http://ieeexplore.ieee.org. Digital Object Identier 10.1109/TII.2012.2228871 years [2]–[4]. Many different approaches for hardware imple- mentation of fuzzy systems by means of application-specic in- tegrated circuits (ASICs) or FPGAs have also been proposed in the literature [5]–[7]. The recent improvements in FPGA technologies has led to important advances in programmable logic devices, which allow the implementation of a complete system-on-a-pro- grammable chip (SoPC) [8]–[10]. In addition to the classical VHDL-based design ow [11]–[13], FPGA manufactures have recently developed different design tools, such as System Generator from Xilinx (XSG) [14], to ease the implementa- tion of digital signal processing (DSP) algorithms on FPGAs [15]–[17]. Hardware implementation of fuzzy inference systems is currently demanded by different applications of industrial control, robotics, or consumer electronics [18]–[25]. However, regarding the application of computational intelli- gence paradigms, to benet from these technological advances, the development of powerful CAD tools is necessary that allow automating the different design stages of a fuzzy inference system and translating its high-level description into an ef- cient hardware implementation. The use of adequate CAD tools reduces the development cycle of new products and makes them more competitive in market terms. The huge success of fuzzy logic in the last decade of the past century caused the development of many tools dedicated to the design of fuzzy inference systems. Most of these tools were focused on the acquisition of knowledge, i.e., the creation of fuzzy systems from a data set, the tuning of system parame- ters using learning algorithms, and the comparison of different fuzzy operators and inference approaches [26]–[29]. Many of the initially available commercial software (such as TIL Shell from Togai InfraLogic, FIDE from Aptronix, and FuzzyTECH from Inform) allowed generating optimized code for the dif- ferent families of microcontrollers existing in that epoch. Dif- ferent proposals for automatic synthesis of fuzzy systems using specic hardware based on analog and digital design techniques were also presented in those years [30]–[33]. Digital approaches were usually based on the generation of general-purpose or spe- cic VHDL code. More recently, a great number of different proposals use the facilities included in the MATLAB/Simulink environment for the design and hardware implementation of fuzzy systems on recongurable devices [34]–[38]. An interesting CAD tool that offers facilities for the whole development cycle of a fuzzy system is the Xfuzzy environ- ment [39]. Two hardware synthesis tools currently integrated into Xfuzzy are described in this paper. One of them employs a revised strategy based on VHDL, which generates code that can be synthesized and implemented on ASICs or FPGAs. The 1551-3203 © 2012 IEEE

description

CAD tools for Hardware implementation of embedded fuzzy system on fpgas

Transcript of FUZZY INFERENCE SYSTEM

Page 1: FUZZY INFERENCE SYSTEM

IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013 1635

CAD Tools for Hardware Implementation ofEmbedded Fuzzy Systems on FPGAs

María Brox, Santiago Sánchez-Solano, Ernesto del Toro, Piedad Brox, and Francisco J. Moreno-Velo

Abstract—This paper describes two computer-aided design(CAD) tools for automatic synthesis of fuzzy logic-based inferencesystems. The tools share a common architecture for efficienthardware implementation of fuzzy modules, but are based on twodifferent design strategies. One of them is focused on the genera-tion of standard VHDL code, which can be later implemented ona reconfigurable device [field-programmable gate array (FPGA)]or as an application-specific integrated circuit (ASIC). The otherone uses the MATLAB/Simulink environment and tools for devel-opment of digital signal processing (DSP) systems on Xilinx’sFPGAs. Both tools are included in the last version of Xfuzzy, whichis a specific environment for designing complex fuzzy systems,and they provide interfaces to commercial VHDL synthesis andverification tools, as well as to conventional FPGA developmentenvironments. As demonstrated by the included design example,the proposed development strategies speed up the stages of de-scription, synthesis, and functional verification of embedded fuzzyinference systems.

Index Terms—Computer-aided design (CAD) tools, field-pro-grammable gate arrays (FPGAs), fuzzy inference systems,hardware implementation.

I. INTRODUCTION

F UZZY logic provides an adequate tool to deal with theuncertainty and imprecision that are typical of the rea-

soning system used by the human brain [1]. In particular, thecapability of fuzzy systems to capture the knowledge of humanexperts and translate it into robust control strategies by meansof IF–THEN rules similar to those employed in natural lan-guage (without the need for mathematical models) has moti-vated a considerable increase in the number of control appli-cations using techniques based on fuzzy inference in the last

Manuscript received August 31, 2011; revised December 30, 2011; acceptedOctober 17, 2012. Date of publication November 21, 2012; date of current ver-sion August 16, 2013. This work was supported in part by Spanish Ministeriode Economía y Competitividad under Project TEC2011-24319 and by Juntade Andalucía under Project P08-TIC-03674 (both with support from FEDER),and by the European Community through the MOBY-DIC Project FP7-INFSO-ICT-248858. The work of P. Brox is supported under the post-doctoral program“Juan de la Cierva” from the Spanish Government. Paper no. TII-11-472.M. Brox is with the Department of Computer Architecture, University of Cór-

doba, Córdoba 14071, Spain (e-mail: [email protected]).S. Sánchez-Solano and P. Brox are with the Instituto de Microelectrónica

de Sevilla (IMSE-CNM-CSIC), Seville 41092, Spain (e-mail: [email protected]; [email protected]).E. del Toro is with the Microelectronics Research Center (CIME-CUJAE),

Havana 19390, Cuba (e-mail: [email protected]).F. J. Moreno-Velo is with the Department of Applied Physics and Electrical

Engineering, University of Huelva, Huelva 21071, Spain (e-mail: [email protected]).Color versions of one or more of the figures in this paper are available online

at http://ieeexplore.ieee.org.Digital Object Identifier 10.1109/TII.2012.2228871

years [2]–[4]. Many different approaches for hardware imple-mentation of fuzzy systems by means of application-specific in-tegrated circuits (ASICs) or FPGAs have also been proposed inthe literature [5]–[7].The recent improvements in FPGA technologies has led

to important advances in programmable logic devices, whichallow the implementation of a complete system-on-a-pro-grammable chip (SoPC) [8]–[10]. In addition to the classicalVHDL-based design flow [11]–[13], FPGA manufactures haverecently developed different design tools, such as SystemGenerator from Xilinx (XSG) [14], to ease the implementa-tion of digital signal processing (DSP) algorithms on FPGAs[15]–[17]. Hardware implementation of fuzzy inferencesystems is currently demanded by different applications ofindustrial control, robotics, or consumer electronics [18]–[25].However, regarding the application of computational intelli-gence paradigms, to benefit from these technological advances,the development of powerful CAD tools is necessary that allowautomating the different design stages of a fuzzy inferencesystem and translating its high-level description into an effi-cient hardware implementation. The use of adequate CAD toolsreduces the development cycle of new products and makesthem more competitive in market terms.The huge success of fuzzy logic in the last decade of the

past century caused the development of many tools dedicatedto the design of fuzzy inference systems. Most of these toolswere focused on the acquisition of knowledge, i.e., the creationof fuzzy systems from a data set, the tuning of system parame-ters using learning algorithms, and the comparison of differentfuzzy operators and inference approaches [26]–[29]. Many ofthe initially available commercial software (such as TIL Shellfrom Togai InfraLogic, FIDE from Aptronix, and FuzzyTECHfrom Inform) allowed generating optimized code for the dif-ferent families of microcontrollers existing in that epoch. Dif-ferent proposals for automatic synthesis of fuzzy systems usingspecific hardware based on analog and digital design techniqueswere also presented in those years [30]–[33]. Digital approacheswere usually based on the generation of general-purpose or spe-cific VHDL code. More recently, a great number of differentproposals use the facilities included in the MATLAB/Simulinkenvironment for the design and hardware implementation offuzzy systems on reconfigurable devices [34]–[38].An interesting CAD tool that offers facilities for the whole

development cycle of a fuzzy system is the Xfuzzy environ-ment [39]. Two hardware synthesis tools currently integratedinto Xfuzzy are described in this paper. One of them employsa revised strategy based on VHDL, which generates code thatcan be synthesized and implemented on ASICs or FPGAs. The

1551-3203 © 2012 IEEE

Page 2: FUZZY INFERENCE SYSTEM

1636 IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013

Fig. 1. Architecture for a Mamdani’s type fuzzy system with a processingstrategy based on active rules.

other one provides FPGA implementations based on XSG. Ittakes the advantages of flexibility and ease of configuration of-fered by MATLAB.The structure of this paper is as follows. Both design strate-

gies are based on an efficient hardware architecture for fuzzysystems, which is described in Section II. The first synthesistool, as well as the VHDL cell library supporting it, is detailedin Section III. The second tool and its associated cell librarydeveloped in Simulink are presented in Section IV. Section Villustrates a design example where a hierarchical fuzzy systemhas been generated from a set of numerical data by means of theidentification facilities provided by Xfuzzy. The design flow andthe supporting tools associated with both design strategies aredetailed here. Finally, Section VI summarizes the main conclu-sions of this work.

II. ACTIVE-RULE-BASED ARCHITECTURE FOR FUZZY SYSTEMS

From an implementation point of view, a fuzzy system iscomposed of three stages: fuzzification, inference, and defuzzi-fication. The fuzzification stage is in charge of accepting the in-puts to the inference system and evaluating the similarity degreebetween these inputs and the membership functions associatedwith the linguistic labels used in the rule antecedents. The infer-ence engine evaluates the different rules in the knowledge base.The activation degree of each rule is calculated from the acti-vation degree of its antecedents and according to the interpreta-tion of the different connectives in use. Finally, the conclusionsof the different rules are combined, and the defuzzification stageis used to provide the output of the inference system. The imple-mentation scheme followed by both automatic synthesis tools isbased on the architecture shown in Fig. 1. This architecture al-lows efficient implementations of digital fuzzy systems in termsof use of resources and inference speed. Its main characteristicsare the limitation of the overlapping degree of input member-ship functions, a processing strategy that evaluates only the ac-tive rules, and the use of simplified defuzzification methods [5],[22].The block diagram of this architecture illustrates the three

stages needed for the calculation of fuzzy inference based onMamdani’s model. In the fuzzification stage, the membership

functions circuits (MFCs) provide as many pairs “label, activa-tion degree” for each input value as overlapping de-gree has been fixed for the system. The different combinationsof these labels will determine the possible rules that are acti-vated. In the following stage, the inference process is carriedout by sequentially processing the active rules by means of anactive-rule selection circuit composed by a counter-controlledmultiplexer array. In each clock cycle, the membership degrees

from rule antecedents are combined within the connec-tive-antecedent operator circuit to calculate the activation de-gree of the rule , while the antecedent labels address therule memory location containing the parameters that define itscorresponding consequent. The number and meaning of theseparameters depend on the defuzzification method that is beingemployed [5] ( , , for Mamdani’s systems, and , , , forTakagi-Sugeno’s systems). In the defuzzification stage, a crispoutput value is obtained by processing the rule consequents withits different activation degrees, according to the selected de-fuzzification method. This stage is carried out in two processes:one that is in charge of the accumulation tasks and another thatperforms the division (if required), according to

(1)

for Mamdani’s or

(2)

for first-order Takagi-Sugeno’s systems. For Fuzzy Mean(where ) and Takagi-Sugeno methods, the divisionoperation can be avoided when (this condition is al-ways fulfilled for two-input inference systems using triangularmembership functions with an overlapping degree equal to twoand the product operator as antecedent connective).A control block in charge of controlling the operation of the

rest of blocks has been also included in the diagram.Regarding timing considerations, a different pipeline stage

may be introduced for each of the three stages in the architectureshown in Fig. 1. The minimum number of clock cycles requiredto perform the tasks associated with these pipeline stages willbe the greatest for: the maximum number of membership func-tions, the number of active rules, and the number of bits of theoutput. As an exception, systems that use specific defuzzifica-tion methods where the division process can be avoided requirefewer pipeline cycles, since they only perform the accumulationprocess in the last stage. In this case, the number of clock cyclesrequired for the system operation will only be the greatest of themaximum number of membership functions and the number ofactive rules.This architecture is characterized as being highly config-

urable due to the availability of different circuit realizations forthe blocks in Fig. 1 [22]. MFCs can be implemented using ei-ther memory- or arithmetic-based approaches. Memory-basedMFCs employ memory blocks to store the labels and member-ship degrees corresponding to each point of the input universeof discourse, thus allowing the use of fuzzy sets with unre-stricted shapes. Alternatively, arithmetic-based MFCs employarithmetic circuits to generate families of membership functions

Page 3: FUZZY INFERENCE SYSTEM

BROX et al.: CAD TOOLS FOR HARDWARE IMPLEMENTATION OF EMBEDDED FUZZY SYSTEMS ON FPGAs 1637

with triangular shapes (except for the first and last functions,which can be of type “Z” and “S”, respectively). An antecedentmemory block for each input stores, in this case, the values of“point, slope” defining their associated membershipfunctions. Using these values, the membership degree corre-sponding to a given input is calculated by an arithmetic blockthat performs the following operation when :

(3)

The designer can also choose between two options (productor minimum) for the connective used in the knowledge base ofthe inference system. Finally, depending on the kind of fuzzymodule being implemented, different defuzzifier blocks canbe selected: FuzzyMean, WeightedFuzzyMean, or first-orderTakagi-Sugeno, for interpolators; and MaxLabel, for deci-sion-making systems.Regarding arithmetic considerations, fixed-point arithmetic

is used by both design strategies. Input and output signals arenormalized in the interval . The user can select the word-lengths of input and output signals, membership degrees, slopes,and defuzzification weight factors using the graphical in-terfaces described in Sections III and IV. The position of thebinary point of slope values is automatically calculated in orderto achieve the higher precision possible for the selected word-lengths. Results of internal operations are truncated accordingto the number of bits used by the output signals. Finally, whendivision is required, a serial nonrestoring algorithm that only re-quires addition, subtraction, and shifts operators is performed.

III. HARDWARE SYNTHESIS WITH XFVHDL

In order to automate the design process with the proposedarchitecture, the VHDL-based technique has required the gen-eration of a library of configurable and synthesizable blocks de-scribed in VHDL language. The blocks of this library imple-ment the components of the architecture discussed in the pre-vious section. Different blocks have been designed for the gen-eration of membership functions, the sequential processing ofactive rules, the calculation of the rule activation degree, thestorage of consequents for the rulebases, the development oftasks of accumulation and division for different defuzzificationmethods, and the generation of control signals. The library alsocontains a set of crisp blocks that implement general purposearithmetic, such as addition, subtraction, multiplication or divi-sion functions, and logic operations, as a selector.Building a fuzzy system with this library implies choosing

and interconnecting the adequate elements, as well as assigningvalues to their parameters. VHDL descriptions of librarycomponents are parameterized by “generic” VHDL state-ments (generic parameters that are fixed when the componentis placed), which facilitates the design process automation.VHDL descriptions of these blocks verify the restrictionsimposed by the main synthesis tools, so they can be used asinput to ASIC and FPGA design environments in order to allowrapid development of prototypes built to validate new ideas orevaluate possible solutions.In order to speed up the design process based on this strategy,

a new version of the xfvhdl synthesis tool has been recently

incorporated into the Xfuzzy environment. This tool allowstranslating the high-level description of a fuzzy system writtenin XFL3 (the specification language shared by all the tools inXfuzzy) into a VHDL description that can be synthesized andimplemented on a programmable device or an application spe-cific integrated circuit. The graphical user interface (GUI) of thenew version of xfvhdl is shown in Fig. 2. The middle left arearepresents the knowledge base, structured as a pull-down menuwith components grouped under the categories “RuleBases”and “CrispBlocks.” When a particular rulebase is selected,the middle right area allows defining parameters related to thedimension of the system. This area also shows informationabout membership functions and fuzzy rules extracted from theXFL3 specification. The user can select the implementation op-tion for the antecedents: arithmetic- or memory-based. FPGAdevelopment tools usually allow selecting the type of memoryused in the implementation stage. For this reason, the user canalso choose the kind of memory (RAM, ROM or logical block)that will be used in MFC and rule memory blocks.When all of the architectural options have been selected

and the parameters related to the bus sizes have been defined,the fuzzy system components are identified by green marksclosed to them. Then, it is possible to generate the output filesby pressing the button “Generate VHDL code.” Basically, thisaction generates a VHDL description of the fuzzy system anda testbench, also described in VHDL, that allows verifying thefunctionality of the system. The VHDL file is based on theinterconnection of the library blocks that have been describedin the previous section. At the beginning of this file, a packageof constants is introduced. These constants are automaticallycalculated from the values extracted from the knowledge baseand the parameters related to the bus sizes that are introducedby the user. When the interconnection of library blocks isperformed, the generic parameters of each block are connectedto the constants defined in the package. This file also containstables of values with information about antecedents, rules,and consequents. Library blocks used for the defuzzificationmethod and the antecedents’ connective are extracted directlyfrom the XFL3 specification. However, other library com-ponents, as well as the VHDL description style included inthe code, depend on the architectural options that the userhas selected. Specifically, if the memory type chosen for theantecedents and rules memories is logical block, the descriptiongenerated for both memories is performed by means of a CASEstatement and, in the case of FPGA implementation, CLBs ofthe programmable device are configured as logic blocks. Whenthe selected option is ROM memory, if the user selects thecorresponding option, the synthesis tool can extract the ROMmemory to implement these descriptions. Finally, if the selectedoption is RAM memory, CLBs of the programmable device areconfigured as distributed RAM memory or embedded RAMmemory blocks (BRAMs) can also be used for the implemen-tation of antecedents and rules memories without consumingadditional resources of the FPGA. If the system is hierarchical,a VHDL description and a testbench file are generated for eachrulebase, which allows checking the control surface obtainedfor each one of them (as those shown in Fig. 6 of Section V).A structural VHDL description of the hierarchical system

Page 4: FUZZY INFERENCE SYSTEM

1638 IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013

Fig. 2. GUI of xfvhdl.

is also obtained, with a testbench that allows verifying thecorresponding input–output behavior. All of the testbenchfiles include the instantiation of the fuzzy system, a processthat provides a periodical clock signal, and another process togenerate the initial reset signal and a sweep of the input signalsused in the simulation of the system.

IV. HARDWARE SYNTHESIS WITH XFSG

The second design technique included in Xfuzzy is based onXSG. The Xilinx’s tool for the development of DSP systems onFPGAs is integrated into theMATLAB environment. It includes aSimulink library (Xilinx Blockset) that provides basic buildingblocks for digital systems design, as well as the software re-quired to translate Simulink models using these blocks to HDLdescriptions that can be implemented on FPGAs. Using this de-sign tool, a new library named XfuzzyLib has been generated toaccelerate the synthesis of fuzzy systems designed with Xfuzzy.This library includes different blocks to implement each of thestages of the active-rule based architecture for fuzzy inferencesystems described in Section II. Fig. 3(a) shows the Simulink li-brary browser utility illustrating the fuzzy components groupedby functionalities.With the help of XfuzzyLib, building a fuzzy inference system

requires choosing, interconnecting, and defining the parametersof the needed blocks. Modules in Xilinx Blockset library admita set of parameters to define their functionality, the size, andthe employed arithmetic. Similarly, once the block diagram of

a new component in XfuzzyLib library has been defined, thatelement can be encapsulated as a subsystem and a mask canbe added to identify its parameters. When the subsystem is in-stanced in a hierarchical level, parameters can be assigned usingnumerical values or by means of MATLAB variables. Numericalvalues of these variables can be later defined using the MATLABcommand window or an “.m” file. System functionality can beverified at any design stage using the facilities from Simulinkto generate excitation signals and to capture and display outputdata.In addition to the basic building blocks, XfuzzyLib also

includes elements describing basic fuzzy logic controllers(FLCs) that differ in the number of inputs, the connective usedto calculate rule activation degrees, and the defuzzificationmethod. Current version of XfuzzyLib incorporates 1-, 2-, and3-input FLCs using minimum and product as connectives andFuzzyMean, WeightedFuzzyMean, first-order Takagi-Sugeno,and MaxLabel defuzzification methods. When a user needs todevelop a fuzzy system tailored to a specific application, theseFLCs can be employed or a new architecture can be createdby interconnecting basic building blocks. Also it is possiblethe hierarchical combination of FLCs to define complex fuzzysystems. The block diagram of a 2-input FLC that uses productas connective and first-order Takagi-Sugeno as defuzzificationmethod is shown in Fig. 3(b).Just like basic building blocks from XfuzzyLib, blocks de-

scribing FLC architectures are fully parametrizable, making it

Page 5: FUZZY INFERENCE SYSTEM

BROX et al.: CAD TOOLS FOR HARDWARE IMPLEMENTATION OF EMBEDDED FUZZY SYSTEMS ON FPGAs 1639

Fig. 3. (a) Access to XfuzzyLib components through the Simulink Library Browser. (b) Simulink model of a two-input one-output FLC that uses product asconnective and first-order Takagi-Sugeno as defuzzification method.

possible to adapt its functionality according to the requirementof a particular application by defining the appropriated param-eters. Basically there are two types of parameters: those relatedto the dimension of the inference system, such as the bus sizefor inputs, outputs and membership degrees, and other relatedto the knowledge base of the system, such as the membershipfunctions and the rulebase. In order to facilitate its use to the de-signer, these parameters correspond to variables and data struc-tures, which can take numeric values using the Simulink graph-ical interface or an “.m” file. At this design level it is also pos-sible to use the facilities from MATLAB environment to verifythe functionality of the inference system. Specifically, it resultsinteresting the use of signal sources to explore the universe ofdiscourse of input variables, data acquisition blocks that allowobserving the temporal evolution of the system output, and datastorage elements that facilitate the graphical representation ofcontrol surfaces.The xfsg tool, recently incorporated into Xfuzzy, is able to

generate the files required to automate this design flow. TheGUI of this tool is similar to the interface provided by xfvhdlshown in Fig. 2. Once all of the components have been config-ured, xfsg generates an “.mdl” file containing a Simulink modelof the fuzzy system, and an “.m” file with the parameters thatdefine the size and functionality of its components. The gen-erated model includes a “System Generator” block that easesthe system implementation by translating the model to differentkinds of netlists and generating the bitstream file for the FPGA.XSG is also able to include the appropriated interfaces to cosim-ulate the hardware implementation of the controller in combi-nation with a mathematical model of the plant under control.

V. APPLICATION EXAMPLE

The above described synthesis tools have been applied to theimplementation of a fuzzy system that solves the problem of

double integrator, which represents a typical problem in con-trol engineering [40]. The designmethodology shown here com-bines the use of specific tools for development of fuzzy systemsfrom the Xfuzzy environment, VHDL synthesis tools, and mod-eling and simulation tools from MATLAB and ModelSim. Thedevelopment of the fuzzy control systemwith the synthesis toolsprovided by Xfuzzy will be carried out at the different stages il-lustrated in Fig. 4.The first stage of the design flow of a fuzzy controller is car-

ried out using the tools included in the Xfuzzy design environ-ment [41]. A fuzzy inference module is described in Xfuzzy bymeans of a XFL3 specification, which combines fuzzy rule-bases and crisp blocks (to perform inference tasks and to im-plement arithmetic and logic blocks, respectively). Knowledgerulebases can be directly defined by an expert operator (xfedit)or they can be extracted from numerical data using identifica-tion algorithms (xfdm). For a better performance, the member-ship functions as well as the rulebases can be simplified (xfsp).System parameters can be then adjusted by supervised learningtools (xfsl). Functional verification is carried out by two toolsincluded in Xfuzzy (xplot and xfsim). The first one allows ana-lyzing the input-output relation of the system. The second oneallows simulating its closed-loop behavior in combination witha Java-codified model of the plant. Fig. 5(a) shows graphicallythe description of the controller in Xfuzzy. This fuzzy systemhas been generated by using the identification tool xfdm withthe help of a set of numerical data. The system uses two rules-bases and a crisp block that performs the arithmetic operation ofsubtraction. Once validated the XFL3 specification with xfplotand xfsim (Figs. 6(a) and 7(c), respectively), the synthesis toolspresented in this paper are able to generate the files required tostart the second design stage.In this second stage, xfvhdl describes the system by a VHDL

code that combines different blocks of the VHDL library.The testbench file provided by this synthesis tool allows per-forming a functional verification of the VHDL description

Page 6: FUZZY INFERENCE SYSTEM

1640 IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013

Fig. 4. Fuzzy systems design flow using the hardware synthesis tools provided by Xfuzzy.

with the ModelSim simulation environment [Fig. 6(b)]. On theother hand, the equivalent system description as a Simulinkmodel provided by xfsg is shown in Fig. 5(b). The systemfunctionality can be verified at this design phase using thesimulation and graphical facilities provided by Simulink andMATLAB [Fig. 6(c)]. The similarity between the control sur-faces provided by both synthesis tools compared with the graphobtained with the Xfuzzy environment (Fig. 6) validates thehardware implementation provided by both design techniques.As shown in Fig. 4, the design flows for both techniques are

different. However, both flows can converge because Simulinkallows developing a model where the VHDL code generatedby xfvhdl can be included in a Black Box block provided by

the Xilinx Blockset library, which allows performing an HDLco-simulation where System Generator connects to the Mod-elSim or ISIM simulators.Finally, Simulink also allows carrying out a closed-loop

functional verification of any of the implementations describedabove, combining the cosimulation of a software model ofthe plant described in MATLAB and the hardware controllerimplementation on an FPGA.The hardware implementation of this controller using

arithmetic techniques for antecedents and ROM memory ofdistributed type (with twelve bits for input and output precisionin all the rules bases) consumes 185 Slices with xfvhdl and259 with xfsg (approximately 3% and 4%, respectively, of the

Page 7: FUZZY INFERENCE SYSTEM

BROX et al.: CAD TOOLS FOR HARDWARE IMPLEMENTATION OF EMBEDDED FUZZY SYSTEMS ON FPGAs 1641

Fig. 5. (a) Xfuzzy graphical representation of the double integrator. (b) Simulink model of double integrator generated by xfsg.

Fig. 6. Control surfaces generated by (a) Xfuzzy, (b) ModelSim, and (c) MATLAB/Simulink.

Fig. 7. (a) Closed-loop hardware cosimulation. (b) Results of the closed-loop verification. (c) Results of the closed-loop verification obtained with xfsim.

Slice resources available in a Spartan 3A FPGA from Xilinx).The controller also employs, for both techniques, four of the20 hardware multipliers available in the FPGA. As it hasbeen described above, different options can be selected for theantecedents and type of memory used in the implementation ofthe controller. As an example, Tables I and II contain FPGAresource utilization using xfvhdl with different implementationoptions. Table I shows the results after implementing thecontroller with the option of memory storage for antecedentsand ROM memory of block type. Table II includes the resultsobtained using the arithmetic option for antecedents and logicblock as type of implementation memory. Both tables detailimplementation data relative to the two rulebases and the crisp

block of the controller. Implementation results of the VHDLlibrary blocks used in the synthesis of each rulebase are alsoshown.Controllers for the double integrator problem implemented

with both synthesis tools are able to operate with the 50 MHzclock available at the FPGA development board, which meansa control cycle of 120 ns for the controllers considered in thiswork. Using hardware co-simulation it is possible to evaluatethe behavior of the fuzzy controller in a real scenario. As demon-strates the closed-loop simulation shown in Fig. 7, the perfor-mance of a 12-bit controller implemented on the FPGA boardand interacting with a high-level model of the plant [Fig. 7(b)]is similar to that obtained by the full-precision models used by

Page 8: FUZZY INFERENCE SYSTEM

1642 IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013

TABLE IIMPLEMENTATION RESULTS (SPARTAN 3A, 12 BITS) USING MEMORY FOR

ANTECEDENTS AND ROM MEMORY OF BLOCK TYPE

TABLE IIIMPLEMENTATION RESULTS (SPARTAN 3A, 12 BITS) USING ARITHMETICOPTION FOR ANTECEDENTS AND LOGIC BLOCK AS TYPE OF MEMORY

xfsim [Fig. 7(c)]. A quantitative analysis shows a mean error of0.007 between both results with a standard deviation of 0.004.

VI. CONCLUSION

Two design strategies for the automatic synthesis of fuzzy in-ference systems have been presented in this paper. They demon-strate that the availability of a design flow, supported by theuse of parameterized cell libraries and CAD tools, considerablyspeeds up the hardware implementation of fuzzy systems, fa-cilitating the exploration of the design space for a given appli-cation. One of the described tools is focused to hardware im-plementations of fuzzy systems on Xilinx’s FPGAs, while theother one provides synthesizable VHDL code for ASICs andFPGAs. Compared to previous releases of hardware synthesistools included in Xfuzzy [41], [42], the tools described in thispaper provide an improved functionality of most of the com-ponents included in the VHDL and Simulink libraries, such

as the generation of families of membership functions of type“sh_triangular” (where the first and last functions are Z- andS-shaped, respectively), as well as new operators that imple-ment arithmetic and logical crisp functions, and a new defuzzi-fication block for first-order Takagi-Sugeno’s systems. Both de-sign libraries have been also revised in order to increase theiroperational speed and reduce the resource consumption. Ad-ditionally, improved graphical interfaces that consider the newfeatures of the tools have been completely integrated into theXfuzzy environment. Finally, the most important advantage ofthe new release is the possibility of direct implementation of hi-erarchical fuzzy systems. As demonstrated by their applicationto an FPGA design example, the choice between the two designstrategies proposed in this paper allows obtaining an adequatetradeoff between “high system performance” (usually reachedby the VHDL based option) and “short design time” (providedby the XSG approach).

REFERENCES

[1] L. A. Zadeh, “Outline of a new approach to the analysis of complexsystems and decision processes,” IEEE Trans. Syst., Man, Cybern., vol.SMC-3, no. 1, pp. 28–44, Jan. 1973.

[2] T. J. Ross, Fuzzy Logic With Engineering Applications, 2nded. Hoboken, NJ: Wiley, 2004.

[3] J. Jarris, Fuzzy Logic Applications in Engineering Science. Berlin,Germany: Springer Verlag, 2006.

[4] R.-E. Precup and H. Hellendoorn, “A survey on industrial applicationsof fuzzy control,” Comput. Industry, vol. 62, no. 3, pp. 213–226, Apr.2011.

[5] I. Baturone, A. Barriga, S. Sánchez-Solano, C. J. Jiménez, and D.López, Microelectronic Design of Fuzzy Logic-Based Systems. BocaRaton, FL: CRC, 2000.

[6] K. Basterretxea and I. del Campo, “Electronic hardware for fuzzy com-putation,” in Scalable Fuzzy Algorithms for Data Management andAnalysis:Methods andDesign, Information Science Reference, A. Lau-rent and M.-J. Lessot, Eds. Hershey, PA, USA: Information Science,2009, pp. 1–30.

[7] A. H. Zavala and O. C. Nieto, “Fuzzy hardware: A retrospective andanalysis,” IEEE Trans. Fuzzy Syst., vol. 20, no. 4, pp. 623–635, Aug.2012.

[8] J. J. Rodriguez-Andina, M. J. Moure, and M. D. Valdes, “Features,design tools, and application domains of FPGAs,” IEEE Trans. Ind.Electron., vol. 54, no. 4, pp. 1810–1823, Aug. 2007.

[9] E. Monmasson, L. Idkhajine, M. N. Cirstea, I. Bahri, A. Tisan, and M.W. Naouar, “FPGAs in industrial control applications,” IEEE Trans.Ind. Inf., vol. 7, no. 2, pp. 224–243, May 2011.

[10] N. Sulaiman, Z. A. Obaid, M. H. Marhaban, and M. N. Hamidon, “De-sign and implementation of FPGA -based systems—A review,” Aus-tralian J. Basic Appl. Sci., vol. 3, no. 4, pp. 3575–3596, 2009.

[11] M. McKenna and B. M. Wilamowski, “Implementing a fuzzy systemon a field programmable gate array,” in Proc. Int. Joint Conf. NeuralNetworks, Jul. 2001, pp. 189–194.

[12] D. N. Oliveira, A. P. de Souza Braga, and O. da Mota Almeida, “Fuzzylogic controller implementation on an FPGA using VHDL,” in Proc.Fuzzy Inf. Process. Soc., Jul. 2010, pp. 1–6.

[13] G. Sakthivel, T. S. Anandhi, and S. P. Natarajan, “Real time implemen-tation of a fuzzy logic controller on FPGA using VHDL for DC motorspeed control,” Int. J. Eng. Sci. Technol., vol. 2, no. 9, pp. 4511–4519,2010.

[14] “System Generator for DSP User Guide,” Xilinx Inc., 2008, vol. v10.1[Online]. Available: http://www.xilinx.com

[15] M. Bahoura and H. Ezzaidi, “FPGA-implementation of a sequentialadaptive noise canceller using Xilinx System Generator,” in Proc. Int.Conf. Microelectron., Dec. 2009, pp. 213–216.

[16] A. Toledo, P. Navarro, F. Soto, J. Suardíaz, and C. Fernández, “Experi-ences on developing computer vision hardware algorithms using Xilinxsystem generator,” Microprocessors Microsyst., vol. 29, Special Issueon FPGAs: Case Studies in Comput. Vis. and Image Process., no. 8–9,pp. 411–419, Nov. 2005.

Page 9: FUZZY INFERENCE SYSTEM

BROX et al.: CAD TOOLS FOR HARDWARE IMPLEMENTATION OF EMBEDDED FUZZY SYSTEMS ON FPGAs 1643

[17] R. Sepúlveda, O. Montiel, G. Lizágarra, and O. Castillo, “Modelingand simulation of the defuzzification stage of a type-2 fuzzy controllerusing the Xilinx system generator and Simulink,” in Evolutionary De-sign of Intelligent Systems. Berlin, Germany: Springer-Verlag, 2009,vol. 257, pp. 309–325.

[18] Y. Kung, C. Huang, and M. Tsai, “FPGA realization of an adaptivefuzzy controller for PMLSM drive,” IEEE Trans. Ind. Electron., vol.56, no. 8, pp. 2923–2932, Aug. 2009.

[19] F. Taeed, Z. Salam, and S. M. Ayob, “FPGA implementation of asingle-input fuzzy logic controller for boost converter with the absenceof an external analog-to-digital converter,” IEEE Trans. Ind. Electron.,vol. 59, no. 2, pp. 1208–1217, Feb. 2012.

[20] C. Huang, W. Wang, and C. Chiu, “Design and implementation offuzzy control on a two-wheel inverted pendulum,” IEEE Trans. Ind.Electron., vol. 58, no. 7, pp. 2988–3001, Jul. 2011.

[21] H. Huang and C. Tsai, “FPGA implementation of an embedded robustadaptive controller for autonomous omnidirectional mobile platform,”IEEE Trans. Ind. Electron., vol. 56, no. 5, pp. 1604–1616, May 2009.

[22] S. Sánchez-Solano, A. Cabrera, I. Baturone, F. J. Moreno-Velo, andM. Brox, “FPGA implementation of embedded fuzzy controllers forrobotic applications,” IEEE Trans. Ind. Electron., vol. 54, no. 4, pp.1937–1945, Aug. 2007.

[23] Y. Fu, H. Li, andM. E. Kaye, “Hardware/software codesign for a fuzzyautonomous road-following system,” IEEE Trans. Syst., Man, Cybern.C, Applic. Rev., vol. 40, no. 6, pp. 690–696, Nov. 2010.

[24] C.-F. Juang and J.-S. Chen, “Water bath temperature control by a re-current fuzzy controller and its FPGA implementation,” IEEE Trans.Ind. Electron., vol. 53, no. 3, pp. 941–949, Jun. 2006.

[25] G. Louverdis and I. Andreadis, “Design and implementation of a fuzzyhardware structure for morphological color image processing,” IEEETrans. Circuits Syst. Video Technol., vol. 13, no. 3, pp. 277–288, Mar.2003.

[26] C. Kavka, M. Crespo, W. Geng, and F. Zhong, “A fuzzy controller de-velopment tool based on evolutionary techniques,” in Proc. CongressEvol. Computation, Jul. 1999, pp. 2145–2150.

[27] J. M. Alonso, L. Magdalena, and S. Guillaume, “KBCT: A knowledgeextraction and representation tool for fuzzy logic based systems,” inProc. IEEE Int. Conf. Fuzzy Syst., Jul. 2004, vol. 2, pp. 989–994.

[28] E. Moreira and A. Sousa, “FEUP fuzzy tool II improved tool for edu-cation and embedded control,” in Proc. CISTI’2010– Conf. Ibéricade Sistemas y Tecnologías de Información, Jun. 2010, pp. 1–6.

[29] S. Guillaumea and B. Charnomordicb, “Learning interpretable fuzzyinference systems with FisPro,” Inf. Sci., vol. 181, Special Issue onInterpretable Fuzzy Syst., no. 20, pp. 4409–4427, Oct. 2011.

[30] T. Hollstein, S. K. Halgamuge, and M. Glesner, “Computer-Aided de-sign of fuzzy systems based on generic VHDL specifications,” IEEETrans. Fuzzy Syst., vol. 4, no. 4, pp. 403–417, Nov. 1996.

[31] R. G. Carvajal, A. Torralba, and L. G. Franquelo, “AFAN: A tool for theautomatic synthesis of neural and fuzzy controllers with architectureoptimization,” in Proc. Int. Symp. Circuits Syst., Jun. 1997, vol. 1, pp.637–640.

[32] M. Re, M. Salmeri, and G. Cardarilli, “A CAD environment for fuzzysystems hw/sw mapping,” in Proc. Int. Symp. Circuits Syst., May 2000,pp. 221–224.

[33] D.KimandI.-H.Cho,“FADIS:Anintegrateddevelopmentenvironmentfor automatic design and implementation of FLC,” in Proc. Annu.Meeting North Amer. Fuzzy Inf. Process. Soc., Sep. 1997, pp.33–39.

[34] A. Bakhti and L. Benbaouche, “Simulink-DSP co-design of a fuzzylogic controller,” in Proc. Ind. Electron. Soc. Annu. Conf., Nov. 2006,vol. 1, pp. 4587–4592.

[35] I. H. Altas and A. M. Sharaf, “A generalized direct approach for de-signing fuzzy logic controllers in Matlab/Simulink GUI environment,”Int. J. Inf. Technol. Intell. Computing, vol. 1, no. 4, 2007.

[36] M. Shahrieel, S. Najib, E. Chee, I. Azmira, and M. Hendra, “Compar-ison of fuzzy control rules using MATLAB toolbox and Simulink forDC induction motor-speed control,” in Proc. Int. Conf. Soft ComputingPattern Recogn., Dec. 2009, pp. 711–715.

[37] C. Lu and J. Zhang, “Design and simulation of a fuzzy-PID compositeparameters’ controller with MATLAB,” in Proc. Int. Conf. Comput.Design Applications, Jun. 2010, pp. 308–311.

[38] O. Kobyrynka, Y. Stekh, and O. Markelov, “Comparison analysis ofmethods implemented in MATLAB for fuzzy logic algorithms,” Proc.CAD Syst. Microelectron., pp. 239–240, Feb. 2011.

[39] “Xfuzzy: Fuzzy Logic Design Tools,” IMSE-CNM, CSIC [Online].Available: http://www.imse-cnm.csic.es/Xfuzzy

[40] I. Baturone, M. C. Martínez-Rodríguez, P. Brox, A. Gersnoviez, andS. Sánchez-Solano, “Digital implementation of hierarchical piecewise-affine controllers,” in Proc. 20th Int. Symp. Ind. Electron., Jun. 2011,pp. 1497–1502.

[41] I. Baturone, F. J.Moreno-Velo, S. Sánchez-Solano, A. Barriga, P. Brox,A. Gersnoviez, andM. Brox, “UsingXfuzzy environment for the wholedesign of fuzzy systems,” in Proc. IEEE Int. Conf. Fuzzy Syst., Jul.2007, pp. 517–522.

[42] S. Sánchez-Solano, M. Brox, E. del Toro, P. Brox, and I. Baturone,“Model-Based design methodology for rapid development of fuzzycontrollers on FPGAs,” IEEE Trans. Ind. Inf., vol. PP, no. 99, pp. 1–1,2012.

María Brox received the B.Sc. degree (with honors)in physics from the University of Córdoba, Córdoba,Spain, in 2004, and the M.Sc. degree in microelec-tronics from the University of Seville, Seville, Spain,in 2008.From 2005 to 2007, she held a postgraduate fel-

lowship from the Spanish Government with the In-stituto de Microelectrónica de Sevilla (IMSE-CNM-CSIC), Seville, Spain. She is currently an AssistantProfessor with the Department of Computer Archi-tecture, University of Córdoba, Córdoba, Spain. Her

research area is the development of automatic CAD tools for the design of em-bedded fuzzy controllers on FPGAs.

Santiago Sánchez-Solano received the B.Sc. (withhonors) and Ph.D. degrees from the University ofSeville, Seville, Spain, in 1980 and 1990, respec-tively, both in physics.After six years as a System Analyst with the Com-

puter Center, University of Seville, Spain, he joinedthe Instituto de Microelectrónica de Sevilla (IMSE-CNM-CSIC), Seville, where he is currently a Scien-tific Researcher. He is the coauthor of two books and150 scientific papers and has participated in 25 re-search projects funded by different organisms, acting

in seven of them as lead researcher. His research interests include very largescale integration design, computer-aided-design tools for microelectronic de-sign, and hardware implementation of neuro-fuzzy systems.

Ernesto del Toro received the B.Sc. degree in au-tomation engineering and Ph.D. degree in electronicsfrom the Instituto Superior Politécnico J.A.E. of Ha-vana (CUJAE), Havana, Cuba, in 2004 and 2012, re-spectively.He held a MAEC-AECID Ph.D. scholarship from

the Spanish Government in the Instituto de Micro-electrónica de Sevilla (IMSE-CNM-CSIC), Seville,Spain, from 2008 to 2011. Currently, he is a Professorof electronics and a Research Assistant with the Mi-croelectronics Research Center (CIME-CUJAE), Ha-

vana, Cuba. His research interests include embedded computing, hardware/soft-ware codesign and algorithm acceleration.

Piedad Brox received the B.Sc. degree from the Uni-versity of Córdoba, Córdoba, Spain, in 2002, and thePh.D. degree (with honors) from the University ofSeville, Seville, Spain, in 2009, both in physics.Since 2002, she has been with the Instituto de

Microelectrónica de Sevilla (IMSE-CNM-CSIC),Seville, Spain, or with the University of Seville.Currently, she is a Postdoctoral Researcher under the“Juan de la Cierva” program funded by the SpanishGovernment. Her research areas include the designand implementation of neuro-fuzzy systems and

its application in image processing, and digital implementation of embeddedcontrollers.

Page 10: FUZZY INFERENCE SYSTEM

1644 IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, VOL. 9, NO. 3, AUGUST 2013

Francisco J.Moreno-Velo received the B.Sc. degreein physics and B.Sc. and Ph.D. degrees in computerscience from the University of Seville, Seville, Spain,in 1995, 1996 and 2003, respectively.From 1996 to 1999, he was an Assistant Professor

with the Department of Applied Physics and Elec-trical Engineering, University of Huelva, Huelva,Spain. From 2000 to 2003, he was a PostgraduateResearch Fellow at the Instituto de Microelectrónicade Sevilla (IMSE-CNM-CSIC), Seville. Currently,he is an Associate Professor with the Department of

Information Technologies, University of Huelva, Huelva. Spain. His current re-search interests include fuzzy systems, softcomputing techniques, developmentof computer-aided design tools for fuzzy systems, and compiler design.