The Commodore 64 uses the MOS Technology 6510 microprocessor The 6510 is The specification described that this should be done using a jump absolute
Previous PDF | Next PDF |
[PDF] commodore - 6502org
The 6510 is a low-cost microcomputer system capable of solving a broad range of small-systems and peripheral-control problems at minimum cost to the user An 8-bit Bi-Directional I/O Port is located on-chip with the Output Registerat Address 0001 and the Data-Direction Register at Address 0000
[PDF] 6510 MICROPROCESSOR WITH I/O - 6502org
The 6510 is a low-cost microprocessor capable of solving a broad range of small-systems and peripheral-control problems at minimum cost to the user An 8-bit Bi-Directional I/O Port is located on-chip with the Output Register at Address 0001 and the Data-Direction Register at Address 0000
[PDF] Commodore 64
The Commodore 64 uses the MOS Technology 6510 microprocessor The 6510 is The specification described that this should be done using a jump absolute
[PDF] C74-6502 Datasheetpages - WordPresscom
Built using strictly discrete components, it can run at clock- speeds of up to 20MHz and may be configured to operate as an 6502, a 6510, or 65C02 processor
[PDF] 6U VME Intel core i7 Air Cooled Processor Board
The XVME-6510 will add 7 to 10 years of life to your system with modern technology This high-performance SBC features a FPGA-based VME to PCIe- bridge that
[PDF] Data Sheet - NXP Semiconductors
M68HC11E Family Data Sheet, Rev 5 1 Freescale Semiconductor 65 Chapter 4 Central Processor Unit (CPU) 4 1 Introduction Features of the M68HC11
[PDF] MC680x/MCS650x - The CPU Shack
CPUs/MCUs belonging to the Motorola 680x and MOS families The board consists for 6510 8500 CPU MOS Technology 6510 6510CBM 6510CBM NO
[PDF] Commodore 64/64C - Service Manual - Retro-kit
64K RAM • 20K ROM Standard (includes operating system and BASIC interpreter) • 6510A Microprocessor—1 02 MHz clock • Compatible with the 6502
[PDF] Visualizing a Classic CPU in action : The 6502 - Visual 6502
Understand a CPU by seeing it operate ▫ Preservation 1 Chip → Bitmaps → Polygons → CPU sim ▫ 100 MOS: 6502 – 6507 – 6510 ▫ Intel: 4004
[PDF] 6510 xerox
[PDF] 65802 cpu
[PDF] 65816 addressing modes
[PDF] 65816 computer
[PDF] 65816 coprocessor
[PDF] 65816 datasheet
[PDF] 65816 opcode table
[PDF] 65816 primer
[PDF] 65816 registers
[PDF] 65816 snes
[PDF] 65c02 assembler
[PDF] 65c02 digikey
[PDF] 65c02 emulator
[PDF] 65c02 opcodes
Use or modification of this code for educational, research or personal use is allowed. Any attempt to make any financial gain off the use or modification of this code is strictly prohibited, without the expressed written consent of all of the aforementioned group members of Team Angry Nerds.
INPUTDEVICES.............................................................................................1 SOFTWAREDESCRIPTION...........................................................13HOWWEBUILTIT.........................................................................14MOS6510CPU...........................................................................................14KEYBOARDDRIVER/FRAMEBUFFER........................................................15BUS..................................................................................................................16BLOCKRAM/SOUND..................................................................................18TESTINGANDVERIFICATION.....................................................20CPU.................................................................................................................
4WhatwebuiltOurgrouphadsetouttodevelopafullyfunctionalCommodore64onaVirtex5LX110TFPGA.CommodoreInternationaldevelopedtheCommodore64in 198
asageneral-purposecomputeronw hichyoucanplaygameROMs.Duringitse ntirelife time,itso ldbetween1and 17mi ll ionuni ts,makingitoneofthemostpopularcomputersofalltime.TheoverallsystemarchitectureisfairlysimplewhencomparedtomodernCPUs,whichmakesitagoodfitforthescopeofthisclass.Wecurrentlyhaveaworkingmodelonwhichwecandemoavarietyofgamesandrunthebasicinterpreter.Thesystemhasthreemainchipswithinit.TheprocessorisbasedonaMOSTechnology6510microprocessor,thevideochipisaMOSTechnology6567chip ,betterknownastheVICII, andthesoundchipisaMOSTechnology6581chip,betterknownastheSID6581.Thedetailsofeachofthesechipswillbefleshedoutbelow.Thesethreechips providethebr ainsbehindthewholem achine;however,themostcrucialcomponentsofthissystemaretheaddressbusandmemorysubsystemthatallowforefficientcommunicationbetweenthechips.Thebusprovestobeaneffectivearbiterbetweenthevariouschipsandthememorysubsystem.Thememoryitselfisdividedintoa64KBRAM,hencethenameofthesystem,anda
0KBROM,wherethekernelandotherdataisstoredthatisusedtorunthemachine.Ontopofthesemainchips,wehadtoalsotakeintoconsiderationhowweinteractedwiththeboard,inordertogetthevariousinputsandoutputsinandoutofthesystem.WehavedevelopedseveralI/Oboardinterfacestoallowforthis.Eachoftheoutputinterfaceswillbediscussedalongwiththechipthatutilizesit.WecurrentlyusethekeyboardforI/Obydevelopingtherelevantdrivers.Wealsoemu latethejoysti cku singthenumpa donthekeyboard.
5Thisprojectwasprimarilyanexerciseinhardwaredesign,sowegotourkernelandgameROM'sfromtheInternet,althoughwegainedknowledgeinhowgameROM'sworkandhowtheyinteractwiththesystem.GameDescriptionCurrentlywehavethefollowinggamesworking:• Galaxian(8-bit):Itisapopularold-schoolarcadeshooterdevelopedbyNamcoin1979.Thegameinvolvestheusercontrollingashipatthebottomofthescreenandshootingthedescendingenemyships.Thisgamefullyworkswithcorrectlysyncedsoundandnoscreenjitterorinputlag.Thescoresanduserlivesupdatecorrectlyandtheexplosionsdisplaycorrectly.• Mario'sBrewery(8-bit):ThisisanunofficialMariogamedevelopedbyJeremyThornein198 . Thisgamei sverysimi larto donkeykonginvolvinghavingyourcharacterclimbfromthebottomtothetopusingladdersandjumpingoverbarrels.• Centipede(8-bit):Thisisave rtically-orientedshootinggamedevelopedbyAtariin1980.Thisgamefullyworkswithaslightdelayinsoundoutput.• Pac-man:Thisgame onlypartiall yworks,the wallsarenotdr awncorrectlyandthebottomhalfofthemazeisnotvisible.• Frogger:Thisgamerandomlyworks,mostofthetimethefrogfailstogetdisplayed.• BasicInterpreter:CanexecuteBASICcommandsandsimpleprograms.
6DetailedhardwaredescriptionSy temDiagram:MOS6510Proce or:TheCommodore64usestheMOSTechnology6510microprocessor.The6510i sa descendantofthemuchm oreubi quitousMOSTechnology650
7Apartformtheabove,thecorearchitectureofthetwoprocessorsisessentiallythesame.The6510isan8-bitprocessorwitha16-bitaddressbusand8-bitsofdatainputandoutput.Theprocessorusesasimpletwostagepipeline,sothatthenextinstructionisfetchedandstartsexecutingonlyifthecurrentinstructionthatisexecutingdoesnotstoreanythinginmemory.Additionally,theprocessorhasatwo-phaseclockt hatsuppliestwosynchronizationspercycles,howeverourdesigncurrentlyonlyusesone.Wedo,however, usethisoneclocktoemulatethe behaviorof two,soas tomaintaincorrecttimingacrossthebus.Weareintheprocessoftestingthistodeterminewhethertheoverallnumberofcyclestakenforagiveninstructionremainsthesame.TheprocessorhasaspecialAEC(addressenablecontrolline)thattristatestheaddressbus,sothattheaddressbusisvalidonlywhenthislineisasserted.The6510hasthefollowingregisters:• Accumulatorregister(8-bit):Usedforarithmeticandlogicoperations.• IndexregistersXa ndY(8-bit):General-purposeregistersus edforloads,addressingmodesetc.• ProgramCounter(16-bit)• Statusregister(8-bit):Whichcontainsthestatusflags• Stackpointer(8-bit):MainlyusedfortheJSR(JumptoSubroutine)andRTS(ReturnfromSubroutine)instructionsandforinterrupthandling.Additionally,thereservedmemorylocationsusedbytheprocessorare:• 000
-00FF(zeropage):reservedforzero-pagepointe rs.Thesepointersareusedbyzero-pageaddressingmodes.• 0100-01FF:
56-bytestack• FFFA-FFFB:PointertoNMIinterrupt-processingroutine.• FFFC-FFFD:PointertoaprogramhandlingResetsignal.• FFFE-FFFF:PointertoIRQinterrupt-processingroutine.
8Theproces sorusesavarietyofaddressingmodes(theindi rectinstructionsareusuallyusedforloopsandarrayprocessing,theindexregistersareliterallyusedasindices):• Implied:thedatavalue/dataaddressisimplicitlyassociatedwiththeinstruction• Accumulator:usesthevaluestoredintheaccumulatorasaneffectiveaddress• Immediate:the8-bitdatais provided asthesec ondbyteintheinstruction• Absolute:The16bitaddres sisprov idedasth esecondand thirdinstruction• ZeroPage:Thesecondbyteoftheinstructionpointstoalocationinpagezero(000
-00FF).• Indexedzeropage• Indexedabsolute• Relative:Usedforbranchinginstructions.Branchinstructionsusean8-bitoffset relativetotheinstr uctionafterthebranch.There fore,branchesarelimitedto1
8bytesbackwardand1
7bytesforwardfromthecurrentinstruction.• Indexedindirect• Indirectindexed• Absoluteindirect
9Theproces soralsosupportstwotypesof interrupts, theIRQ(maskable)andNMI(non-maskableinterrupts)whicharehandledasfollows:• NMI:Whenthisoccurstheprogramcounterandprocessorstatusarestoredinthestack,furtherinterruptsaredisabledandtheprocessorjumpstothelocationofthehandlerataddress0xFFFAandreturnsusingtheRTIinstruction.Thisinterruptcannotbedisabled.• IRQ:WhentheinterruptoccursthePCandprocessorstatusregistersarestoredin thestack,furtheri nterruptsar edisabl edandtheprocessorjumpstomemorylocat ion0xFFFE,ret urnsusingthe RTIinstruction.ThisinterruptcanbeenabledordisabledusingtheCLI/SEIinstructions.The6510instructionsetconsistsofaround56legalinstructions,includingdatamovi ng,arithmetic,logic,controltransferand someassortedotherinstructions.MOSTechnology6567VideoChip(VICII)TheMO STechnology6567videochip, betterknow nas theVICII,providedthevideooutputfortheCommodore64.IntheCommodore64,theVICIIchipwasalsoresponsibleforgeneratingthesystemclock,aswellasrefreshingtheDRAM,whichisfunctionalitythatwewillbebypassinginourdesign,astheLX110Talreadyhandlesthisonourbehalf.TheVICIIchiphasthreecharacterdisplaymodesandtwotextdisplaymodes.ItalsosupportedboththePALandNTSCstandardsforvideooutput,butwewillbestickingwiththeAmericanstandard,NTSC.TheVICIIchipiscapableofdisplaying16colors,thoughsomeprogrammershavebeenabletohackthechipinordertocreatemorevisiblecolors.Additionally,thechipisabletodisplayuptoaresolutionof
0x00pixels,althoughthatnumbermaybered uceddep endinguponthevideomod e.Thechipalsoutilizes
10spritestodisplaycertainpatternsandhastheabilitytohandleuptoeightoftheseatanyonetime.Thechiputilizes47registerstogeneratethecorrectvideosignals.Theprocessorcansettheseregistersbywritingtocertainmemoryaddressesthatpointtotheregisters.Thoseregisterinclude:• XandYcoordinateRegistersforeachsprite• ColorRegisters• BackgroundColorRegisters• ControlandInterruptRegistersTheVICIIalternatesmemoryaccesseswiththe6510everyclockcycle.TheVICIIhascontrolofthebusonthefirsthalfofthecycleandthe6510onthesecondhalf .W eplantoemulatethis alternatingbehavi orinour bu sdesign.TheVICIIalsohasadedicated.5KBRAMusedforgeneratingcolors.EveryclockcycletheVICIIcanaccessboththesystemRAM,aswellasthecolorRAM.Whenthechipneedsmorethanonecycletoloaddatainfromthememory,suchaswhentryingtoloadasprite,theVICIIcantakecontrolofthebusforseveralconsecutivecycles.MOSTechnology6581(SID6581)Thesound cardusedin theCommodore 64istheM OSTechnology6581,orasitsmorecommonlyknown,theSID6581.TheSID6581wasoneofthemostpop ularaspectsoftheoriginalCommodor e64andit isstillpopulartodaywithmanyavidvideogamemusicfansandelectronicartists.FormanywhoplayedontheCommodore64,theaspectthatbringsthemostnostalgiaistheauditoryexperience.The6581consists ofthreesynthesizer "voices"whi chcanbeused independentlyorinconjunctionwitheachother.EachvoiceconsistsofaWaveformGenerator,anEnvelopeGeneratorandanAmplitudeModulator.
11TheWaveformGeneratorcontrolsthepitchofthevoiceoverawiderange.Itproducesfourwaveformsattheselectedfrequency,withtheuniqueharmoniccontentofeachwaveform provi dingsim plecontrol oftimbre.ThevolumeiscontrolledbytheAmplitudeModulator,underthedirectionoftheEnvelopeGenerator.Whentriggered,theEnvelopeGeneratorcreatesanamplitudeenvelopewithprogrammableratesofincreasinganddecreasingvolume.Inadditiontothethreevoices,aprogrammablefilterisprovidedforgeneratingcomplex,dynamictonecolorsviasubtractivesynthesis.Thereare
9ei ght-bitregiste rsinSIDthatcontrolthegenerat ionof sound.Theseregistersinclude:• Registerstocontroleachofthe voices• FilterControlRegisters• OverallControlRegisters,includingvolumeTheseregisterscanbewrittenandreadinamannersimilartotheregistersintheVICII, throughmemor ymappedaccesses.TheSID6581allowsthemicroprocessortoreadthechangingoutputofthethirdOscillatorandthirdEnvelopeGenerator.Theseoutputscanbeusedasasourceofmodulationinformationforcreatingvariouseffects,andalsoasarandomnumbergeneratorfo rgames.TwoAnalog -DigitalconvertersareprovidedforinterfacingtheSIDwithpotentiometers.Thesecanbeusedfor"paddles"inagam eenvironment orasfrontpane lcontrolsin amusicsynthesizer,however,wewon'tbeimplementingthisfeature.TheSID6581canprocessexternalaudiosignals,allowingmultipleSIDchipstobedaisy-chained.
1V.TheMemory/Bu Sub y temThememorybusinterfaceconnectsthe6510processor,VICIIgraphicschip,6581soundchip,64kBRAMand
1 The0KBROMisbrokenupinto mainpieces, 9kBforBASIC
.0,7kB forthekernel,andtwokBcharactersets.Itisalsointerleavedabovethe64KBaddressspace,inamannersimilartothevideocardandsoundregisters,asshownatright.TheVirtex-5boardshave 6kBblocksofmemory,includingparitybits,whichcanbeconfiguredasRAMorROM.We,therefore,intendtouse
oftheblocksforthe 64kBRAMan d1blockforROM .Thebusinterfa cehasseparat eaddress,writeenableanddatainpinsfromeachchipanditoutputsasinglesetofaddress,writeenableanddatainsignalstoquerythememoryontheboard.Thedatathatthebusreceivesissubsequentlybroadcasttoallthechipssimultaneously.VI.InputDevice TheoriginalCommodore64hadsupportforakeyboard,aswellasamouseandjoysticks.Theseinputdeviceswerecontrolledbyaseparatechip,whichhandledthetimingandcontentionofthedevices.SoftwaredescriptionRanth eBASICoperatings ystemth atallowedBASICcommandstointeractwiththekernal.
56-entrylookuptablewasthebestoption.Therefore,foreachopcodereadinwehadacasestatementthatdeterminedexactlywhichinstructionwasbeingreadin.Atthe sametimewe hadtocareful lyfollowthes pecificatio nsthatshowedexactlyhow manycyc leseachinstructiontook.This wasaccomplishedbyputtinginplaceastatemachinethat,dependingonwhichinstructionwewerecurrentlyexecutingandwhichstageoftheexecutionwewerein,determinedthenextcycletojumpto.Forexample,onresetwehadtoreadinthebytesataddresses0xfffdand0xfffeandjumptothataddress.Thespecificationdescribedthatthisshouldbedoneusingajumpabsoluteinstructionthattookexactlythreecyclesincludingtheopcodefetchcycle.Therefore,whenre setwenthightheprocess orwouldgener ateapseudo jumpabsoluteinstructionandthestatemachinewouldproceedontothenextcycleaftertheopcodefetchcycle.Onthissecondcyclewewouldreadinthebyteat0xfffeandmoveontothefinalcycleofthejumpabsoluteinstruction.Inthisfinalcyclewewouldreadinthelastbyteat0xfffd,concatenatethetwobytesthatwerereadinandjumptothataddressonthenextclockcycle.Thestatemachinewouldthenstartagainintheopcodefetchcycle.WefollowedthisgeneralapproachfortheentireISAbecauseoftherelativelysmallnumberof instructions.H owever,theproblemwith thisapproachwasthatgene rallyeachi nstruc tionhadavarietyofaddressingmodeslikethejumpinstruction,thereforetheopcodeencodingsjumpedtoaround
56towards the end.However,mos timplem entationslikethe referenceonew ehad,alread yhad thehardcodedo pcodeandstate
15encodings/transitions,soitwaseasiertousetheexistingworkingones.Thisapproachmadeitmucheasierinthedebuggingstagewhentryingtofigureoutwhichintermediatestagesweregoingwrong.Keyboarddriver(joy tickemulation),framebuffer:Inordertogetthekeyboardworkingwehadtofirstinteractwiththeps
interfaceontheboard.Theps interfaceusesasetofpins,oneasaderivedclockandoneasthedatalinestotransmitthe1bytescancodeand1bitofparit yerror checking.Wealsone ededtofilterout jitterthatcameacrossthelines.Wewaitforthederivedclocktostartcyclingandthenlatchtheincomingdatafor9cycles,atwhichpointwechecktheparity.Ifit'sgood,wesetareadypinandpassthescancodeout.Thescancodewepassout,however,isnotthesameaswhattheCommodore64expects.We,therefore,havetopassitthroughwhatamountstoahugecasestatementtochangeittoale gacyscancode.Iti sinthisc onversionthatweemul atethejoys tickfunctionality,aswejustchangethepre ssofan umberpad keytoth eequivalentbuttonpressonaj oystic k.Thenewlegacyscancode isthenpassedontotheCIAchips,whichwillsignalaninterrupttothe6510chip,whichwillthenreadthescancode.InordertogetthevideooutputoftheVICIIchipintoaformatwecouldusefortheframebuffer,whichtalkstotheDVIinterface,severalthingshadtobedone.Firstoff,theVICchipoutputsanewpixelevery
cycles,butthefr amebufferwritestotheDVIinterfaceeverycycle.Thismeans weneededtolatchtheoutputoftheVIC,whichincludesthecolor,verticalsyncandhori zontalsyncoutputstobeusedby theframebuff er.Howe ver, thecolordatathatisoutputtedbytheVICisonlya4-bitcolorindex,astheVIConlysup ported16colors.We,therefore, hadto takethecolorindexand producethecorresp ondin gRGBvaluesbeforeitcould bepassedtothe
16framebuffer.Theframebufferitsel fisbasedoffof thedesignofTeamDragonforce.Wepassedthedataintothe framebuffer fromtheaforementionedqueue,whichhastheappropriatesyncsignals,aswellasthetransformedcolorsignals.TheframebufferthentransmitsthemthroughtotheDVIinterfaceusingtheappropriatecontrolsignals.Bu TheC64used16bitadresses.However,thetotalvisiblememoryspacewasgreaterthan655 6bytes.So,theC64usedbankswitching,whichweemulatedinthebus.Dependingonhowcertainbitsareset,andwhichchipisusingthebus,readingfromthesameaddresscanmeanseveralthings.Readyfromandwritingtovariouschipsisalsomemorymapped.TheCPUhasthreebankswitchbitscomingoutofit:LoRAM,HighRAMandCharEnable.ThisfirsttwodecidewhichregionofRAMtoreadfrom,whilethethirdbitenablesthecharacterROM.ThesearecontrolledbytheCPUwritin gtoaseriesofmemoryaddresses,fun ctionalityimplementedwithintheCPU.VariouscombinationsoftheGameandExromlineswere
17usedfordifferentsizedgamecartrdiges;originally,theseweredrivenwereresistiorsbuiltintothecartridges,whcihdrovethemhighorlowwhentheywerepluggedin.Wereplacedthisfunctionalitybywiringthesetoaswitchontheboard,whichallowedustoswitchbetweenthekernelandgamesonthefly.Usingthesebankswitchbits,wegeneratedvariouschip-selectsignals.Then,weused asimpledemultiplexerwiththesechip-selectstodecide which locationwewerereadingfromorwritingto.
18ThebusissharedbetweentheCPUtheVIC.Thesearetheonlytwochipsthatcani nitiate areadorwrite. Theoriginalprotocolinvolvedacomplextwo-clocksystem.Wechosetonotimplementthis.Instead,eachofourclockcyclesisdividedinto
sub-cycles,andeithertheCPUortheVIChascontrolofthebusduringthesesub-cycles:theVICfromcycles1 -16andtheCPUfromcycle17-
.Theyhavetoinitiateamemoryrequesteverycycle.Incasetherei snoneedf ora request,area dfroma dummya ddressisperformed.BlockRAMandSoundAfterlookingintooptionsforRAM,wefiguredusingautogeneratedblockramsonth eboardwould bethemost convenienttouse.SowegeneratedtheRAMusingISEcoregenasperthespecfortheaddresslinewidthanddatawidth,andtesteditontheboardtoensurecorrectness.Wecreatedadualportedblockmemorymodulewhichwasintegratedintothebusandwasusedforthe64kBofRAMand5kBcolorRAMneededbytheVIC.FortheROMsinitiallywewantedtousetheon-boardNORflash,butafterspendingacoupleofweekstryingtoprogramtheNORflashusingISEandfailingtogetthedataonaswanted,wegaveup.InsteadweusedVHDLsynthesizablearraystoputtheROMsdirectlyontotheboard.Thisworkedreallywell,sincetheboardhadenoughresourcestoholdthe
0kBROMaswellasthegameROMs.WewroteanaddresstranslationmodulesincetheaddressqueriedbytheCPU fromtheR OMs wasba nkswitched,and eachindividualcomponent(kernel,basicandcharacter)oftheROMhaditsownaddressspace(0-$
000).ForthegameROMs,wefoundcartridgeimagesofgamesonline,whichwehadtoscrubtoremovethedatastoredforemulators,andgettothepurecartridgedata.We thenconvertedittohex,andbrokethehexfileinto
19individualbytesusingaJavascriptwewrote.TheoutputofthejavascriptwasinaformatthatcouldbeuseddirectlybyVHDLarrayswhichweputinamoduletobeconne ctedtot hemainbu s.Wethenwroteasmalladdresstranslationmoduleforthegameroms.Forthesound,sincewewererunningshortontime,andsincetheSID6581wasapopularsoundchip,wefoundaVHDLmodelonline.HoweverthemodulehadsomeAlt era-specificcomponen ts.OneoftheAlteraspecificcomponentswasamultiplier,whichwewereabletogenerateusingcoregenforourX ilinxVirtex 5board.Theoth ermodulewasan analog todigitalconverter,whichwedidnotneedsincethosewerebeingusedbythepaddlecontrollersintheoriginalC64,howeversincewewerenotsupportingpaddlecontrollers,wefigured wecandoaw aywi ththecompone nt.wethenintegratedthesoundchipswiththerestofsystem.Themodelwefoundwasoutputtingan18-bitdigitalaudiosignalaswellasasinglebitanalogPWMsignal.WetriedtogetthedigitalsignaltogothroughtheAC97andtotheaudiojack,howeveraftertoyingwiththatforaboutaweekwegaveup,andthenightbeforeourpublicdemo,wereadonlinethatweonlyneededtopasstheanalogoutputthroughanRCfilter.Sowehurriedlyputtogethera . Vcircuit,using . kOhmresistoranda4.7nFcapacitor,wedrovetheaudiooutfromtheSIDmodulethroughanI/Opinontheboardandwereabletogetsoundoutofthespeakers.
assemblertogeneratetheobjectcodeandstoredthosehexcodesinmemory.Wetestedeachopcodeandthe differe ntaddressingmodesassociatedwi ththatopcodeandexaminedtheresultstoseewhethertheexecutiontookthecorrectnumberofcycles.Iusedthese testsfor boththereferen ceim plemen tationsan dourverilogimplementation.Bu Wespentasignificantamountoftimedebuggingthebus.Gettingthetimingtoworkwasquitecomplicated.Wecouldnottestmuchofthebusinsimulation,sincetheC64tookmillionsofcyclestobootup,andsynthesiswasslowforthis.Also,wewereusingblockRAMsandothercomponentsontheboardincludingthekeyboard,andcouldnoteasilybesimulated.So,weusedChipscopealongwithi tstriggeringmechani sms:thiswas areallif esaver,definetelythemostusefultoolwehad.Theinitialverificationforthebuswasdonebytestingwhethertheprocessorcouldreadinstructionsfrommemory,anddoasimplereadandwrite.WethentestedwhetheritcouldwritetovariousregistersintheVICandCIAchips:weaddedtheseregistersasdebugoutputstothetopmodule,andtes tedtheirvaluesusi ngChipscope.Onceweha dallthebasicfunctionalityworking,wetriedtogetindividualcomponentsofthesystemtostartfunctioningfully,startingwiththedisplay,thenthekeyboardandfinallytheGameROMs.Inthisprocess,wediscoveredbugsinboththosemodulesaswellasthebus.AllofthiswasdoneusingChipscope.
1General y temWeputalotofworkintodevelopingastrongtestinginfrastructure.Thefi rstpartofthiswastobui ldasimulator script thatstreamlinedthecompilationandrunningofourmixedVerilogandVHDLcode.Whenitcametoactuallytestingoutoursystemwediditinanincrementalway.Weworkedtogetthemostbasiccomponentsworkingfirstandthenwouldslowlyaddmorefeatures aswefoundoutthatthep reviousv ersion worked.Thisallowedustoreallyidentifytheproblemsthatweweregetting.However,atacertainpoint,wereallyhadtomakealeapoffaithandsynthesizeourdesignontheboard.Atthispoint,Chipscopebecameaninvaluabletool.EvenwithChipscope,westillspenttimeinsimulationtryingtofixtimingissuesandtryingtorecreateproblemsinordertoidentifysolutions.Oncewegottothepointofactuallyrunningkernelandgamecodeonthesystem,thetimespentinsimulationtogettoproblemsbecameextremelylong,sowehadtogoalmostexclusivelytosynthesisforthelastfewweeks.WordsofwisdomforfuturegenerationsDon'tbeafraidtoaskforhelpfromtheothergroups.Theycanbeyourbestresource,asyouwillprobablyfacemanyofthesameproblems,atleastearlyon.Additionallymakesureyoustayonscheduleandberealisticaboutwhatyoucaninacertainamountoftime.Whenyoustartmissingyourowndeadlinesthepressurewillstarttobuildandthat'sjustnofun.Also,ChipScopeisabiglifesaversoyoushouldreallyputinthetimetounderstandhowitworks.Gettingthetimingrightisaveryimportantfactorsoyouhavetobeverycarefulwhendealingwithdifferentclockdomains.WealsolearntalotofVHDLintheprocessoftestingtheCPUandothercomponents.Mostoftheexisting650
implementa tionswerea lmostcompletelywritteninVHDL,thereforeunderstandingthislanguagewasveryimportant.Also,ratherthantryingtoreinventthewheelbydesigningourownprocessorfromscratch,usingourownencodingsandstatetransitions,welook edatexistingimplemen tations forideasandusedthosewhi leimplementingit.Thiscanbeattributedtotheampleresearchwedidbeforeweactuallywentaheadandgotourhandsdirty.
modelintoa6510one.Ithensetupatestingharnessforthe6510modelwehad,andwrotesomeinitialtestsforitusinganassemblerthatIfound,usingasimplememorymoduleforsimulation.IthenlookedintogettingaSIDmodelthatwecoulduseareference.Weendedupusingthismodelasisattheendofsemestersinceweranoutoftime.Then,Istartedworkingonthebus,whichendedupconsumingalotoftime.WebeganbywritingasimpleinterfacebetweentheVIC,memoryandthe6510andtestingit.Oncewehaditworkinginsimulation,IwaspartofanefforttousesystemACEforflashmemoryonthebus.However,wecouldnotgetthistowork.IthenworkedonintegratingthegeneratedRAMmoduleswiththebusandputtingitontheboard.Ithenengagedinsignificantamountsofdebuggingtogettheprocessorexecutingopcodesfromthekernel.Oncewehadthis,IworkedongettingtheconversionfromtheformatoutputbytheVICtoVGAworking.Thiswasquitechallenging,sincewehadtodealwithmultipleclockdomains.Oncethiswasdone,wehadthekernelworkingandcouldrunBASICprogramsonit.Oncethiswasdone,weassumedthatgettingtheGameROMstoworkwouldbetrivial,sincewewereabletoexecuteopcodesoffit.However,wespentthenext weeksdebuggingthebus,andfoundseveralsubtlebugsinitusingChipscope.Thiswasextremelydifficult,asitwashardtotracedownthesouceoftheproblems.WefinallygotGamesworkingontheMondaybeforelabdemoday.Wethenworkedongettingsoundworking:thiswentfairlyquicklyoncewewenttheanalogueroute.