How to interface FPGAs to microcontrollers.docx

上传人:b****0 文档编号:9199746 上传时间:2023-05-17 格式:DOCX 页数:15 大小:590.42KB
下载 相关 举报
How to interface FPGAs to microcontrollers.docx_第1页
第1页 / 共15页
How to interface FPGAs to microcontrollers.docx_第2页
第2页 / 共15页
How to interface FPGAs to microcontrollers.docx_第3页
第3页 / 共15页
How to interface FPGAs to microcontrollers.docx_第4页
第4页 / 共15页
How to interface FPGAs to microcontrollers.docx_第5页
第5页 / 共15页
How to interface FPGAs to microcontrollers.docx_第6页
第6页 / 共15页
How to interface FPGAs to microcontrollers.docx_第7页
第7页 / 共15页
How to interface FPGAs to microcontrollers.docx_第8页
第8页 / 共15页
How to interface FPGAs to microcontrollers.docx_第9页
第9页 / 共15页
How to interface FPGAs to microcontrollers.docx_第10页
第10页 / 共15页
How to interface FPGAs to microcontrollers.docx_第11页
第11页 / 共15页
How to interface FPGAs to microcontrollers.docx_第12页
第12页 / 共15页
How to interface FPGAs to microcontrollers.docx_第13页
第13页 / 共15页
How to interface FPGAs to microcontrollers.docx_第14页
第14页 / 共15页
How to interface FPGAs to microcontrollers.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

How to interface FPGAs to microcontrollers.docx

《How to interface FPGAs to microcontrollers.docx》由会员分享,可在线阅读,更多相关《How to interface FPGAs to microcontrollers.docx(15页珍藏版)》请在冰点文库上搜索。

How to interface FPGAs to microcontrollers.docx

HowtointerfaceFPGAstomicrocontrollers

HowtointerfaceFPGAstomicrocontrollers

RocendoBracamontesDelToro,Atmel

7/30/20082:

12PMEDT

AsmanyashalfofallembeddeddesignshaveanFPGAnexttoamicrocontroller.TheFPGAcanbeusedtoimplementanythingfromgluelogic,tocustomIP,toacceleratorsforcomputationallyintensivealgorithms.Bytakingonsomeoftheprocessingtasks,FPGAshelptoimprovesystemperformance,therebyfreeinguptheMCUfromcycle-intensivetasks.FPGAsalsoprovideexcellentperformancecharacteristicsandlotsofflexibilitytoaccommodatechangingstandards.

TherearetwobasicimplementationsofMCU-plus-FPGAdesigns:

puttingasoftMCUcoreintotheFPGAlogicstructureorusingastandardproductMCUwithadiscreteFPGA.PuttingasoftcoreintotheFPGAcanbeeffective,butitcanalsobeanexpensiveandpower-hungrywaytoimplementamicrocontrollerwhencomparedtoastandardproduct.Thisisespeciallytruewhenusinga32-bitARM-basedcore.Asaresult,onlyaboutone-thirdofFPGA-plus-MCUdesignsareimplementedwithanMCUcoreinsidetheFPGAlogic.Theremainingtwo-thirdsconsistofastandardproductmicrocontrollernexttoadiscreteFPGA.

NeitherstandardproductmicrocontrollersnorFPGAsweredevelopedtocommunicatewitheachotherefficiently.Theyevenusedifferentlanguages.Thus,interfacingthetwocanbeachallenge.FPGAsdonothaveanydedicatedlogicthatcommunicateswithmicrocontrollers.Thislogicmodulemustbedesignedfromscratch.Second,thecommunicationbetweenthemicrocontrollerandFPGAisasynchronous.SpecialcareisneededtoresynchronizetheMCUtotheFPGAclockdomain.Finally,thereisanissueofbottlenecks,bothattheinterfaceandontheMCUbus.TransferringinformationbetweentheMCUandtheFPGAusuallyrequirescyclesontheMCUbusandusuallytiesuptheresource(PIOorEBI)usedtoeffectthetransfer.CaremustbetakentoavoidbottleneckswithexternalSRAMorFlashandontheMCUbus.

TherearebasicallythreehardwareoptionsforinterfacingtheFPGAtotheMCU:

programmableI/O(PIO);externalbusinterface(EBI),ifavailable;and,finally,adedicatedinterfacebetweenbuiltintotheMCUbetweentheadvancedhigh-speedbus(AHB)andtheFPGA.Whichapproachtousedependsontheendapplicationandthedesiredresult.

PIOInterface

InterfacingtheMCUtotheFPGAviathePIOisrelativelysimpleforsimpledatatransfers,consistingofthetransferof32bitsofaddress,32bitsofdata,andsomecontrolsignalsforcontrol.Thisrequiresa32-bitPIOandanadditional2-bitsonanotherPIO(Fig1).

1.PIOinterfacetoFPGA.

(Clickthisimagetoviewalarger,moredetailedversion)

ForatransferofdatatotheFPGA,thedirectionofthebidirectionalbuffersinthePIOmustbesettooutput.ThesoftwarealgorithmthattransfersdatatotheFPGAisasfollows:

PIO_DATA=ADDRESS;//Passtheaddresstowrite

PIO_CTROL=START|WR;//Sendstartofaddresscycle

PIO_CTROL=CLEAR;//ClearPIOctrl,thisendstheaddresscycle

PIO_DATA=DATA;//Setdatatotransfer

PIO_CTROL=START;//DataisreadyinPIO

PIO_CTROL=CLEAR;//Thisendsthedatacycle

ReadingfromtheFPGAissimilar.Again,thedirectionofthebufferonthePIOmustfirstbesettooutputandthenchangedirectionstoinputtoreadthedatafromtheFPGA,thefollowingcodeisexecuted:

PIO_DATA=ADDRESS;//Settheaddresstoread

PIO_CTROL=START|RD;//Sendstartofaddresscycle

PIO_CTROL=CLEAR;//ClearPIOctrl,thisendstheaddresscycle

PIO_DATA_DIR=INPUT;//SetPIO-Datadirectionasinputtoreceivethedata

DELAY(WAIT_FOR_FPGA);//waitfortheFPGAtosendthedata

DATA_FROM_FPGA=*PIO_DATA;//ReaddatafromFPGA

Theabovealgorithmsareforabasictransfer,amoresophisticatedalgorithmisnecessarytoestablishapropercommunicationbetweentheARMmicrocontrollerandtheFPGA.Specialcareisnecessarytoensuretheacknowledgmentofdata,e.g.nodatahasbeenlostduetospeedorwaitcyclesoneachside.

Theaccesstimeiscalculatedasthesumof:

TAccess-PIO=t1+addressphase+t2+dataphase

UsingtheGCCcompilerwithmaximumoptimizations,thesystemtakesapproximately55AHBcyclestoperformthewriteoperationtotheFPGA(Fig2).

2.PIOwritetoFPGA.

(Clickthisimagetoviewalarger,moredetailedversion)

Assumingt2(waitforFPGAresponseready)isalsoaround25AHBcycles,thesystemtakesapproximately85AHBcyclesforareadoperationfromFPGA(Fig3).

3.PIOreadfromFPGA.

(Clickthisimagetoviewalarger,moredetailedversion)

TheinterfacefromtheMCUitselfisfairlysimpleandstraightforward.However,speciallogicmustbeimplementedintheFPGAtodecodeallthetrafficgeneratedbythePIO.Inthemajorityofcases,thetrafficfromthemicrocontrolleriscompletelyasynchronous.Asaresult,theFPGAmustbeabletooversamplethecontrolsignalsfromthemicrocontroller;otherwisetheFPGAwillmissthetimewindowandthetrafficwillnotarriveatthefinaldestinationinsidetheFPGA.

SincetheprocessoristheoneinchargeofkeepingthePIObusy,thereisanoverheadofprocessingtime.WhiletheCPUisengagedindatatransfers,itcannotdoanythingelse.Thus,thissolutionhasthepotentialtobogdownsystemprocessing.DMAisnotpossibleusingaPIOinterface,sothesoftwareprogrammermustlimitdatabandwidthtoallowforothercommunicationwiththeMCU.Forexample,ifthereisaroutinethatdemands100%oftheprocessorscyclesrunningconcurrentlywithaserial(SPI,USARTorTWI)transfertoorfromtheFPGA,thenoneofthesetwoprocessesmustwait.IfthedatagoingtoorcomingfromtheFPGAisnotbufferedontime,itwillprobablybeoverrunbythenextbyte/wordofdata.Inessence,theembeddedprocessorbecomesaglorifieddatamover.

InterfacingthroughtheExternalBusInterface(EIB)

Many32-bitmicrocontrollershaveanexternalbusinterface(EBI)module,whichisdesignedtotransferdatabetweenexternaldevicesandthememorycontrollersonARM-baseddevices.Theseexternalmemorycontrollersarecapableofhandlingseveraltypesofexternalmemoryandperipheraldevices,suchasSRAM,PROM,EPROM,EEPROM,flash,andSDRAM.

TheEBIcanalsobeusedtointerfacetoFPGAsaslongastheFPGAcanhandlethepredefinedmemoryinterfaces.Usingthestaticmemoryinterface(SRAM)ontheEBIispreferableforFPGAcommunicationbecauseitissimpleandmostdesignersarefamiliarwithit.AswiththePIOinterface,theFPGAwillhavetoincludeamodulethatunderstandstheSRAMtimingandisabletoproducearesponsebacktothemicrocontroller(Fig4).

4.EBI-SMCinterface.

(Clickthisimagetoviewalarger,moredetailedversion)

Fig5showsthestandardreadtimingfortheEBIusingtheSMCmemoryinterface,whileFig6showsthestandardwritecycle.

5.EBI-SMCreadcycle.

(Clickthisimagetoviewalarger,moredetailedversion)

6.EBI-SMCwritecycle.

(Clickthisimagetoviewalarger,moredetailedversion)

Note:

ThesetimingwaveformsarethedefaultforSMCspecification.Allparametersshownareprogrammablebasedonthespeedoftheexternaldevice.

AnEBIinterfaceisfasterthanPIObecausetheEBIhasitsownI/Oinplaceandmostofthesignalsareparallel.However,iftheexternaldeviceissloworintroduceswaitstates,theEBI'sspeedadvantagecouldbecompromised.

LikethePIOinterface,theEBIinterfacemustbedrivenbytheprocessororanotherAHBmaster.Thus,theachievablebandwidthontheEBIisalsodependentonsoftwareanddependsonhowmuchprocessortimeisavailabletoit.Certainlytherecouldbeabandwidthlimitation.Thisagainpotentiallylimitstheembeddedprocessorincarryingoutothersystemfunctionsthatitwasdesignedtodo.

UsingadedicatedFPGAinterfaceontheMCU

ARM7-basedmicrocontrollersareavailablewithaspecialinterfacethatallowstheFPGAtodirectlyaccesstotheMCU'sinternalAHBbuswithDMAaccessviatwoAHBmastersandfourAHBslaves.OneextraAHBslavemaybeusedtore-maptheROMusinganexternalZBTRAMthroughtheFPGAwithaprogrammableROMre-mapfeatureatstartup.

TheinterfacealsogivestheFPGAaccesstofourteenadvancedperipheralbus(APB)slaves,twoDMAfullduplexchannels,uptothirteenpriorityencodedinterrupts(IRQs),twonon-encodedIRQsforDMAtransfersand32-bitsofsharedprogrammableI/Os.TheFPGAinterfaceaccessestheAHBthroughthepre-definedmastersandslavesonthemicrocontroller(Fig7).

7.MCUwithdedicatedFPGAinterface.

(Clickthisimagetoviewalarger,moredetailedversion)

TheFPGAinterfaceisbasedonseveralserializersthatencodeanddecodeallthetrafficbetweenthemicrocontrollerandtheFPGA.Inordertohaveapropercommunicationandsynchronizationbetweenbothdevices,thefollowingrequirementsmustbeinplace:

∙TheFPGAmustbecapableofhandlingskewclockbalancingandlatencycancellation.IntheXilinxFPGAfamilies,theusageofDCM's(DigitalClockManager)ismandatorytohandleallthelatencycancellationandrequiredclocksgeneration.AlteradevicesrequiretheuseofPLL's.TheFPGAmustalsoprovidetheconfigurationmodesandresettothemicrocontroller'sbuilt-ininterface.Itmustprovidetheserialcommunicationclocktothemicrocontroller,whichmayhaveafrequencyofupto100MHzforcommercialrangedevices.TheratiobetweentheinternalARM7clockandtheserialclockshouldbeintheorderof0.8orlower(ARMClk/SerialClk). 

 

∙TheFPGA-interfaceisbasedonasetofmodulesthatencodeanddecodetheinternalAHBtransactions.Theencoded/decodeddataistransferredthroughMPIO'susingdedicatedserializersforeachmas

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 材料科学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2