In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory,...

16
1

Transcript of In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory,...

Page 1: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

1

Page 2: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

2

Inthislecture,wewillconsiderthevarioustypeofstorage(memory)thatFPGAsallowustoimplement.ThemajoradvantageofFPGAsisthatitcontainslotsofsmallblocksofmemorymodules,whichcaneitherbeusedindependently,orcombinedtoformlargermemoryblocks.Theyalsoprovidevariousconfigurationssuchasmulti-portorregisteredinput/outputfordataandaddress.

Therearevarioususefulreferencesyoucanlookupifyouareinterestedtolearnmoreaboutthis.Forthepurposeofexamination,thecontentsinthislectureandintheVERIexperimentaresufficient.

Page 3: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

3

Thesimplestformofstorageisaregisterfile.Allmicroprocessorshaveregisterfiles,whichareknownas“registers” inthearchitecturalcontext.

Registerfilesarefast,largeandflexible.TheyaregenerallyusedtostoretemporarydataforeasyaccessbytheALUorfloatingpointunitofamicroprocessor,orforcomputationalengineofaapplicationspecifydigitalsystem.

OntheFPGA,registerfilesareoftenimplementedwiththeD-FF’sintheAdaptiveLogicModules(ALMs).EachALMhastwoD-FFs.Thereforea32-bitregisterwilltakeup16ALMs.Alternativelyonecouldalsousethestaticmemoryblocksforthispurpose.

Page 4: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

4

Thecircuitofaregisterfileissimple– itconsistsofarraysofD-FFs,whichcanbedisable(andoutputbecomeshighimpedance).Theregisterselectsignalssel_reg0,sel_reg1etc.enablethecorrectregistertoputthedataonthedataline(calledbitlinehere).Theread/writecontrolsignalWEisusedtodetermineifyouarereadingorwritingtotheregister.

Page 5: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

5

Theregisteridentification(regid)determineswhichregisteryouaretryingtoaccess.Thisisachievedthroughastandarddecoder,whichgenerateaone-hotcodewordtoselecttheappropriateregistertoaccess.

Page 6: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

6

NowletusturntotheCycloneVFPGA.TheFPGAhasmanydifferenttypeofresourcesinadditionaltoAdaptiveLogicModules(ALMs).Theseare:memoryblocks,DigitalSignalProcessing(DSP)units,phase-lockedloopsandinput/outputpads.Inaddition,thereisadual-coreARMprocessoranditsassociatedbusinterfacecircuit(showninlightgreen).

Herewefocusonmemory.IntheC5-SE-A5series,whichistheoneweuseintheDE1board,therearenear400separatememoryblocks,eachwith10kbitsofstorage.TogetherwiththeALMs,thereis4.45Mbitsofflexiblememorystorageavailabletothedesigner.

Page 7: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

7

Eachoftheseblocks(knownasM10K)canbeconfiguredwithdifferentdepthanddatawidthasshownintheableabove.

Evenmoreimportantly,thecanalsobeconfiguredtoactasconventionalsingle-portmemory,orsimpledual-portwithoneportforreadandoneportforwrite.

Further,theycanbemadetobetruedual-port,bothportsbeingread/writeports,orasashiftregister,aROMorafirst-in-first-outbuffer(FIFO).

Page 8: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

8

AsyouhaveseenintheVERIexperiment,ifthememoryblockisaROM(orevenasaRAM),itscontentcanbeconfiguredviaamemoryinitializationfile.mif.Theformatofthefileisshownhere.Typingthecontentsofa1024ROMmodulebyhandissillyandimpractical.Iwrotetwoversionsofasimpleprogrammetogeneratethis.miffile,oneinMatlabandoneinPython.BelowisthecodefortheMatlabversion.TheROMisproducedusingtheIPCatalogtool.Hereisa1024x10bitROMgeneratedwithallinputandoutputregisteredandsynchronisedwiththeclocksignal.

Page 9: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

9

Intheexperiment,youhavealreadyimplementedasinewavegeneratorusingtheROMtostoreonecycleofasinewave.Thecounterisusedtoadvancethephaseofthesinewave,whichisspecifiedastheaddressXoftheROM.ThecontentoftheROM,y=F(x)isthecontentoftheROMandisthegeneratedwaveform.Insteadofstoringasinewave,youcaneasilystoreanyothersignal(suchasavoiceormusicsegment).Inorderimplementavariablefrequencysinewave,youcouldmodifytheaddresscountersothatitisgoesupnotonlyby1countforeachclockcycle,butbyN.ForexampleifNis2,thentheaddresscounterwillskipeveryothersampleintheROMandthereforethegeneratedsinewavewillbeattwicethesignalfrequency.

Page 10: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

10

Hereisageneratedsingle-portmemorywithALLpossiblesignalsincluded.Themeaningofallthesignalsareselfexplanatory.

Page 11: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

11

HereisthetimingoftheRAMconfiguredasasingleport.Sincewehaveseparatedatainputport(data_a)anddataoutputport(q_a),itisimportanttounderstandwhatdatayoureadback(oldornew)fromagivenaddressduringawritecycle.

Page 12: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

12

HereisanexampleofusingtheMegaWizardmanagertoolinQuartus.Weareproducinga1-portRAMwith1024x8,allsignalsareclocked.Thegeneratorproducesasampleheaderfile(atemplate)whichdefinestheinterfacesignaltothegeneratedblock.RememberyoumustticktheVerilogHDLradiobutton.

Page 13: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

13

YoucanalsoconfiguretheM9Kmemoryblockasashiftregister.Hereisan8-bit16stageSR.Inaddition,itprovides“tap” outputsforeverystage,i.e.16x8=128outputsignals.ThisisveryusefultoimplementFIRfilterorperformtimedomainconvolution.

Page 14: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

InthePartIVoftheVERIexperiment,youwillbeusingaFIFOtoimplementanechosynthesizer.TheactionofaFIFOisshowninthediagramabove.

14

Page 15: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

HereisagenericblockdiagramofaFIFOwithitstypicalinterfacesignals.FIFOisaformofqueue.Internallytheretypicallytwocounters,onekeepingtrackofthereadaddress(orreadpointer)andanothercounterkeepingtrackofthewriteaddress(writepointer).ThereneedstobestatussignalssuchasFULL,whichisassertediftheFIFOiscompletelyfilledandwritinganymorewordstoitwilldestroystoreddata,orEMPTY,whichsignifiesthattherearenodatalefttoread.

15

Page 16: In this lecture, we will consider the various type of storage … 14... · 2018-11-27 · memory, or simple dual-port with one port for read and one port for write. Further, they

16

FIFOcanbegeneratedusingtheIPCatalogmanagertool.Hereisanexampleofa32wordx8bitFIFO.