SetSysIdroute

iproute  时间:2021-02-09  阅读:()
.
GRSIMAgenericSPARCsimulatorcapableofemulatingLEONbasedsystems2017User'sManualThemostimportantthingwebuildistrustGRSIMSimulatorUser'sManualGRSIM-UM1www.
cobham.
com/gaislerJune2017,Version1.
1.
56GRSIM-UMJune2017,Version1.
1.
562www.
cobham.
com/gaislerTableofContents1.
Introduction41.
1.
Supportedplatformsandsystemrequirements41.
2.
ObtainingGRSIM41.
3.
Installation41.
4.
Licenseinstallation41.
5.
Problemreports42.
Operation52.
1.
Operationalmodes52.
2.
Commandlineoptions52.
2.
1.
Switchesspecifictocertainmodules52.
2.
2.
(VENDOR_GAISLER)52.
2.
3.
(VENDOR_ESA)92.
3.
InteractiveCommands102.
4.
Simulatorconfiguration112.
4.
1.
Constructingasimulatorconfiguration112.
5.
Runningapplications132.
6.
Insertingbreakpointsandwatchpoints142.
7.
Displayingregisters142.
8.
Codecoverage142.
9.
Symbolicdebuginformationandprofiling152.
10.
Displayingmemorycontents162.
11.
Disassemblyofmemory162.
12.
Loadablecommandmodule172.
13.
GDBinterface172.
13.
1.
Attachingtogdb172.
13.
2.
Debuggingofapplications182.
13.
3.
Detaching182.
13.
4.
SpecificGDBoptimization182.
13.
5.
Limitationsofgdbinterface193.
Simulatormodules203.
1.
Thebasicstructure203.
2.
ReadandWriteoperations213.
2.
1.
Theparametersexplained213.
2.
2.
Ordinaryaccesses213.
2.
3.
Diagnosticaccesses213.
3.
Predefinedmodules213.
3.
1.
(ESA_LEON2)LEON2CPU213.
3.
2.
(ESA_MCTRL)LEON2memorycontroller213.
3.
3.
(GAISLER_APBUART)GRLIBAPBUART223.
3.
4.
(GAISLER_ETHMAC)GRETH10/100EthernetMACmodule223.
3.
5.
(GAISLER_GPTIMER)GRLIBAPBGeneralPurposeTimer243.
3.
6.
(GAISLER_GRGPIO)GeneralPurposeI/OPort243.
3.
7.
(GAISLER_IRQMP)MultiprocessorInterruptcontrollerwithAMPsupport263.
3.
8.
(GAISLER_L2C)LEON2Compatibility273.
3.
9.
(GAISLER_L2IRQ)LEON2Interruptcontroller273.
3.
10.
(GAISLER_L2TIME)LEON2Timer283.
3.
11.
(GAISLER_LEON3)LEON3CPU283.
3.
12.
(GAISLER_LEON4)LEON4CPU283.
3.
13.
(GAISLER_PCIFBRG)GRLIBGRPCImaster/targetinterface293.
3.
14.
(GAISLER_SDCTRL)GRLIBSDRAMController313.
3.
15.
(GAISLER_SPW)GRSPWSpaceWirecontroller313.
3.
16.
(GAISLER_SPW2)GRSPW2SpaceWirecontroller343.
3.
17.
(GAISLER_SRCTRL)GRLIBSRAM/PROMController344.
Library354.
1.
Functioninterface35GRSIM-UMJune2017,Version1.
1.
563www.
cobham.
com/gaisler4.
2.
Multi-threading364.
2.
1.
Limitationstomulti-threadingsupport374.
3.
UARThandling374.
4.
LinkinganapplicationwiththeGRSIMlibrary374.
5.
GRSIMlibrarywithoutasimconfmodule375.
Support38A.
HASP39A.
1.
InstallingHASPDeviceDriver39A.
1.
1.
OnaLinuxplatform39B.
Samplesimulatorconfiguration41C.
SimpleExampleAmbaDevice44C.
1.
MemCtrl.
h44C.
2.
MemCtrl.
c44D.
grcommon.
h47GRSIM-UMJune2017,Version1.
1.
564www.
cobham.
com/gaisler1.
IntroductionGRSIMisagenericSPARC1simulatorcapableofemulatingLEONbasedsystems.
GRSIMincludesthefollowingfunctions:Read/writeaccesstoallLEONregistersandmemoryBuilt-indisassemblerandtracebuffermanagementDownloadingandexecutionofLEONapplicationsBreakpointandwatchpointmanagementRemoteconnectiontoGNUdebugger(gdb)1.
1.
SupportedplatformsandsystemrequirementsGRSIMiscurrentlyprovidedforlinux-2.
2/glibc-2.
3.
1.
2.
ObtainingGRSIMTheprimarysiteforGRSIMistheCobhamGaislerwebsite[http://www.
gaisler.
com]wherethelatestversionofGRSIMcanbeordered.
1.
3.
InstallationGRSIMcanbeinstalledanywhereonthehostcomputer-forconveniencetheinstallationdirectoryshouldbeaddedtothesearchpath.
ThecommercialversionsuseaHASP4licensekey.
1.
4.
LicenseinstallationGRSIMislicensedusingaHASPUSBhardwarekey.
Beforeuse,adevicedriverforthekeymustbeinstalled.
ThelatestdriverscanbefoundatAladdinwebsite[http://www.
aladdin.
com]ortheCobhamGaislerwebsite[http://www.
gaisler.
com].
SeeAppendixA,forinstallationinstructionsofdevicedrivers.
1.
5.
ProblemreportsPleasesendproblemreportsorcommentsto.
1SPARCisaregistredtrademarkofSPARCInternationalGRSIM-UMJune2017,Version1.
1.
565www.
cobham.
com/gaisler2.
OperationThischapterdescribeshowtouseGRSIM.
2.
1.
OperationalmodesGRSIMcanoperateintwomodes:stand-aloneandattachedtogdb.
Instand-alonemode,LEONapplicationscanbeloadedanddebuggedusingacommandlineinterface.
Anumberofcommandsareavailabletoexaminedata,insertbreakpointsandadvanceexecution,etc.
Whenattachedtogdb,GRSIMactsasaremotegdbtarget,andapplicationsareloadedanddebuggedthroughgdb(oragdbfront-endsuchasDDDorEmacsGUD-mode).
2.
2.
CommandlineoptionsGRSIMisstartedasfollowsonacommandline:grsim[options]ThefollowingcommandlineoptionsaresupportedbyGRSIM:-cfileReadscommandsfromfileinsteadofstdin.
-gdbListenforgdbconnectiondirectlyatstart-up.
-portgdbportSettheportnumberforgdbcommunications.
Defaultis2222.
-vTurnonverbosemode.
(debug1)-vvTurnonverbosemode.
(debug2)-simconffileUsefileassimulatorconfigurationmodule,insteadofthedefaultsimconf.
so-simconfcfgoptsPassoptsasparameterstothesimulatorconfigurationmodule.
E.
g"-simconfcfgsingle_argument"or"-simconfcfg'threeargumentspassed'".
-nosimconfTellthesimulatornottoloadaconfigurationmodule.
ThisswitchisonlyavailableinthelibraryversionofGRSIM.
-scisizeEnablesizekbinstructionscratchpadmemory.
-scdsizeEnablesizekbdatascratchpadmemory.
-ucmdfileLoadausercommandmodule.
(See'examples/UserCmd'inthedistributionforanexample)-finput_filesExecutablefilestobeloadedintomemory.
Theinputfileisloadedintothetargetmemoryaccordingtotheentrypointforeachsegment.
Recognizedformatsareelf32andS-record.
2.
2.
1.
SwitchesspecifictocertainmodulesHerefollowsswitchesthatarespecifictocertainsimulatormodels.
Ifmorethanoneinstanceofamodelisused,itmightbeagoodideatopasstheoptionsviatheconfigurationmodule,SeeAppendixC,toallowdifferentparameters2.
2.
2.
(VENDOR_GAISLER)SwitchesformodulesinpackageVENDOR_GAISLER2.
2.
2.
1.
(GAISLER_APBUART)GRLIBAPBUART-uartdeviceBydefault,theUARTisconnectedtostdin/stdout.
InLinux,thisswitchcanbeusedtoconnecttheuarttoanotherdevice.
E.
g.
"-uart/dev/ptypc"willconnecttheUARTtothepseudodeviceptypc.
(Tocommunicatewithptypc,theusershouldconnectto/dev/ttypc).
GRSIM-UMJune2017,Version1.
1.
566www.
cobham.
com/gaisler-fast_uartRuntheuartatinfinitespeed,ratherthanthedefault(slow)baudrate.
-uartlocalechoThiswillechoallinputcharacterslocallywhentheterminalisconnectedtostdin/stdout.
-uartfifoSelectsthesizeoftheReceiverandTransmitterFIFOs.
Validvaluesare1,2,4,8,16,32.
Defaultis1.
Cannotbeusedtogetherwith"-fast_uart".
-sbitsSelectsthenumberofbitsinthescalerregister.
Validvaluesare12-32.
2.
2.
2.
2.
(GAISLER_ETHMAC)GRLIBGRETH10/100EthernetMAC-idxiSetuniqueindexforspecificGRETHcore.
Needstobesetinsimulationconfigurationfile.
-phyrstadriSetresetvalueofPHYaddressinMDIOControl/Statusregistermdioregister.
ThisalsosetsthebusthatwillrepondtoMDIOoperations.
Default0.
2.
2.
2.
3.
(GAISLER_GPTIMER)GRLIBAPBGeneralPurposeTimer-pirqnumIrqnumbertousefortimerinterrupt.
Bydefaulttheambaconfiguration'sirqisused.
-sepirqUseseparateirq'sforthentimers.
-sbitsNumberofbitsforthescalar.
Defaultis16.
-nbitsNumberofbitsforthecounter.
Defaultis32.
-ntimersNumberoftimers(1-7).
Defaultis2.
2.
2.
2.
4.
(GAISLER_GRGPIO)GeneralPurposeI/OPort-idxnrTheindexamonggpiocores-vTurnonverboseoutput-nbitsSetstheGRGPIOnbitsgeneric.
Defaultis16.
-imaskmaskSetstheGRGPIOimaskgeneric.
Defaultis0.
-irqgenSetstheGRGPIOirqgengeneric.
Notethatthisgenericisavailablefromversion1ofthecoreanddecideswhetherinterruptmapregistersareimplementedornot.
Defaultis0whichisalsohowversion0behaves.
-driverso/dllfilesymbolLoadsanI/Odriverfromthegivenso/dllfile,wherethegivensymbolmustbeapointertoastructgrgpio_iodriver.
-output-zeroes-dataSetsquirkthatalinethatdrivesoutputwillalwaysread0forthatlineinthedataregister.
-restricted-outputmaskSetsquirkthatonlythelinesforwhichthecorrespondingbitinthegivenmaskissetcandriveoutput.
Theotherlinesbehavesasifdirectionisalwayssettoin(evenwhenthecorrespondingbitintheinthedirectionregisterissetto1).
2.
2.
2.
5.
(GAISLER_IRQMP)MultiprocessorInterruptcontrolleroptions-broadcastEnablesthebroadcastfunctionality.
GRSIM-UMJune2017,Version1.
1.
567www.
cobham.
com/gaisler-ampcntImplementtheAMPfunctionalityoftheIRQMPcontrollerforcntinstances.
-extnrImplementtheextendedirqcontrollerfunctionalitywithextendedinterruptnr.
-cpubusbusidIftheinterruptcontrollerislocatedonaseparatebus,specifythebusbusidwheretheCPUsarelocated.
2.
2.
2.
6.
(GAISLER_L2C)LEON2Compatibility,UART-uartdeviceBydefault,theUARTisconnectedtostdin/stdout.
InLinux,thisswitchcanbeusedtoconnecttheuarttoanotherdevice.
E.
g.
"-uart/dev/ptypc"willconnecttheUARTtothepseudodeviceptypc.
(Tocommunicatewithptypc,theusershouldconnectto/dev/ttypc).
-fast_uartRuntheuartatinfinitespeed,ratherthanthedefault(slow)baudrate.
2.
2.
2.
7.
(GAISLER_LEON3|4)LEON3|4CPU-smpidnumThecpu'sidthatwillappearinthecpuindexfieldof%asr17.
-nfpDisablestheFPUtoemulatesystemwithoutFPhardware.
AnyFPinstructionwillgenerateanFPdisabledtrap.
-dcsizesizeDefinestheset-size(kbytes)oftheLEONdcache.
Allowedvaluesare1-64inbinarysteps.
-dlockEnabledatacachelinelocking.
Defaultisdisabled.
-dlsizesizeSetsthelinesizeofthedatacache(inbytes).
Allowedvaluesare8,16or32.
-dsetssetsDefinesthenumberofsetsinthedatacache.
Allowedvaluesare1-4.
-dreplreplSetsthereplacementalgorithmforthedatacache.
Allowedvaluesarerndforrandomreplacement,lrufortheleast-recently-usedreplacementalgorithmandlrrforleast-recently-replacedreplacementalgorithm.
-icsizesizeDefinestheset-size(kbytes)oftheicache.
Allowedvaluesare1-64inbinarysteps.
-isetssetsDefinesthenumberofsetsintheinstructioncache.
Allowedvaluesare1-4.
-ilockEnableinstructioncachelinelocking.
-ilsizesizeSetsthelinesizeoftheinstructioncache(inbytes).
Allowedvaluesare8,16or32.
-ireplreplSetsthereplacementalgorithmfortheinstructioncache.
Allowedvaluesarerndforrandomreplacement,lrufortheleast-recently-usedreplacementalgorithmandlrrforleast-recently-replacedreplacementalgo-rithm.
-cacacheareagenericLeon4only:Thevalueofthecachedregionvhdl-generic.
Default:0x10ff.
2.
2.
2.
8.
(GAISLER_SDCTRL)GRLIBSDRAMController-sdramsizeSetstheamountofsimulatedSDRAM(Mbytes).
Defaultis16Mbytes.
-sdbanksnumNumberofsdrambanks.
Defaultis1.
GRSIM-UMJune2017,Version1.
1.
568www.
cobham.
com/gaisler2.
2.
2.
9.
(GAISLER_SPW)GRLIBGRSPWSpaceWirecontroller-idxiSetuniqueindexforspecificGRSPWcore.
Needstobesetinsimulationconfigurationfile.
-channelsnumSetnumberofDMAchannels.
Mustbeintherange1-8.
DefaultnumberofDMAchannelsis1.
-grspw1X_connect[ipaddress]Sameasthegrspw1X_connectcommand.
(SeeSection3.
3.
15)-grspw1X_server[port]Sameasthegrspw1X_servercommand.
(SeeSection3.
3.
15)-grspw1_normapDisablehardwareRMAPhandler.
-grspw1_rmapEnablehardwareRMAPhandler.
-grspw1_rmapcrcOnlyenablehardwareRMAPCRCcalculations.
(NohardwareRMAPhandler).
-grspw1X_dbgflagTurnondebuginformation.
Foralistofflagsusethegrspw1X_dbghelpcommand,seeSection3.
3.
15.
2.
2.
2.
10.
(GAISLER_SPW2)GRLIBGRSPW2SpaceWirecontroller-idxiSetuniqueindexforspecificGRSPW2core.
Needstobesetinsimulationconfigurationfile.
-grspwX_connect[ipaddress]SameasthegrspwX_connectcommand.
(SeeSection3.
3.
16)-grspwX_server[port]SameasthegrspwX_servercommand.
(SeeSection3.
3.
16)-grspwX_dbgflagTurnondebuginformation.
ForalistofflagsusethegrspwX_dbghelpcommand,seeSection3.
3.
16.
2.
2.
2.
11.
(GAISLER_SRCTRL)GRLIBSRAM/PROMController-sramsizeSetstheamountofsimulatedRAM(kbyte).
Defaultis2048.
0disablesthesram.
-promsizeSetstheamountofsimulatedPROM(kbyte).
Defaultis4096.
-promstartaddressStartaddressofprom.
Defaultisbar1oftheambaconfiguration.
(Notethattheambabarshavetocovertheaddress)-sramstartaddressStartaddressofsram.
Defaultisbar2oftheambaconfigurationorbar2ifpromsizeis0.
(Notethattheambabarshavetocovertheaddress)-sramwswsSetsthenumberofSRAMwaitstatestows.
Defaultis1.
-promwssizeSetsthenumberofPROMwaitstatestows.
Defaultis1.
2.
2.
2.
12.
(GAISLER_PCIFBRG)GRLIBGRPCIPCImaster/targetinterface-pci_abitsabitsDefinessizeofBAR0PCIaddressspace:2^abits.
UpperhalfaccessesPAGE0register.
LowerhalfistranslatedtoAHBaccesses.
-pci_dmaabitsdmaabitsDefinessizeofBAR1PCIaddressspace:2^dmaabits.
-pci_nothostIfpci_nothostisspecifiedthedeviceismodeledasifnotinaPCIhostslot.
-pci_blenbitsNumberofbitsinburstlengthregisterofPCIDMAcore.
GRSIM-UMJune2017,Version1.
1.
569www.
cobham.
com/gaisler-grpciipDefinesuserdefinedPCIinputprovider.
(SeeSection3.
3.
13.
2)-grpciiparg=Defineargumenttobegiventotheinputprovidersgrpci_inp_setup()callbackonstartup.
-grpciipargcanbegivenmultipletimes.
2.
2.
3.
(VENDOR_ESA)SwitchesformodulesinpackageVENDOR_ESA2.
2.
3.
1.
(ESA_LEON2)Leon2CPU-scisizeEnableinstructionscratchpadRAMofsizekb.
Validsizesare1-64kb(inbinarysteps).
-scdsizeEnabledatascratchpadRAMofsizekb.
Validsizesare1-64kb(inbinarysteps).
-sci_baseaddressSetthebaseaddressoftheinstructionscratchpadRAMtoaddress.
(Defaultsto0x8e000000)-scd_baseaddressSetthebaseaddressofthedatascratchpadRAMtoaddress.
(Defaultsto0x8f000000)-nfpDisablestheFPUtoemulatesystemwithoutFPhardware.
AnyFPinstructionwillgenerateanFPdisabledtrap.
-dcsizesizeDefinestheset-size(kbytes)oftheLEONdcache.
Allowedvaluesare1-64inbinarysteps.
-dlockEnabledatacachelinelocking.
Defaultisdisabled.
-dlsizesizeSetsthelinesizeofthedatacache(inbytes).
Allowedvaluesare8,16or32.
-dsetssetsDefinesthenumberofsetsinthedatacache.
Allowedvaluesare1-4.
-dreplreplSetsthereplacementalgorithmforthedatacache.
Allowedvaluesarerndforrandomreplacement,lrufortheleast-recently-usedreplacementalgorithmandlrrforleast-recently-replacedreplacementalgorithm.
-icsizesizeDefinestheset-size(kbytes)oftheicache.
Allowedvaluesare1-64inbinarysteps.
-isetssetsDefinesthenumberofsetsintheinstructioncache.
Allowedvaluesare1-4.
-ilockEnableinstructioncachelinelocking.
-ilsizesizeSetsthelinesizeoftheinstructioncache(inbytes).
Allowedvaluesare8,16or32.
-ireplreplSetsthereplacementalgorithmfortheinstructioncache.
Allowedvaluesarerndforrandomreplacement,lrufortheleast-recently-usedreplacementalgorithmandlrrforleast-recently-replacedreplacementalgo-rithm.
2.
2.
3.
2.
(ESA_MCTRL)Leon2MemoryController-onlyromOnlyallocateROMareamemory.
-sramsizeSetstheamountofsimulatedRAM(kbyte).
Defaultis4096.
-romsizeSetstheamountofsimulatedROM(kbyte).
Defaultis2048.
GRSIM-UMJune2017,Version1.
1.
5610www.
cobham.
com/gaisler-rom8-rom16Bydefault,thepromareaatresettimeisconsideredtobe32-bit.
Specifying-rom8or-rom16willinitializethememorywidthfieldinthememoryconfigurationregisterto8-or16-bits.
Theonlyvisibledifferenceisintheinstructiontiming.
2.
3.
InteractiveCommandsGRSIMdynamicallyloadslibreadline.
soifavailableonyourhostsystem,andusesreadline()toenteroreditmonitorcommands.
Iflibreadline.
soisnotfound,fgets()isusedinstead(nohistory,pooreditingcapabilitiesandnotab-completion).
Belowisadescriptionofthosecommandsavailable,whenusedinstand-alonemode.
batchexecuteabatchfileofgrsimcommandsbreakprintoraddbreakpointcontcontinueexecutioncpu[]Withoutparametersthe'cpu'commandshowscpustatus.
The'cpuactive'commandsetsactivecpu,i.
e.
thecputocontrolfromcommandline.
The'cpuenable/disable'commandenables/disablesoneorallcpus.
dcacheshowdatacachedebugchangeorshowdebugleveldeletedeletebreakpoint(s)disassembledisassemblememoryechoechostringinmonitorwindowepsettheentrypointfortheactivecpuexitsee'quit'floatdisplayFPUregistersgdbconnecttogdbdebuggergo[addr]startexecutionwithoutinitializationhbreakprintbreakpointsoraddhardwarebreakpoint(ifavailable)helpshowavailablecommandsorusageforspecificcommandxhelpshowdebuggingandstatuscommandsforspecificcoresicacheshowinstructioncacheinfoshowinformationaboutthesystem.
loadloadafilememsee'x'(examinememory)vmemlike'x'(examinememory)butwithvirtualaddressGRSIM-UMJune2017,Version1.
1.
5611www.
cobham.
com/gaislerregistershow/setintegerregistersresetresetactiveGRSIMrunresetandstartexecutionatlastloadaddressset|bus>setwhichcpu/bustocontrolfromcommandlineshellexecuteashellcommandstacksetthestackpointerfortheactivecpustepsinglesteponeor[n]timessymbolsshowsymbolsorloadsymbolsfromfileprofileshowandenablesprofilingwithaccuracyperfDisplayexecutionstatisticsstatisticDisplayaccessstatisticsforcpuandbusquitexitgrsimversionshowversionwatchprintoraddwatchpointswmemwritewordtomemoryxexaminememoryTypingaCtrl-Cwillinterruptarunningprogram.
Shortformsofthecommandsareallowed,e.
gc,co,orcon,areallinterpretedascont.
Tabcompletionisavailableforcommands,text-symbolsandfilenames.
2.
4.
SimulatorconfigurationBeforestartingthesimulator,aconfigurationmodulehastobecreated.
Aconfigurationmoduledefineswhichdevicesarepresentinthesimulatedsystemandwheretheyappearintheaddressspace.
AppendixB,foracompletesamplesimulatorconfiguration.
2.
4.
1.
ConstructingasimulatorconfigurationToconstructasimulatorconfiguration(referredtoassimconffromnowon),aSimConf_Tstructurehastobeexported.
typedefstructsimconf{/*dataprovidedbygrsim*/void*sim;/*operationsprovidedbygrsim*/int(*CreateBus)(void*sim);int(*AddLib)(structvendor_lib*lib);int(*AddDriver)(AmbaUnit_T*driver);int(*AddDevice)(void*simulator,intbusid,unsignedintvendor,unsignedintdevid,intirq,intnumbars,.
.
.
);GRSIM-UMJune2017,Version1.
1.
5612www.
cobham.
com/gaislerint(*AddParams)(intidx,char**params,char*str);/*data*/char**params;/*operations*/int(*init)(char*str);int(*exit)(void);int(*cmd)(char*cmd,void*arg);int(*ctrl)(intctl,void*arg);int(*SetMBApbMaster)(void*simulator,intbusid,intapbid);int(*SetBusPnp)(void*simulator,intbusid,unsignedintaddr);int(*SetSysId)(void*simulator,unsignedintsysid);}SimConf_T;where,simisapointertothecurrentsimulatorinstance.
AddLibisusedtoaddalibrarytothebuilt-inonesingrsim.
ThisallowsreuseofdevicedriverID.
AddDriveraddsadrivertooneoftheexistinglibraries.
CreateBuscreatesabusinthesystem.
Thereturnvaluefromthisfunctionisthebusidofthenewlycreatedbus.
Abusmust,ofcourse,becreatedbeforeanydeviceisaddedtothesystem.
AddDeviceaddsadevicetoabusinthesimulatedsystem.
Thefirst6parameterstoAddDevice()arefixed.
numbarsdesignatethenumberofentriestofollow.
Eachentryisheadedbyatagfollowedbyvariableargumentsdependingonthetag.
Thepossibletagsare:APBAddaAPBslavememorybartothelastaddedAPBmaster.
MASTERAddaAHBmastermemorybartothebus.
SLAVEAddaAHBslavememorybartothebus.
AHBIOAddaAHBslaveiobartothebus.
Inadditiontherearetagsthatareusedwhenconfiguringamultibussystem:SWITCHBUSSwitchmembarallocationtargettobuswithid.
Thisisusedwhenconfiguringadevicewithmultipleinterfacestodifferentbuses.
SETVERSIONSettheversionfieldofallfollowingentries.
Thedefaultversionis0.
SETCUSTOMSetthecustom0-2membarentry.
AddParamsaddsconfigurationparameterstothedevicewithididx.
ThevalueofidxforaspecificdeviceisthereturnvaluefromthecalltoAddDevice,thusAddDevicemustbecalledpriortoAddParams.
Theparamsargumentistheargumentthattheusersuppliedinsimconf.
params.
TheAddParamscallwillsimplycopytheargumentofitscallthere.
paramsisapointertoapointertothefirststringinanarrayofstrings.
(i.
e.
char*foo[]).
Theseparametersarepassedonlytothespecifieddeviceandallowsfordifferentconfigurationsofmultipleinstancesofthesamedevice.
E.
g.
thesecondoftwoUARTinstancesmightbepassed"-uart/dev/ptypc"toavoidbothuartsfromusingstdin/stdout.
initarecalledfromthesimulatoratstartup.
Argumentscanbepassedtothisfunctionbythe-simconfcfgcom-mandlineoption.
GRSIM-UMJune2017,Version1.
1.
5613www.
cobham.
com/gaislerexitarecalledfromthesimulatorwhenthesimulatorexits.
Itisnotmandatorytoprovidethisfromthesimconfmodule.
cmdarenotused,butprovidedforfutureextensionsofthesimconfmodule.
ctrlarenotused,butprovidedforfutureextensionsofthesimconfmodule.
SetMBApbMasterforabuswithmultipleAPBbridgesspecifytheAPBbridgethatthenextAPB-deviceaddedwithAddDe-viceshouldassociatewith.
TheparameterapbidisthereturnvalueofthecalltoAddDevicewhenallocatingtheAPBbridge.
ThedefaultAPBbridgeisthefirstoneadded.
SetBusPnpCurrentlynotused.
SetSysIdSetsthesystemIDofthesystemthatcanbefoundattheendoftheplug&playarea.
Foramorecompleteexample,seethesimulatorconfigurationmodulethatissuppliedwiththeGRSIMrelease.
Also,seeAppendixB,fordetailedcodelisting.
2.
5.
RunningapplicationsTorunaprogram,firstusetheloadcommandtodownloadtheapplicationandthenruntostartit.
john@venus%.
/grsim.
exeGRSIMLEONMPSimulatorv1.
1.
39professionalversionCopyright(C)2004-2009AeroflexGaisler-allrightsreserved.
Forlatestupdates,gotohttp://www.
gaisler.
com/Commentsorbug-reportstosupport@@gaisler.
comCreatingasimulatorinstance.
LoadingConfigModule,"simconf.
so"Loadedsimconf.
soaddedlibrary"TestVendor"addeddriver"SimpleEXAMPLEMemController"Initialising.
.
.
icache:1*4kbytes,16bytes/line(4kbytestotal)dcache:1*4kbytes,16bytes/line(4kbytestotal)allocated4096KRAMmemory,in1bank(s)allocated2048KROMmemoryInitialisingtheInterruptcontroller.
.
.
InitializingUARTserialportonstdin/stdoutComponentVendorLeon2SPARCV8ProcessorESALeon2MemoryControllerESALeon2compatmoduleGaislerResearchLeon2compatmoduleGaislerResearchLeon2compatmoduleGaislerResearchAHB/APBBridgeGaislerResearchLeon2TimerandWatchdogmoduleGaislerResearchLeon2IRQControllerGaislerResearchAPBUARTGaislerResearchgrsim>loadsamples/stanford.
promtotalsize:28048bytes(inrunMkPromLEONbootloaderv1.
2CopyrightGaislerResearch-allrightreservedsystemclock:50.
0MHzbaudrate:19171baudprom:512K,(2/2)ws(r/w)sram:2048K,1bank(s),0/0ws(r/w)GRSIM-UMJune2017,Version1.
1.
5614www.
cobham.
com/gaisleredac:disableddecompressing.
textdecompressing.
datastartingstanfordStartingPermTowersQueensIntmmMmPuzzleQuickBubbleTreeFFT5050336733184333331750Nonfloatingpointcompositeis137Floatingpointcompositeis168Programexitednormally.
2.
6.
InsertingbreakpointsandwatchpointsGRSIMsupportsexecutionbreakpointsandwritedatawatchpoints.
Instand-alonemode,hard-warebreakpointsarealwaysusedandnoinstrumentationofmemoryismade.
Whenusingthegdbinterface,thegdb`break'com-mandnormallyusessoftwarebreakpointsbyoverwritingthebreakpointaddresswitha'ta1'instruction.
Hard-warebreakpointscanbeinsertedbyusingthegdb'hbreak'command.
Datawritewatch-pointsareinsertedusingthe'watch'command.
Awatchpointcanonlycoveronewordaddress,blockwatchpointsarenotavailable.
2.
7.
DisplayingregistersThecurrentregisterwindowcanbedisplayedusingtheregistercommand:grsim>registerINSDATAOUTSGLOBALS0:000000274001300000000027000000001:40650E97400010244000A470000000012:9999999A40001028401FDF000000000A3:0000029D4001334400000000401FD6874:000007700000000040650E974000A8005:401FDF30000000009999999A000007706:401FDEB800000000401FDE50000000017:400012080000000040004E0800000000psr:004010C5wim:00000080tbr:40000800y:01800000pc:4000080091d02000ta0x0npc:4000080401000000nopOtherregisterwindowscanbedisplayedusingregn,whenndenotesthewindownumber.
UsethefloatcommandtoshowtheFPUregisters(ifpresent).
2.
8.
CodecoverageThenormalGRSIMdoesn'tincludecodecoverage.
ThereisaspecialGRSIMbinarymarkedwitha-coveragesuffix.
ThisbinaryimplementsthecoveragecommandssimilartothosepresentinTSIM.
TheGRSIMversionwithsuffix-coveragerunsslowerduetotheoverheadimposed.
CoverageisimplementedforLEON3andLEON4processorcoresandisdoneonaper-cpubasis.
Whenenabled,codecoveragekeepsarecordforeach32-bitwordintheemulatedmemoryandmonitorswhetherthelocationhasbeenread,writtenorexecuted.
Thecoveragefunctioniscontrolledbythecoveragecommand:coverage[cpunum]enableenablecoveragecoverage[cpunum]disabledisablecoveragecoverage[cpunum]save[filename]writecoveragedatatofile(filenameoptional)coverage[cpunum]printaddress[len]printcoveragedatatoconsole,startingataddresscoverage[cpunum]clearresetcoveragedataGRSIM-UMJune2017,Version1.
1.
5615www.
cobham.
com/gaislerThecoveragedataforeach32-bitwordofmemoryconsistsofa5-bitfield,withbit0(lsb)indicatingthatthewordhasbeenexecuted,bit1indicatingthatthewordhasbeenwritten,andbit2thatthewordhasbeenread.
Bit3andbit4indicatesthepresenceofabranchinstruction;ifbit3issetthenthebranchwastakenwhilebit4issetifthebranchwasnottaken.
Asanexample,acoveragedataof0x6wouldindicatethatthewordhasbeenreadandwritten,while0x1wouldindicatethatthewordhasbeenexecuted.
Whenthecoveragedataisprintedtotheconsoleorsavetoafile,itispresentedforoneblockof32words(128bytes)perline:grsim>coverage0printstart40000000:1111000000000000000011111111000040000080:0000000000000000000000000000000040000100:0000000000000000000000000000000040000180:00000000000000000000000000000000Whenthecodecoverageissavedtofile,onlyblockswithatleastonecoveragefieldsetarewrittentothefile.
Blockthathaveallthecoveragefieldssettozeroarenotsavedinordertodecreasethefilesize.
Notethatallmemory(promandram)aresubjectforcodecoverage.
Coveragealsosupportsvirtualaddresses.
Whencoverageisenabled,disassemblywillincludeanextracolumnaftertheaddress,indicatingthecoveragedata.
Thismakesiteasiertoanalysewhichinstructionshasnotbeenexecuted:grsim>dis0000000000x881000001clr%g4000000040x0900003a1sethi%hi(0xe800),%g4000000080x81c120981jmp%g4+0x980000000c0x010000001nop000000100xa14800000mov%psr,%l0000000140xa75000000mov%wim,%l3000000180x10803a1a0ba0x0000e8800000001c0xac1020010mov1,%l6ExamplescriptsforannotatingCcodeusingsavedcoverageinformationfromGRSIMcanbefoundinthecoveragesub-directory.
2.
9.
SymbolicdebuginformationandprofilingGRSIMwillautomaticallyextract(.
text)symbolinformationfromelf-files.
Itisalsopossibletoreadsymbolsfromanalternative(elf)file,whichisveryusefulwhendebuggingselfextractingapplications,suchasthosecreatedbymkprom.
Thesymbolscanbeusedwhereveranaddressisexpected.
:grsim>loadsamples/stanford.
promtotalsize:28048bytes(inbreakmainbreakpoint1at0x000067f8:maingrsim>symbolssamples/stanfordread195symbolsentrypoint:0x40000000grsim>breakmainbreakpoint2at0x40001ac8:maingrsim>Thesymbolscommandcanalsobeusedtodisplayallcurrentlyloadedsymbols:grsim>symbolssamples/helloread71symbolsgrsim>symbols0x40000000L_trap_table0x40000000Lstart0x4000102cL_window_overflow0x40001084L_window_underflow0x400010dcL_fpdis0x400011a4T_flush_windows0x400011a4T_start0x40001218Lfstat0x40001220LisattyGRSIM-UMJune2017,Version1.
1.
5616www.
cobham.
com/gaisler0x40001228Lgetpid0x40001230Lkill0x40001238L_exit0x40001244Llseek.
.
.
Theprofilecommandcanbeusedtoshowusageofprogramfunctions.
Enablingprofileisdonebyprofilewhereistheintervaltimeinclockcyclesforwhichaprobeshouldreoccur.
Oneachprofilingintervaleventthecallstackisusedtoupdateaexecutioncountforeachsymbolpresent.
Recursivefunc-tionsmaythereforecauseexpectedthoughcorrectresults.
grsim>profile100Profilingenabled:interval100grsim>runStartingPermTowersQueensIntmmMm.
.
.
grsim>profilefunctionsamplesratio(%),tower69102227.
93Permute26937710.
88_hardreset_real25698810.
38_start25698610.
38main25626510.
35Try1859617.
51Intmm733092.
96Innerproduct669842.
70Towers534632.
16Perm485131.
96Mm471151.
90Move458311.
85rInnerproduct387961.
56Queens335791.
35Doit335511.
35.
.
.
2.
10.
DisplayingmemorycontentsAnymemorylocationcanbedisplayedusingthexcommand.
Ifathirdargumentisprovided,thatisinterpretedasthenumberofbytestodisplay.
Textsymbolscanbeusedinsteadofanumericaddress.
Ifthemmuisswitchedonthevmemcommandcanbeusedtotranslatetheaddressfirst.
Thebusonwhichtoissuetheaccesshastobesetusingthesetbuscommand.
grsim>x0x4000000040000000a01000002910000481c52000010000004000001091d020000100000001000000010000004000002091d020000100000001000000010000004000003091d02000010000000100000001000000grsim>x0x400000003240000000a01000002910000481c52000010000004000001091d02000010000000100000001000000grsim>xmain40001AC89de3bf887fffffb19007bfe8d407bfe840001AD892102003912aa0019002000a912a200340001AE89002000a40000913912a200181c7e00840001AF891e8000813000049921260031510006b.
.
.
.
I.
.
.
.
`.
.
k.
.
.
2.
11.
DisassemblyofmemoryAnymemorylocationcanbedisassembledusingthedisassemblecommand.
Aswiththeexaminecommand,textsymbolscanbeusedasanaddress.
Also,aregioncanbedisassembled.
grsim>disassemble0x40000000540000000a0100000clr%l04000000429100004sethi%hi(0x40001000),%l44000000881c52000jmp%l4GRSIM-UMJune2017,Version1.
1.
5617www.
cobham.
com/gaisler4000000c01000000nop4000001091d02000ta0x0grsim>disassemblemain340001ac81110000esethi%hi(0x40003800),%o040001acc90122010or%o0,0x10,%o040001ad08213c000or%o7,%g1grsim>disassemble0x400000000x4000000c40000000a0100000clr%l04000000429100004sethi%hi(0x40001000),%l44000000881c52000jmp%l44000000c01000000nop2.
12.
LoadablecommandmoduleItispossiblefortheusertoaddcommandstogrsimbycreatingaloadablecommandmodule.
ThemoduleshouldexportapointertoaUserCmd_TcalledUserCommands,e.
g.
:UserCmd_T*UserCommands=&CommandExtension;UserCmd_Tisdefinedas:typedefstruct{LibIf_T*lib;/*Functionsexportedbygrmon*/int(*MemoryRead)(LibIf_T*lib,unsignedintaddr,unsignedchar*data,unsignedintlength);int(*MemoryWrite)(LibIf_T*lib,unsignedintaddr,unsignedchar*data,unsignedintlength);void(*GetRegisters)(LibIf_T*lib,unsignedintregisters[]);void(*SetRegisters)(LibIf_T*lib,unsignedintregisters[]);void(*dprint)(char*string);/*Functionsprovidedbyuser*/int(*Init)();int(*Exit)();int(*CommandParser)(intargc,char*argv[]);char**Commands;intNumCommands;}UserCmd_T;Thefirstfiveentriesisfunctionpointersthatareprovidedbygrsimwhenloadingthemodule.
Theotherentrieshastobeimplementedbytheuser.
Thisishow:InitandExitarecalledwhenenteringandleavingagrsimtarget.
CommandParserarecalledfromgrsimbeforeanyinternalparsingisdone.
Thismeansthatyoucanoverrideinternalgrsimcommands.
OnsuccessCommandParsershouldreturn0andonerrorthereturnvalueshouldbe>200.
Onerrorgrsimwillprintouttheerrornumberfordiagnostics.
argv[0]isthecommanditselfandargcisthenumberoftokens,includingthecommand,thatissupplied.
Commandsshouldbealistofavailablecommands.
(usedforcommandcompletion)NumCommandsshouldbethenumberofentriesinCommands.
ItiscrucialthatthisnumbermatchesthenumberofentriesinCommands.
IfNumCommandsissetto0(zero),nocommandcompletionwillbedone.
AsimpleexampleofacommandmoduleissuppliedwiththeprofessionalversionofGRSIM.
2.
13.
GDBinterfaceThissectiondescribeshowtousegdbwithGRSIM.
2.
13.
1.
AttachingtogdbGRSIMcanactasaremotetargetforgdb,allowingsymbolicdebuggingoftargetapplications.
Toinitiategdbcommunications,startthemonitorwiththe-gdbswitchorusetheGRSIMgdbcommand:grsim>gdbgdbinterface:usingport2222GRSIM-UMJune2017,Version1.
1.
5618www.
cobham.
com/gaislerThen,startgdbinadifferentwindowandconnecttoGRSIMusingtheextended-remoteprotocol:(gdb)targetextended-remotepluto:2222Remotedebuggingusingpluto:22220x40000800instart()(gdb)Whileattached,normalGRSIMcommandscanbeexecutedusingthegdbmonitorcommand.
OutputfromtheGRSIMcommands,suchastheregisterinformationisthendisplayedinthegdbconsole:(gdb)monitorregINSDATAOUTSGLOBALS0:000000040000000000000008000000001:400155FC40001DD400000001400220002:4001569440001DD800000004000000733:000000300000001000000005000000004:4001562C00000800400156244000A8F05:000000070000008040015694000007706:401FD7C800000000401FD760000000017:40001E3C40022000400155FC00000000psr:000010E4wim:00000004tbr:40000050y:00000000pc:40001e1cd4232004st%o2,[%o4+0x4]npc:40001e2010800004ba0x40001e30(gdb)2.
13.
2.
DebuggingofapplicationsToloadandstartanapplication,usethegdbloadandruncommand.
(gdb)loLoadingsection.
text,size0xcb90lma0x40000000Loadingsection.
data,size0x770lma0x4000cb90Startaddress0x40000000,loadsize54016Transferrate:61732bits/sec,278bytes/write.
(gdb)bremainBreakpoint1at0x400039c4:filestanford.
c,line1033.
(gdb)runTheprogrambeingdebuggedhasbeenstartedalready.
Startitfromthebeginning(yorn)yStartingprogram:/home/john/samples/stanfordBreakpoint1,main()atstanford.
c:10331033fixed=0.
0;(gdb)Tointerruptsimulation,Ctrl-CcanbetypedinbothGDBandGRSIMwindows.
TheprogramcanberestartedusingtheGDBruncommandbutaloadhasfirsttobeexecutedtoreloadtheprogramimageonthetarget.
Softwaretrap1(ta1)isusedbygdbtoinsertbreakpointsandshouldnotbeusedbytheapplication.
2.
13.
3.
DetachingIfgdbisdetachedusingthedetachcommand,themonitorreturnstothecommandprompt,andtheprogramcanbedebuggedusingthestandardGRSIMcommands.
Themonitorcanalsobere-attachedtogdbbyissuingthegdbcommandtothemonitor(andthetargetcommandtogdb).
GRSIMtranslatesSPARCtrapsinto(Unix)signalswhichareproperlycommunicatedtogdb.
Iftheapplicationencountersafataltrap,executionwillbestoppedexactlybeforethefailinginstruction.
Thetargetmemoryandregistervaluescanthenbeexaminedingdbtodeterminetheerrorcause.
2.
13.
4.
SpecificGDBoptimizationGRSIMdetectsgdbaccesstoregisterwindowframesinmemorywhicharenotyetflushedandonlyresideintheprocessorregisterfile.
Whensuchamemorylocationisread,GRSIMwillreadthecorrectvaluefromtheregisterfileinsteadofthememory.
Thisallowsgdbtoformafunctiontracebackwithoutany(intrusive)modificationofGRSIM-UMJune2017,Version1.
1.
5619www.
cobham.
com/gaislermemory.
Thisfeatureisdisabledduringdebuggingofcodewheretrapsaredisabled,sincenovalidstackframeexistatthatpoint.
GRSIMdetectstheinsertionofgdbbreakpoints,informofthe`ta1'instruction.
Whenabreakpointisinserted,thecorrespondinginstructioncachetagisexamined,andifthememorylocationwascachedthetagisclearedtokeepmemoryandcachesynchronized.
2.
13.
5.
LimitationsofgdbinterfaceDonotusethegdbcommand,"where",inpartsofanapplicationwheretrapsaredisabled(e.
g.
traphandlers).
Sincethestackpointerisnotvalidatthispoint,gdbmightgointoaninfinitelooptryingtounwindfalsestackframes.
GRSIM-UMJune2017,Version1.
1.
5620www.
cobham.
com/gaisler3.
SimulatormodulesThisdescribeshowtowriteyouownsimulationmodelofanAHBslaveorAPBslavetouseingrsim.
3.
1.
ThebasicstructureThesimulatorinterfaceforattachingadeviceinthesimulatorisasfollows:typedefstructamba_unit{/*identificationdata*/shortvendor;shortversion;shortdevice;chardesc[32];/*functions*/int(*read)(structahb_dev_rec*me,structahb_dev_rec*master,unsignedintaddress,unsignedint*data,unsignedintlength,unsignedintwsize);int(*write)(structahb_dev_rec*me,structahb_dev_rec*master,unsignedintaddress,unsignedint*data,unsignedintlength,unsignedintwsize);int(*read_done)(AccRes_T*result);int(*write_done)(AccRes_T*result);int(*ctrl)(intctl,structahb_dev_rec*me,void*args);int(*cmd)(char*cmd,structahb_dev_rec*me);}AmbaUnit_T;Thisisthestructurethatshouldbeexportedbyeachdevicemodule.
vendorThevendorIDofthedevice.
versionTheversionofthedevice.
deviceThedeviceIDofthedevice.
readThefunctionthatiscalledwhenareadaccessismadetothedevice.
writeThefunctionthatiscalledwhenawriteaccessismadetothedevice.
read_donewrite_doneNotusedbyAHBslavesorAPBslaves.
ctrlThisisthegenericcontrolfunction.
Itisviathisfunctionthatgrsimcommunicateswiththedevice.
Theminimumsetofcommandsthatadevicehastoimplementare:GRDRV_INIT,iscalledduringsimulatorinitialisation.
Read/writeaccesstoallLEONregistersandmemoryGRDRV_EXIT,iscalledwhenthesimulatorexits.
Hereisagoodplacetofreememorythathasbeenallocatedbythedevice.
Built-indisassemblerandtracebuffermanagementGRDRV_RESTART,iscalledduringsimulatorreset.
DownloadingandexecutionofLEONapplicationsGRDRV_OPTIONS,isactuallynotrequired,butitisstronglyadvisabletoatleastimplementanemptyhandlerforthiscommandtoeasilybeeingabletosendconfigurationparameterstothedevice.
cmdThisfunctioniscalledwheneverGRSIMdoesn'trecognizeacommandasainternalcommand.
E.
g.
ifrunisissued,cmdwillnotbecalledbecauserunisaninternalgrsimcommand.
But,ifmy_nice_cmdisissued,cmdwillbecalled.
GRSIM-UMJune2017,Version1.
1.
5621www.
cobham.
com/gaisler3.
2.
ReadandWriteoperationsThereareacoupleofimplementationsconstraintswhenimplementingthereadandwriteoperationswhichwillbedescribedbelow.
3.
2.
1.
Theparametersexplainedmeapointertothisdevice'sinstantiationstructure.
Thiscanbethoughtofas'this'inC++.
masterapointertothecallee'sdevicestructure.
addresstheaddresstowhichtheaccessismade.
Thesimulatorguarantiesthatthisaddressalwaysiswithintheregionthatthedevicewasattachedinthesimulatorconfiguration.
SeeAppendixB.
dataapointertothedatawhichisreadfrom/writtento.
lengththelengthofthetransactioninwsizeunits.
wsizethewordsizeinthetransaction:wsizewordsize[bytes]011224383.
2.
2.
OrdinaryaccessesApartfromfillingin/readingouttherequesteddata,theslavemustalsofinishthetransactionbyacalltoGrsim_AmbaReadDone(orGrsim_AmbaWriteDoneifitwasawrite).
3.
2.
3.
DiagnosticaccessesThesimulatorusesthereadandwriteoperationsfordiagnosticaccesses,whichshouldnotinterferewiththesimulation.
ThisisdonebysettingthemastertoDIAG,seeAppendixD.
WhentheslavedetectsthatthemasterissettoDIAG,itshouldnotcallGrsim_AmbaReadDone(orGrsim_AmbaWriteDoneifitwasawrite).
3.
3.
PredefinedmodulesThischapterdescribesthepredefinedmodulesavailablewithGRSIM.
3.
3.
1.
(ESA_LEON2)LEON2CPUTheLEON2cpumodule(vendorid:VENDOR_ESA,deviceid:ESA_LEON2)simulatesaLEON2processor.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//leon2:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_ESA,ESA_LEON2,0,0);simcfg.
AddParams(i,simcfg.
params,"cpuparams");3.
3.
2.
(ESA_MCTRL)LEON2memorycontrollerTheLEON2memorycontrollermodule(vendorid:VENDOR_ESA,deviceid:ESA_MCTRL)simulatesrom/sramandsdram.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
FourbarswithrangeGRSIM-UMJune2017,Version1.
1.
5622www.
cobham.
com/gaisler0x00000000-0x10000000,0x20000000-0x30000000,0x40000000-0x70000000and0xc0000000-0xc0000100areallocated.
Inside0x40000000-0x70000000therewillbe16mbofsramat0x4000000-0x4100000and16mbofsdramar0x6000000-0x6100000.
Inside0x00000000-0x10000000therewillbe4mbofprom(default)at0x00000000-0x00400000.
Thememorycontroller'sregisterswillappearat0xc0000000onward.
//memctrl:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_ESA,ESA_MCTRL,1,4,SLAVE,0x00000000,0x10000000,1,SLAVE,0x20000000,0x10000000,1,SLAVE,0x40000000,0x30000000,1,APB,0xc0000000,0x00000100,0);simcfg.
AddParams(i,simcfg.
params,"-sram16384-sdram16");3.
3.
3.
(GAISLER_APBUART)GRLIBAPBUARTTheGRLIBAPBUART(vendorid:VENDOR_GAISLER,deviceid:GAISLER_APBUART)simulatesoneuart.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
Auartwho'sregistersareacces-siblefromaddress0xc0000100onwardiscreated.
//uart:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_APBUART,3,1,APB,0xc0000100,0x00000100,0);simcfg.
AddParams(i,simcfg.
params,"-fast_uart");/*-uart/dev/ptypc");*/3.
3.
4.
(GAISLER_ETHMAC)GRETH10/100EthernetMACmoduleTheEthermacmodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_ETHMAC)simulatestheGRLIBGRETH10/100EthernetMAC.
ThesimulationmodeldeliversandreceivespacketsthroughaTCPsocket.
AnexamplepacketserverisdeliveredwithGRSIMwhichusesthetun/tapinterfaceinLinuxtoattachtoarealEthernetnetwork.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//ethermaci=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_ETHMAC,12,1,APB,0x80000800,0x00000100,0);GRSIM-UMJune2017,Version1.
1.
5623www.
cobham.
com/gaisler3.
3.
4.
1.
CommandsCommandsforthismodule:grethX_statusPrintouthestatusofthebufferdescriptorsandtheregisters.
grethX_connect[ipaddress]Trytoconnecttothepacketserverataddressipaddress,ifipaddressisomittedlocalhostisused.
TCPport2224isused.
Thepacketservermusthavebeenstartedinanothershelloronanotherlinuxbox.
grethX_dbg[|clean|list|help]Toggledebugoutputoptions.
DogrethX_dbghelpforalistofpossibleoptions.
grethX_dbgcleanwilldeactivatealldebugoutputandgrethX_dbglistwilllistthecurrentsettings.
grethX_dump[file]DumppacketstoEtherealreadablefile.
Whenafileisnotspecifiedthecurrentdumpfilewillbeclosed.
grethX_ping[ipaddress]Simulateapingtransmission.
PacketswillbegeneratedbyGRSIM.
Ifipaddressisnotspecifiedthedefaultis192.
168.
0.
80.
3.
3.
4.
2.
PacketserverAexamplepacketserverisdeliveredwithGRSIM(greth_config).
Tostartthepacketservergreth_configyouhavetoberoot.
Ituses192.
168.
0.
81asthetap0interface'saddressbydefault.
Tospecifyadifferentinterfaceipnumberusethe-ipifswitch.
TheipaddressoftheoperatingsystemrunninginGRSIMisdefaultassumedtobe192.
168.
0.
80butcanbechangedbythe-ipswitch.
Thepacketservertriestoconfiguretheipstackbyissuingthefollowingcommands:echo1>/proc/sys/net/ipv4/ip_forwardecho1>/proc/sys/net/ipv4/conf/tap0/proxy_arprouteadd-host192.
168.
0.
80devtap0Where192.
168.
0.
80istheipaddressoftheinterfaceoftheoperatingsystemrunninginthesimulatororif-ipwasgiven.
greth_configtriestoissuethecommandsatstartup.
Incasetheycan'tbeexecutedissuethembyhand.
Whenrunningtheserveryoucanenter1-3tospecifythedebugginglevel.
For3eachre-ceived/transmittedpacketwillbedumpedonthescreen.
ThepacketformatusedbytheGRETHmoduleisshownbelow.
Notethateachpacketisprependedwithaonewordlengthfieldindicatingthelengthofthepackettocome(includingitsheader).
3100x0LENGTH31:0LENGTH,specifieslengthofpacketincludingtheheaderHeader311615875400x4RESIPID=1TYPE=0RES31:16RES,reservedforfutureuse15:8IPID,IPcoreID,mustequal1forEthernet7:5TYPE,packettype,0fordatapackets4:0RES,reservedforfutureusePayload0x8-EthernetframeFigure3.
1.
EthernetdatapacketGRSIM-UMJune2017,Version1.
1.
5624www.
cobham.
com/gaisler3.
3.
5.
(GAISLER_GPTIMER)GRLIBAPBGeneralPurposeTimerTheGRLIBAPBGeneralpurposeTimer(vendorid:VENDOR_GAISLER,deviceid:GAISLER_GPTIMER)sim-ulatesamultipurposeinterrupttimer.
Oneinstancecansimulatemultipletimerswhichcaneatherissuethesameinterruptorseperateinterrupts.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
AgeneralpurposeTimerwith2timers(default)usingthesameinterruptiscreated.
Theirqnumberisthatoftheambaconfiguration,8.
//timer:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_GPTIMER,8,//irqnr1,APB,0xc0000300,//bar10x00000100,//bar10);simcfg.
AddParams(i,simcfg.
params,"");3.
3.
6.
(GAISLER_GRGPIO)GeneralPurposeI/OPortTheGRGPIOgeneralpurposeI/Oport(vendorid:VENDOR_GAISLER,deviceid:GAISLER_GRGPIO)simu-latesallregistersoftheGRLIBGRGPIOcoreexceptforthebypassregister.
Notethattheavailableregistersdependsontheversionofthecore(capabilitiesregisterfromversion2)andthegenerics(interruptmapregistersavailabilitydependson-irqgen)thatarebeingusedtoinstantiateit.
Section2.
2.
2.
4forinstantiationoptions.
AuserdefinedI/OdrivermoduleisconnectedtotheGRGPIOmoduletosimulatetheI/Oenvironmentofthecore.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_GRGPIO,0,1,APB,0x80000900,0x00000100,0);simcfg.
AddParams(i,simcfg.
params,"-idx0-nbits32-imask0xffff");3.
3.
6.
1.
CommandsCommandsforthismodule(wheretheXingpioXshouldbereplacedbytheindexofthecoretoworkwith):gpioX_driverLoadsanI/Odriverfromthegivenso/dllfile,wherethegivensymbolmustbeapointertoastructgrgpio_iodriver.
gpioX_statusPrintoutthestatusofregistersandI/Oprovider.
gpioX_inputSetdefaultinputvaluedobeusedwhenthereisnoconnectedI/Odriver.
gpioX_dbg[|clean|list|help]Toggledebugoutputoptions.
DogrethX_dbghelpforalistofpossibleoptions.
grethX_dbgcleanwilldeactivatealldebugoutputandgrethX_dbglistwilllistthecurrentsettings.
gpioX_verbose[0|1]Toggleorsetverboseoutputofmodule.
3.
3.
6.
2.
I/OdriverinterfaceTheusershouldsupplyadynamiclibrarythatexposesasymboloftypestructgrgpio_iodriver*.
Thestructgrgpio_iodriveristheoverallinterfacebetweenaGRGPIOI/OandGRSIM.
Itisdefinedingrgpio_iodriver.
has:GRSIM-UMJune2017,Version1.
1.
5625www.
cobham.
com/gaislerstructgrgpio_iodriver{/*Seegrgpio_core_iodriver.
h*/structgrgpio_core_iodrivercore_driver;InitializedbyI/Odriver=====*//**CalledbyGRSIMonceatsetup.
*Shouldreturn0onsuccessandnon-zerootherwise.
*/int(*setup)(structgrgpio_iodriver*driver);/*CalledbyGRSIMonreset*/void(*reset)(structgrgpio_iodriver*driver);/*CalledbyGRSIMfortearingdowntheI/Odriver*/void(*exit)(structgrgpio_iodriver*driver);InitializedbyGRSIM=====*//*I/Odriverinterfaceforinterfacingwithgrsim*/structiodriverif*iodif;/*Index,amonggrgpiocores,ofthecore*/intidx;/*Nameofgrgpio*/constchar*name;};Thestructgrgpio_core_iodriveristheinterfacebetweenaGRGPIOI/OdriverandtheGRGPIOcorelogic.
Itisdefinedingrgpio_core_iodriver.
has:structgrgpio_core_iodriver{structgrgpio_core*core;/*Opaquepointerforthegrgpiocore*/void*ip_data;/*PointerforusebytheI/Odriver*//**Getscalledbythegrgpiocorewheneveradirectionischangedorifan*outputvalue(forapinintheoutdirection)ischanged.
**Bitxofdirindicatesthatthegrgpiocoredrivesoutputonlinexwhen*1andthatitdoesnotwhenitis0.
**FunctionmustbeinitializedbyI/Odriver.
*/void(*output_change)(structgrgpio_core_iodriver*driver,uint32dir,uint32output);/**MustbecalledbyI/Odriverwhenevertheinputtothecorechanges.
May*becalledbyI/Odriverevenifinputdatahasnotchangedsincelast*call.
**NotethatisuptotheI/Odrivertocallorarrangeforacallofthis*functiontochangeinputvalueevenforlinesforwhichthegrgpiocore*isdrivinganoutputvalue.
**Functiongetsinitializedbygrgpiocore.
*/void(*set_input)(structgrgpio_core*core,uint32input);/**CanoptionallybesetbyI/Odriver.
Ifset,shouldprintI/Odriver*status.
*/void(*print_status)(structgrgpio_core_iodriver*driver);};ThestructiodriverifcontainsfunctionsthatanI/OdrivercanusetointerfacewithGRSIM.
Itisdefinediniodriver.
has:structiodriverif{/**Pointertosimulationinstancetouseasanargumentinthefunctions*belowGRSIM-UMJune2017,Version1.
1.
5626www.
cobham.
com/gaisler*/void*sim;/**Addsaneventtotheeventqueue.
*Returns0onsuccess,non-zeroonfailure.
*/int(*add_event)(void*sim,void(*handler)(void*),void*arg,SimTime_Toffset);/**Stopsalleventthatmatchesthegivenhandler.
*Returnsthenumberofstoppedevents.
*/int(*stop_event)(void*sim,void(*handler)(void*));/**Stopsalleventthatmatchesboththegivenhandlerandarg.
*Returnsthenumberofstoppedevents.
*/int(*stop_event_arg)(void*sim,void(*handler)(void*),void*arg);/**Returnsnon-zeroinaneventexistsintheeventqueuethatmatchesboth*thegivenhandlerandarg.
*/int(*event_exists)(void*sim,void(*handler)(void*),void*arg);/**Returnsthecurrentsimulationtime.
*/SimTime_T(*get_time)(void*sim);/**Stopsthesimulationaftercurrenteventisfinished,butbeforethenext*event.
*/void(*stop_simulation)(void*sim);/**Printsbothtostdoutand,iflogging,tologfile.
Workslikeprintf*apartfromthesimarugment.
*/int(*simprintf)(void*sim,char*format,.
.
.
);};TypicallyanI/Odriversetsupastructgrgpio_iodriverinitializingthesetup,resetandexitfunctionsthatarecalledbyGRSIMwhenthemoduleisloaded,atresetandwhenthemoduleisunloaded.
Forthestructgrgpio_iodrivercore_driverfield,theoutput_changefunctionpointermustbeinitializedbytheI/Odriverwithafunctionthatdealswithchangesoftheoutputfromthecore,print_statusfunctionpointeristypicallyinitializedwithafunctionthatprintsstatusinformationontheI/Odriverandtheip_datapointeristypicallysettopointtosomeuserdefineddatastructurethatisusedbytheI/Odriver.
Betweenthecalltothesetupfunctionandtheexitfunctionofastructgrgpio_iodriver,theidxandthenamecanbereadandcore_driver.
set_inputandallthefunctionsiniodifcanbecalled.
NotethatwhenanGRGPIOI/Odriverisloaded,thereadoutofthedataregisterisnotautomaticallyupdat-edduetowritestotheoutputordirectionregisters.
ItisuptotheGRGPIOI/Odrivertoarrangeforacallofcore_driver.
set_input(bycallingitdirectlyorbyaddinganeventthatwilleventuallycallit)tohavetheinput,asviewedfromtheGRGPIOcore,changeattheappropriatetime.
ForanexampleGRGPIOI/Odriverseetheexampleinthedistributedgrgpio_iodriver_example.
cfile.
3.
3.
7.
(GAISLER_IRQMP)MultiprocessorInterruptcontrollerwithAMPsupportTheIRQMPInterruptcontroller(vendorid:VENDOR_GAISLER,deviceid:GAISLER_IRQMP)simulatesamul-tiprocessorprocessorinterruptcontroller.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//irq:i=simcfg.
AddDevice(simcfg.
sim,BUS1,VENDOR_GAISLER,GAISLER_IRQMP,GRSIM-UMJune2017,Version1.
1.
5627www.
cobham.
com/gaisler10,1,APB,0xf0004000,0x00004000,0);simcfg.
AddParams(i,simcfg.
params,"-broadcast-amp4-ext10-cpubus0");3.
3.
8.
(GAISLER_L2C)LEON2CompatibilityTheLEON2Compatibilitymodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_L2C)simulatesallLEON2registersfrom0x800000000onwardexceptoftheinterruptcontrollerwhichshouldbeimplementedusingtheLEON2Interruptcontrollermodule(GAISLER_L2IRQ),thetimermodulewhichshouldbeimplementedus-ingtheLEON2Timercontrollermodule(GAISLER_L2TIME)andtheuartwhichshouldbeimplementedusingtheapbuartmodule(GAISLER_APBUART).
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//leon2compati=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,3,1,APB,0x80000010,0x00000030,0);//leon2compati=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,3,1,APB,0x80000068,0x00000008,0);//leon2compati=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,3,1,APB,0x800000a0,0x00000040,0);simcfg.
AddParams(i,simcfg.
params,"");3.
3.
9.
(GAISLER_L2IRQ)LEON2InterruptcontrollerTheLEON2Interruptcontroller(vendorid:VENDOR_GAISLER,deviceid:GAISLER_L2IRQ)simulatesaLEON2singleprocessorinterruptcontroller.
AsforthedefaultLEON2registerlayoutitshouldbeallocatedataddress0x80000090.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//irq:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2IRQ,3,1,APB,0x80000090,0x00000010,0);simcfg.
AddParams(i,simcfg.
params,"");GRSIM-UMJune2017,Version1.
1.
5628www.
cobham.
com/gaisler3.
3.
10.
(GAISLER_L2TIME)LEON2TimerTheLeon2Timermodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_L2TIME)simulatesaLeon2timer.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
//timer:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2TIME,3,1,APB,0x80000040,0x00000028,0);simcfg.
AddParams(i,simcfg.
params,"");3.
3.
11.
(GAISLER_LEON3)LEON3CPUTheLEON3cpumodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_LEON3)simulatesaLEON3pro-cessor.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
Amultiprocessorsystemwith2cpusiscreated.
//leon3:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_LEON3,0,0);simcfg.
AddParams(i,simcfg.
params,"-smpid0");i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_LEON3,0,0);simcfg.
AddParams(i,simcfg.
params,"-smpid1");3.
3.
11.
1.
CommandsCommandsforthismodule:cctrlshowShowsdecodedcachecontrolregister.
3.
3.
12.
(GAISLER_LEON4)LEON4CPUTheLEON4cpumodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_LEON4)simulatesaLEON4pro-cessor.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
Amultiprocessorsystemwith2cpusiscreated.
//leon4:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_LEON4,0,0);simcfg.
AddParams(i,simcfg.
params,"-smpid0");i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_LEON4,0,0);simcfg.
AddParams(i,simcfg.
params,"-smpid1");GRSIM-UMJune2017,Version1.
1.
5629www.
cobham.
com/gaisler3.
3.
12.
1.
CommandsCommandsforthismodule:cctrlshowShowsdecodedcachecontrolregister.
cctrlWriteintocachecontrolregisterofcpu,possiblyflushingcaches.
3.
3.
13.
(GAISLER_PCIFBRG)GRLIBGRPCImaster/targetinterfaceTheGRPCImodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_PCIFBRG)simulatestheGRLIBGR-PCIPCIcontroller.
TheusermodelsalldevicesonthePCIbusthroughausersupplieddynamiclibrary.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_PCIFBRG,9,3,SLAVE,0xa0000000,0x20000000,0,AHBIO,0xfff20000,0x00020000,0,APB,0x80000a00,0x00000100,0);TheGAISLER_PCIDMAmoduleisanoptionalDMAengineaddontotheGAISLER_PCIFBRGmodule.
ItcanonlybeusedincombinationwithGAISLER_PCIFBRG.
Theexamplebelowshowshowtointantiateit.
i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_PCIDMA,0,1,APB,0x80000b00,0x00000100,0);3.
3.
13.
1.
CommandsCommandsforthismodule:grpci_helpShowsinformationaboutGRPCImodulecommands.
grpci_statusShowthestatusoftheGRPCIcore.
grpci_dbg[|clean|list|help]Toggledebugoutputoptions.
Dogrpci_dbghelpforalistofpossibleoptions.
grpci_dbgcleanwilldeac-tivatealldebugoutputandgrpci_dbglistwilllistthecurrentsettings.
grpci_ipLoadaGRPCIinputprovider.
Theparameterispassedtogrpci_inp_setup()oftheinputprovider.
3.
3.
13.
2.
GRPCIUsersupplieddynamiclibraryTheusersupplieddynamiclibraryshouldexposeapublicsymbolgrpciinputsystemoftypestructgrpci_subsystem*.
Thestructgrpci_subsystemisdefinedas:GRSIM-UMJune2017,Version1.
1.
5630www.
cobham.
com/gaislerstructgrpci_subsystem{void(*grpci_inp_setup)(intid,structgrpci_input*l,char**argv,intargc);void(*grpci_inp_restart)(intid,structgrpci_input*l);void(*event)(structgrpci_input*l,void(*cfunc)(),uint32arg,uint64offset);void(*stop_event_arg)(structgrpci_input*l,void(*cfunc)(),intarg);};Atinitializationthecallbackgrpci_inp_setupwillbecalledonce,suppliedwithapointertostructurestructgrpci_input.
Thegrpci_inp_restartcallbackshouldbesetto0.
Theusersupplieddynamiclibraryshouldclaimthegrpci_inputstructurebyusingtheINPUT_CLAIM()macro(seetheexamplebelow).
Thestructgrpci_inputconsistsofcallbacksthatmodelthePCIbus(seethesectionPCIbusmodelAPI).
Atypicalusersupplieddynamiclibrarywouldlooklikethis:intpci_acc(structgrpci_input*ctrl,intcmd,unsignedintaddr,unsignedintwsize,unsignedint*data,unsignedint*abort,unsignedint*ws){.
.
.
BUSaccessimplementation.
.
.
}staticvoidgrpci_inp_setup(intid,structgrpci_input*l,char**argv,intargc){for(i=0;iacc=pci_acc;.
.
.
domodulesetup.
.
.
printf("grpci_inp_setup:Claiming%s\n",l->_b.
name);INPUT_CLAIM(*l);}staticstructgrpci_subsystemgrpci_pci={grpci_inp_setup,0,0};structgrpci_subsystem*grpciinputsystem=&grpci_pci;3.
3.
13.
3.
PCIbusmodelAPIThestructurestructgrpci_inputmodelsthePCIbus.
Itisdefinedas:structgrpci_input{structinput_inp_b;int(*acc)(structgrpci_input*ctrl,intcmd,unsignedintaddr,unsignedint*data,unsignedint*abort,unsignedint*ws);int(*target_acc)(structgrpci_input*ctrl,intcmd,unsignedintaddr,unsignedint*data,unsignedint*mexc);};TheacccallbackshouldbesetbythePCIusermoduleatstartup.
ItiscalledbytheGRPCImodulewheneveritreads/writesasaPCIbusmaster.
cmdCommandtoexecute,seethePCIcommandtablefordetails.
I/OcyclesnotsupportbytheGRPCItarget.
addrPCIaddress.
dataDatabuffer,fillforreadcommands,readforwritecommands.
wsize0:8-bitaccess1:16-bitaccess,2:32-bitaccess,3:64-bitaccess.
64bitisonlyusedtomodelSTDinstruc-tionstotheGRPCIAHBslave.
GRSIM-UMJune2017,Version1.
1.
5631www.
cobham.
com/gaislerwsNumberofPCIclocksitshalltocompletethetransaction.
abortSetto1togeneratetargetabort,0otherwise.
Thereturnvalueofaccdeterminesifthetransactionterminatessuccessfully(1)orwithmasterabort(0).
Thecallbacktarget_accisinstalledbytheGRPCImodule.
ThePCIuserdynamiclibrarycancallthisfunctiontoinitiateanaccesstotheGRPCItarget.
cmdCommandtoexecute,seethePCIcommandtablefordetails.
I/OcyclesnotsupportbytheGRPCItarget.
addrPCIaddress.
dataDatabuffer,returneddataforreadcommands,supplydataforwritecommands.
wsize0:8-bitaccess1:16-bitaccess,2:32-bitaccess.
mexc0ifaccessissuccesful,1incaseoftargetabort.
IftheaddressmatchedMEMBAR0,MEMBAR1orCONFIGtarget_accwillreturn1otherwise0.
3.
3.
14.
(GAISLER_SDCTRL)GRLIBSDRAMControllerTheGRLIBSDRAMController(vendorid:VENDOR_GAISLER,deviceid:GAISLER_SDCTRL)simulatesasdramregionforagivenaddressrange.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
Onebarwithrange0x40000000-0x60000000isdefinedinwhich16mbofsdramareallocated(0-0x1000000).
TheAHBIOentryallocatesthebarentryfortheAMBAahbconfigurationrecordsforthisinstance.
//sdrammemctrl:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_SDCTRL,1,2,SLAVE,0x40000000,//bar10x20000000,//bar11,AHBIO,0xfff00400,//ahbioentry0x00000200,//ahbioentry0);simcfg.
AddParams(i,simcfg.
params,"-sdram16");3.
3.
15.
(GAISLER_SPW)GRSPWSpaceWirecontrollerTheSpaceWiremodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_SPW)simulatestheGRLIBGR-SPWSpaceWirecontroller.
ThesimulationmodeldeliversandreceivespacketsthroughaTCPsocketandcaneitheractasaserverorclientwhichmeansyoucaneasilyconnecttwoGRSIMsimulatorsthroughSpaceWire.
Thelinklayermodelissimplistic.
Settingthelinkdisablebitwillputthecoreinerror-resetstate,otherwissettingthelinkstartorautostartbitwillputthecoreinrunstate.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_SPW,14,1,APB,0x80000a00,0x00000100,GRSIM-UMJune2017,Version1.
1.
5632www.
cobham.
com/gaisler0);simcfg.
AddParams(i,simcfg.
params,"-idx0");3.
3.
15.
1.
CommandsCommandsforthismodule:grspw1X_statusPrintouthestatusofthebufferdescriptorsandtheregistersgrspw1X_connect[ipaddress[:port]]Trytoconnecttothepacketserverataddressipaddressportport.
Ifipaddressisomittedlocalhostisused.
Ifportisomitted,TCPport2225isused.
grspw1X_server[port]Startserverataddressport,ifportisomitted2225isused.
grspw1X_dbg[|clean|list|help]Toggledebugoutputoptions.
Dogrspw1X_dbghelpforalistofpossibleoptions.
grspw1X_dbgcleanwilldeactivatealldebugoutputandgrspw1X_dbglistwilllistthecurrentsettings.
3.
3.
15.
2.
PacketserverEachSpaceWirecorecanbeconfiguredindependentlyasapacketserverorclientusingeithergrspwX_serverorgrspwX_connect.
TCPsocketsareusedforestablishingtheconnections.
Whenactingasaserverthecorecanonlyacceptasingleconnection.
Formoreflexibility,suchascustomrouting,anexternalpacketservercanbeimplementedusingtheprotocolspecifiedbelow.
Threedifferenttypesofpacketsaredefinedaccordingtothetablebelow.
Table3.
1.
PackettypesTypeValueData0Timecode1Modifylinkstate2Notethatallpacketsareprependedbyaonewordlengthfieldwhichspecifiedthelengthofthecomingpacketincludingtheheader.
Datapacketformat:3100x0LENGTH31:0LENGTH,specifieslengthofpacketincludingtheheaderHeader3116158754100x4RESIPID=0TYPE=0RESEEP31:16RES,reservedforfutureuse15:8IPID,IPcoreID,mustequal0forSpaceWire7:5TYPE,packettype,0fordatapackets4:1RES,reservedforfutureuse,mustbesetto00EEP,ErrorEndofPacket.
SetwhenthepacketistruncatedandterminatedbyanEEP.
Payload0x8-SpaceWirepacketFigure3.
2.
SpaceWiredatapacketGRSIM-UMJune2017,Version1.
1.
5633www.
cobham.
com/gaislerTimecodepacketformat:3100x0LENGTH31:0LENGTH,specifieslengthofpacketincludingtheheaderHeader311615875400x4RESIPID=0TYPE=1RES31:16RES,reservedforfutureuse,mustbesetto015:8IPID,IPcoreID,mustequal0forSpaceWire7:5TYPE,packettype,1fortimecodepackets4:0RES,reservedforfutureuse,mustbesetto0Payload31876500x8RESCTCN31:8RES,reservedforfutureuse,mustbesetto07:6CT,timecontrolflags5:0CN,valueoftimecounterFigure3.
3.
SpaceWiretimecodepacketLinkstatepacketformat:3100x0LENGTH31:0LENGTH,specifieslengthofpacketincludingtheheaderHeader31161587543200x4RESIPID=0TYPE=2RESLS31:16RES,reservedforfutureuse,mustbesetto015:8IPID,IPcoreID,mustequal0forSpaceWire7:5TYPE,packettype,2forlinkstatepackets4:3RES,reservedforfutureuse,mustbesetto00Errorreset1Errorwait2Ready3Started4Connecting2:0LS,LinkState:5RunFigure3.
4.
SpaceWirelinkstatepacketGRSIM-UMJune2017,Version1.
1.
5634www.
cobham.
com/gaisler3.
3.
16.
(GAISLER_SPW2)GRSPW2SpaceWirecontrollerTheSpaceWiremodule(vendorid:VENDOR_GAISLER,deviceid:GAISLER_SPW2)simulatestheGRLIBGR-SPW2SpaceWirecontroller.
ThesimulationmodeldeliversandreceivespacketsthroughaTCPsocketandcaneitheractasaserverorclientwhichmeansyoucaneasilyconnecttwoGRSIMsimulatorsthroughSpaceWire.
ThepacketformatisdescribedinSection3.
3.
15.
2.
Thelinklayermodelissimplistic.
Settingthelinkdisablebitwillputthecoreinerror-resetstate,otherwissettingthelinkstartorautostartbitwillputthecoreinrunstate.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_SPW2,14,1,APB,0x80000a00,0x00000100,0);simcfg.
AddParams(i,simcfg.
params,"-idx0");3.
3.
16.
1.
CommandsCommandsforthismodule(replaceXwiththecoresindex,specifiedwith-idx):grspwX_statusPrintouthestatusofthebufferdescriptorsandtheregisters.
grspwX_connect[ipaddress[:port]]Trytoconnecttothepacketserverataddressipaddressportport.
Ifipaddressisomittedlocalhostisused.
Ifportisomitted,TCPport2225isused.
grspwX_server[port]Startserverataddressport,ifportisomitted2225isused.
grspwX_dbg[|clean|list|help]Toggledebugoutputoptions.
DogrspwX_dbghelpforalistofpossibleoptions.
grspwX_dbgcleanwilldeactivatealldebugoutputandgrspwX_dbglistwilllistthecurrentsettings.
3.
3.
17.
(GAISLER_SRCTRL)GRLIBSRAM/PROMControllerTheGRLIBSRAM/PROMController(vendorid:VENDOR_GAISLER,deviceid:GAISLER_SRCTRL)simu-latesapromorsramforagivenaddressrange.
Etheroneregionprom/sramregionor2regions,onepromandonesram,canbespecified.
Theconfigurationmoduleexamplebelowshowshowtoinstantiatethemodule.
Onebarwithrange0-0x10000000isdefinedinwhich2mboframareallocated(0-0x200000).
Thebelowexampledoesn'tallocatesram(-sram0).
//sram/prommemctrl:i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_SRCTRL,1,1,SLAVE,0x00000000,//bar10x10000000,//bar11);//nosram,2mbpromsimcfg.
AddParams(i,simcfg.
params,"-sram0-prom2048");GRSIM-UMJune2017,Version1.
1.
5635www.
cobham.
com/gaisler4.
LibraryGRSIMarealsoavailableasalibrary,allowingthesimulatortobeintegratedinalargersimulationframe-work.
ThevariousGRSIMcommandsandoptionsareaccessiblethroughasimplefunctioninterface.
ThelibraryversionofGRSIMisfullyreentrantandthreadsafe.
4.
1.
FunctioninterfaceThefollowingfunctionsareprovidedtoaccessGRSIMfeatures:void*Grsim_LibCreate(void);Createaninstanceofthelibrary.
Thismustbedonefirst.
Apointertothenewlibraryisreturned.
voidGrsim_LibExit(LibIf_T*lib);Exitthelibraryinacleanway.
voidGrsim_LibInit(LibIf_T*lib,char*str);InitializetheLibrary.
(i.
e.
allocatespacefordatastructures,andinitializethem))ThiscallisNOTthreadsafeandshouldbedoneinacontrolledway.
intGrsim_Cmd(LibIf_T*lib,char*cmd);ExecuteaGRSIMcommand.
AnyvalidGRSIMcommand-linecommandmaybegiven.
Thefollowingreturnvaluesaredefined:SIGINTSimulationstoppedduetointerruptSIGHUPSimulationstoppednormallySIGTRAPSimulationstoppedduetobreakpointhitSIGSEGVSimulationstoppedduetoprocessorinerrormodeSIGTERMSimulationstoppedduetoprogramterminationintGrsim_IncTime(LibIf_T*lib,uint64leap);Incrementsimulatortimewith'leap'ticks.
voidGrsim_GetRegs(LibIf_T*lib,unsignedintregs[]);voidGrsim_SetRegs(LibIf_T*lib,unsignedintregs[]);Get/SetSPARCregisters.
regsisapointertoanarrayofintegers,seesimif.
hforhowthevariousregistersareindexed.
voidGrsim_Read(LibIf_T*lib,uint32addr,uint32*data);voidGrsim_Write(LibIf_T*lib,uint32addr,uint32*data);Performsaread/writefromaddr,returningthevaluein*data.
Onlyfordiagnosticuse.
voidGrsim_GdbIf(LibIf_T*lib,unsignedchar(*inchar)(),void(*outchar)(unsignedcharc));GRSIM-UMJune2017,Version1.
1.
5636www.
cobham.
com/gaislerControlsthesimulatorusingthegdb`extended-remote'protocol.
Theincharparameterisapointertoafunctionthatwhencalled,returnsnextcharacterfromthegdblink.
Theoutcharparameterisapointertoafunctionthatsendsonecharactertothegdblink.
int32Grsim_AddEvent(void*sim,void(*EventHandler)(),uint32arg,SimTime_Toffset);Addaneventtotheeventqueue.
'EventHandler'willbecalled'offset'simulatorticksfromnow.
'arg'ispassedasanargumentto'EventHandler'.
intGrsim_StopEvent(void*sim,void(*EventHandler)())Removesalleventswiththegiven'EventHandler'fromtheeventqueue.
Returnsthenumberofeventsremoved.
intGrsim_StopEventArg(void*sim,void(*EventHandler)(),void*arg)Removesalleventswiththegiven'EventHandler'and'arg'fromtheeventqueue.
Returnsthenumberofeventsremoved.
intGrsim_EventExists(void*sim,void(*EventHandler)(),void*arg)Returns1ifaneventwiththegiven'EventHandler'and'arg'existsintheeventqueue,or0otherwise.
int32Grsim_CreateBus(void*sim);CreateAbusinthesimulator'sim',returnsthebusindex.
SimTime_TGrsim_GetTime(void*sim);Thecurrenttimeinthesimulator'sim'.
voidGrsim_IRQ(structahb_dev_rec*dev,intlevel);Settheinterruptpendingbitforinterruptlevel.
Validvaluesare0-15.
voidGrsim_Stop(LibIf_T*lib)Stopthesimulationnow.
Theeventthatisexecutingwillbefinished,butthenexteventintheeventqueuewillnotbeexecuted.
intGrsim_SetConfigParams(LibIf_T*lib,char*conf[])Addconfigurationparameters.
Thisfunctionistobeusedifthelibraryisstartedwiththe-nosimconfswitch,i.
e.
grsimisstartedwithoutaconfigurationsmodule.
int32Grsim_GetStatistics(void*sim,Grsim_GetStatisticsT*stat)Getstatisticsforbusandcpu.
Grsim_GetStatisticsTisdefinedinsimif.
h.
4.
2.
Multi-threadingThelibraryversionofGRSIMisdesignedtobethreadsafeandreentrant,thusprovidingtheopportunitytorunseveralinstancesofthelibraryinamulti-threadedapplication.
GRSIM-UMJune2017,Version1.
1.
5637www.
cobham.
com/gaisler4.
2.
1.
Limitationstomulti-threadingsupportSincetheHASPlibrariesusedinGRSIMforlicensingarenotthreadsafe,theusermustmakesurethatmultiplecallstoGrsim_LibInitaremadeinanon-concurrentway.
Otherwisetheapplicationmightfailtogetalicense.
4.
3.
UARThandlingBydefault,thelibraryisusingthesameUARThandlingasthestand-alonesimulator.
ThismeansthattheUARTscanbeconnectedtotheconsole,oranyUnixdevice(pseudo-ttys,pipes,fifos).
4.
4.
LinkinganapplicationwiththeGRSIMlibrarySixsampleapplicationareprovided.
app1.
cexemplifiesthebasicusageofthelibraryversionofGRSIM.
app2.
cshowshowtousethelibraryinamulti-threadedenvironment.
app3.
cexemplifiestheuseoftheGDBinterface.
app4.
camultithreadedexamplewhereonethreadisstoppedfromthemainthreadusingtheGrsim_Stopcommand.
app5.
cshowshowtousetheGRSIMlibrarywithoutaconfigurationmodule.
app6.
cdemonstratestheusageoftheinternalgdbserver.
Theyarebuiltbytypingmakeintheexampledirectory.
4.
5.
GRSIMlibrarywithoutasimconfmoduleWhenusingthelibraryversionofGRSIM,itispossibletonotuseasimulatorconfigurationmodulebutconfiguringthesimulatorbycallingthefunctioninterfacedirectly.
However,therearesomerestrictionsinhowthismaybedone,whichisdescribedbelow.
1.
CallGrsim_LibCreate;2.
CallGrsim_PreConfigure;3.
CreateallbusesandattachyourmodulesusingGrsim_CreateBus,Grsim_AddLib,Grsim_AddDriver,Grsim_AddDeviceandGrsim_AddParams.
Provideyourownarrayofstrings(*char[])asthesecondargu-menttoGrsim_AddParams.
4.
CallintGrsim_SetConfigParams(LibIf_T*lib,char*conf[])Here'conf'issupposedtobethearrayofstringsyouusedasthesecondparametertoGrsim_AddParams5.
CallGrsim_LibInitwiththeoption``-nosimconf''Pleaseseetheprovidedapp5.
cforanexample.
GRSIM-UMJune2017,Version1.
1.
5638www.
cobham.
com/gaisler5.
SupportForsupportcontacttheCobhamGaislersupportteamatsupport@gaisler.
com.
GRSIM-UMJune2017,Version1.
1.
5639www.
cobham.
com/gaislerAppendixA.
HASPTableofContentsA.
1.
InstallingHASPDeviceDriver39A.
1.
1.
OnaLinuxplatform39ThisappendixdescribeshowtoinstalltheHASPdrivers.
A.
1.
InstallingHASPDeviceDriverA.
1.
1.
OnaLinuxplatformTheHASPsoftwareforLinuxincludesthefollowing:KernelmodedriversforvariouskernelversionsUtilitiestoquerythedriverversionandtodisplayparallelportsHASPlibraryItiscontainedintheredhat-1.
05-1.
i386.
tar.
gz,suse-1.
5-1.
i386.
tar.
gzorthehaspdriver.
tar.
gzarchiveintheLinuxdirectoryontheGRMONCD.
ThelatestdriversarealsoavailablefromtheAladdinwebsite,http://www.
aladdin.
com.
Fordetailedinformationonthecomponentsrefertothereadmefilesinthearchive.
Note:Alldescribedactionshouldbeexecutedasroot.
A.
1.
1.
1.
EnablingAccesstoUSBKeysInorderforthedaemontoaccessUSBkeys,theso-calledusbdevfsmustbemountedon/proc/bus/usb.
Onnewerdistributionsitismountedautomatically(e.
gSuSe7.
0).
Tomountusbdevfsmanuallyusethefollowingcommand:mount-tusbdevfsnone/proc/bus/usbEnablingAccesstoParallelKeysToenableaccesstoparallelportkeys,thekerneldriveraksparlnxmustbeinstalledbeforestartingaksusbd.
A.
1.
1.
2.
LoadingtheDaemonLoadthedaemonbystartingit:/aksusbdThedaemonwillforkandputitselfintothebackground.
Thestatusmessageisgeneratedinthesystemloginformingyouiftheinstallationhasbeensuccessfulornot.
Itreportsitsversion,theversionoftheAPIusedforUSBandtheversionoftheAPIinsidethekerneldriver(forparallelportkeys).
Ifthekerneldriverhappenstobeunavailablewhenaksusbdislaunched,parallelportkeyscannotbeaccessed,butUSBkeysarestillaccessible.
Thesystemlogreflectsthisstatus.
If/proc/bus/usbisnotmountedwhenlaunchingaksusbd,USBkeyscannotbeaccessed.
Preferablythedaemonshouldbestartedatsystembootuptimewithsomescriptlocatedin/etc/rc.
d/init.
dor/etc/init.
d(dependingonLinuxdistribution).
CommandLineSwitchesforaksusbd(Linux)-vPrintversionnumberasdecimal,formatxx.
xx.
GRSIM-UMJune2017,Version1.
1.
5640www.
cobham.
com/gaisler-lSelecttypeofdiagnosticmessages.
Possiblevaluesare:0-onlyerrors,1-normal(default),2-verbose,3-ultraverbose.
Themessagesareloggedinsyslogwithprioritykern.
info(andkern.
debug).
Referto/etc/syslog.
conftoseewherethemessageswillbeput,usuallyitisthefile/var/log/messages.
-uSpecifiesthepermissionbitsforthesocketspecialfile.
Defaultis666(accessforeveryone).
-hPrintcommandlinehelpGRSIM-UMJune2017,Version1.
1.
5641www.
cobham.
com/gaislerAppendixB.
SamplesimulatorconfigurationHereisasamplesimulatorconfigurationdefiningastandardLeon2setup.
#include#include"simconf.
h"#include"grcommon.
h"#defineVENDOR_TEST17externAmbaUnit_TMyMemCtrl;staticchar*drvparams[22];staticSimConf_Tsimcfg;staticconststructamba_unit*testdrivers[22]={NULL};staticconststructvendor_libtest_lib={.
name="TestVendor",.
vendor=VENDOR_TEST,.
version=1,.
drivers=NULL,.
simdrivers=(AmbaUnit_T**)testdrivers,};staticintConfInit(void){inti,j;intbusid;intresult=0;/*Addanewlibrary*/simcfg.
AddLib((void*)&test_lib);/*Addadrivertothenewlyaddedlibrary*/simcfg.
AddDriver(&MyMemCtrl);/*Createabus*/busid=simcfg.
CreateBus(simcfg.
sim);/*Addsomedevicesonthebus*//*leon2CPU:*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_ESA,ESA_LEON2,0,0);simcfg.
AddParams(i,simcfg.
params,"cpuparams");/*memctrl:*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_ESA,ESA_MCTRL,1,4,SLAVE,0x00000000,0x10000000,1,SLAVE,0x20000000,0x10000000,1,SLAVE,0x40000000,0x30000000,1,APB,0x80000000,0x00000010,GRSIM-UMJune2017,Version1.
1.
5642www.
cobham.
com/gaisler0);simcfg.
AddParams(i,simcfg.
params,"SRAMCtrlparamse.
g-ram2048");/*leon2compat*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,/*internaldevice:leon2compat*/3,1,APB,0x80000010,0x00000030,0);/*leon2compat*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,/*internaldevice:leon2compat*/3,1,APB,0x80000068,0x00000008,0);/*leon2compat*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2C,/*internaldevice:leon2compat*/3,1,APB,0x800000a0,0x00000040,0);simcfg.
AddParams(i,simcfg.
params,"");/*apbmaster*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_APBMST,3,1,SLAVE,0,0,0);simcfg.
AddParams(i,simcfg.
params,"");/*leon2timer*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2TIME,3,1,APB,0x80000040,0x00000028,0);simcfg.
AddParams(i,simcfg.
params,"");/*InterrruptController*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_L2IRQ,3,1,APB,0x80000090,0x00000010,0);simcfg.
AddParams(i,simcfg.
params,"IntCtrl.
.
.
");GRSIM-UMJune2017,Version1.
1.
5643www.
cobham.
com/gaisler/*UART*/i=simcfg.
AddDevice(simcfg.
sim,busid,VENDOR_GAISLER,GAISLER_APBUART,3,1,APB,0x80000070,0x00000020,0);simcfg.
AddParams(i,simcfg.
params,"-fast_uart");returnresult;}staticintConfExit(void){intresult=0;returnresult;}staticintConfCmd(char*cmd,void*arg){intresult=0;returnresult;}staticintConfCtrl(intctl,void*arg){intresult=0;returnresult;}staticSimConf_Tsimcfg={.
sim=NULL,.
AddLib=NULL,.
AddDriver=NULL,.
CreateBus=NULL,.
AddDevice=NULL,.
AddParams=NULL,.
params=drvparams,.
init=ConfInit,.
exit=ConfExit,.
cmd=ConfCmd,.
ctrl=ConfCtrl,};SimConf_T*SimConf=&simcfg;GRSIM-UMJune2017,Version1.
1.
5644www.
cobham.
com/gaislerAppendixC.
SimpleExampleAmbaDeviceTableofContentsC.
1.
MemCtrl.
h44C.
2.
MemCtrl.
c44Herearepresentedasimpleexampleambadevice.
Thisdevice,averysimplememorycontroller,isalsosuppliedassourcecodewiththegrsimdistribution.
C.
1.
MemCtrl.
h#ifndef_MEMCTRL_H#define_MEMCTRL_H#include"grcommon.
h"#defineRAMSIZE0x4000000typedefstruct{unsignedchar*ramb;unsignedintsize;AccRes_Taccres;}MemCtrl_T;#defineDATA(dev)((MemCtrl_T*)((dev)->data))#endif/*_MEMCTRL_H*/C.
2.
MemCtrl.
c#include#include#include"types.
h"#include"simif.
h"#include"MemCtrl.
h"staticint32memctrl_init(structahb_dev_rec*me){printf("Initialisingthememorycontroller.
.
.
\n");DATA(me)=calloc(1,sizeof(MemCtrl_T));DATA(me)->ramb=calloc(1,RAMSIZE);DATA(me)->size=RAMSIZE;return0;}staticint32memctrl_exit(structahb_dev_rec*me){printf("Exitingthememorycontroller.
.
.
\n");/*Freethemalloc:edmemory*/free(((MemCtrl_T*)me->data)->ramb);free(me->data);return0;}int32memctrl_read(structahb_dev_rec*me,structahb_dev_rec*master,uint32address,uint32*data,uint32length,uint32wsize){inti;uint32*mem=(uint32*)((MemCtrl_T*)(me)->data)->ramb;uint32addr=address&(DATA(me)->size-1);GRSIM-UMJune2017,Version1.
1.
5645www.
cobham.
com/gaislerfor(i=0;i>2)+i]);}if(NULL!
=master){(structabh_dev_rec*)DATA(me)->accres.
dev=master;DATA(me)->accres.
mexc=0;Grsim_AmbaReadDone(me,&DATA(me)->accres,(SimTime_T)length);}return0;}int32memctrl_write(structahb_dev_rec*me,structahb_dev_rec*master,uint32address,uint32*data,uint32length,uint32wsize){inti;char*mem=((MemCtrl_T*)(me)->data)->ramb;uint32addr=address&(DATA(me)->size-1);uint32addr2;for(i=0;iaccres.
dev=master;DATA(me)->accres.
mexc=0;Grsim_AmbaWriteDone(me,&DATA(me)->accres,(SimTime_T)length);}return0;}staticint32memctrl_ctrl(intctl,structahb_dev_rec*me,void*arg){switch(ctl){caseGRDRV_INIT:memctrl_init(me);break;caseGRDRV_OPTIONS:printf("MemCtrl:%s\n",(char*)arg);break;caseGRDRV_EXIT:memctrl_exit(me);break;default:break;}return0;}AmbaUnit_TMyMemCtrl=GRSIM-UMJune2017,Version1.
1.
5646www.
cobham.
com/gaisler{.
vendor=17,.
version=1,.
device=13,.
desc="SimpleEXAMPLEMemController",.
read=memctrl_read,.
write=memctrl_write,.
read_done=NULL,.
write_done=NULL,.
cmd=NULL,.
ctrl=memctrl_ctrl,};GRSIM-UMJune2017,Version1.
1.
5647www.
cobham.
com/gaislerAppendixD.
grcommon.
h#ifndef_GRCOMMON_H#define_GRCOMMON_H#ifdefDEBUG/*enumsmakedebuggingeasier*/enum{VENDOR_GAISLER=0x01,VENDOR_PENDER=0x02,VENDOR_ESA=0x04,VENDOR_OPENCORES=0x08,VENDOR_GLEICHMANN=0x10};/*Gaislercores*/enum{GAISLER_LEON2DSU=0x002,GAISLER_LEON3=0x003,GAISLER_LEON3DSU=0x004,GAISLER_ETHAHB=0x005,GAISLER_APBMST=0x006,GAISLER_AHBUART=0x007,GAISLER_SRCTRL=0x008,GAISLER_SDCTRL=0x009,GAISLER_SSRCTRL=0x00A,GAISLER_APBUART=0x00C,GAISLER_IRQMP=0x00D,GAISLER_AHBRAM=0x00E,GAISLER_GPTIMER=0x011,GAISLER_PCITRG=0x012,GAISLER_PCISBRG=0x013,GAISLER_PCIFBRG=0x014,GAISLER_PCITRACE=0x015,GAISLER_PCIDMA=0x016,GAISLER_AHBTRACE=0x017,GAISLER_ETHDSU=0x018,GAISLER_CANAHB=0x019,GAISLER_GRGPIO=0x01A,GAISLER_AHBJTAG=0x01C,GAISLER_ETHMAC=0x01D,GAISLER_SPW=0x01F,GAISLER_SPACEWIRE=0x01f,GAISLER_AHB2AHB=0x020,GAISLER_DDRMP=0x023,GAISLER_NUHOSP3=0x02B,GAISLER_DDR2SP=0x02E,GAISLER_GRTM=0x030,GAISLER_GRTC=0x031,GAISLER_GRPW=0x032,GAISLER_GRCTM=0x033,GAISLER_GRHCAN=0x034,GAISLER_GRFIFO=0x035,GAISLER_GRADCDAC=0x036,GAISLER_GRPULSE=0x037,GAISLER_GRTIMER=0x038,GAISLER_AHB2PP=0x039,GAISLER_GRVERSION=0x03A,GAISLER_LEON4=0x048,GAISLER_L2CACHE=0x04B,GAISLER_FTAHBRAM=0x050,GAISLER_FTSRCTRL=0x051,GAISLER_AHBSTAT=0x052,GAISLER_LEON3FT=0x053,GAISLER_FTMCTRL=0x05F,GAISLER_KBD=0x060,GAISLER_VGA=0x061,GAISLER_LOGAN=0x062,GAISLER_B1553BC=0x070,GAISLER_B1553RT=0x071,GAISLER_B1553BRM=0x072,GRSIM-UMJune2017,Version1.
1.
5648www.
cobham.
com/gaislerGAISLER_LEON2=0xffb,GAISLER_L2IRQ=0xffc,/*internaldevice:leon2irq*/GAISLER_L2TIME=0xffd,/*internaldevice:leon2timer*/GAISLER_L2C=0xffe,/*internaldevice:leon2compat*/GAISLER_PLUGPLAY=0xfff/*internaldevice:plug&playconfigarea*/};/*ESAcores*/enum{ESA_LEON2=0x002,ESA_LEON2APB=0x003,ESA_L2IRQ=0x005,ESA_L2TIMER=0x006,ESA_L2UART=0x007,ESA_L2CFG=0x008,ESA_L2IO=0x009,ESA_MCTRL=0x00F,ESA_PCIARB=0x010,ESA_HURRICANE=0x011,ESA_SPW_RMAP=0x012,ESA_AHBUART=0x013,ESA_SPWA=0x014,ESA_BOSCHCAN=0x015,ESA_L2IRQ2=0x016,ESA_L2STAT=0x017,ESA_L2WPROT=0x018};enum{GLEICHMANN_CUSTOM=0x001,GLEICHMANN_GEOLCD01=0x002,GLEICHMANN_DAC=0x003};enum{GRDRV_IRQ_SETLEVEL=0,GRDRV_IRQ_SETRUNNING=1,GRDRV_IRQ_GETRUNNING=2};enum{GRDRV_NOP=0,GRDRV_APBINIT=1,GRDRV_OPTIONS=2,GRDRV_INIT=3,GRDRV_EXIT=4,GRDRV_REPORT=5,GRDRV_RESTART=6,GRDRV_APBCONFREAD=7,GRDRV_IRQCTRL_ATTACH=8,GRDRV_IRQROUTE_ATTACH=9,GRDRV_GDB_MODE=10,GRDRV_CPU_SETPC=11,GRDRV_CPU_GETPC=12,GRDRV_CPU_ATTACH=13,GRDRV_CPU_DISP_REGS=14,GRDRV_CPU_ADD_WP=15,GRDRV_CPU_DEL_WP=16,GRDRV_CPU_SHOW_WP=17,GRDRV_CPU_ADD_BP=18,GRDRV_CPU_DEL_BP=19,GRDRV_CPU_DEL_BP_GDB=20,GRDRV_CPU_SHOW_BP=21,GRDRV_CPU_STEP=22,GRDRV_CPU_CONT=23,GRDRV_CPU_GET_REGS=24,GRDRV_CPU_SET_REGS=25,GRDRV_CPU_GET_REGS_GDB=26,GRDRV_CPU_SET_REGS_GDB=27,GRDRV_CPU_FLUSH=28,GRDRV_CPU_FLUSH_WIN=29,GRDRV_CPU_GET_STATUS=30,GRDRV_CPU_GDB_SYNC_REGS=31,GRDRV_CPU_CACHE_SNOOP=32,GRDRV_AMBA_READ_DONE=33,GRDRV_AMBA_WRITE_DONE=34,GRSIM-UMJune2017,Version1.
1.
5649www.
cobham.
com/gaislerGRDRV_CPU_READ_SCRATCH=35,GRDRV_CPU_WRITE_SCRATCH=36,GRDRV_CPU_DISAS=37,GRDRV_MCTRL_GET_USEABLE_STACK=38,GRDRV_CPU_GET_SMPID=39,GRDRV_CPU_PRINT_STATUS=40,GRDRV_CPU_TRANSADDR=41,GRDRV_CPU_GETNPC=42,GRDRV_BUS_GET_FREQ=43,GRDRV_RESTART_CPU=44,GRDRV_CPU_GET_SREGS=45,GRDRV_CPU_REPORT_CACHE=46,GRDRV_PREINIT=47,GRDRV_SYSREG=48,GRDRV_PREINIT2=49,GRDRV_PRELOAD=50};#else/*Vendorcodes*/#defineVENDOR_GAISLER0x01#defineVENDOR_PENDER0x02#defineVENDOR_ESA0x04#defineVENDOR_OPENCORES0x08#defineVENDOR_GLEICHMANN0x10/*Gaislercores*/#defineGAISLER_LEON2DSU0x002#defineGAISLER_LEON30x003#defineGAISLER_LEON3DSU0x004#defineGAISLER_ETHAHB0x005#defineGAISLER_APBMST0x006#defineGAISLER_AHBUART0x007#defineGAISLER_SRCTRL0x008#defineGAISLER_SDCTRL0x009#defineGAISLER_SSRCTRL0x00A#defineGAISLER_APBUART0x00C#defineGAISLER_IRQMP0x00D#defineGAISLER_AHBRAM0x00E#defineGAISLER_GPTIMER0x011#defineGAISLER_PCITRG0x012#defineGAISLER_PCISBRG0x013#defineGAISLER_PCIFBRG0x014#defineGAISLER_PCITRACE0x015#defineGAISLER_PCIDMA0x016#defineGAISLER_AHBTRACE0x017#defineGAISLER_ETHDSU0x018#defineGAISLER_CANAHB0x019#defineGAISLER_GRGPIO0x01A#defineGAISLER_AHBJTAG0x01C#defineGAISLER_ETHMAC0x01D#defineGAISLER_SPW0x01F#defineGAISLER_SPACEWIRE0x01f#defineGAISLER_AHB2AHB0x020#defineGAISLER_DDRMP0x023#defineGAISLER_NUHOSP30x02b#defineGAISLER_DDR2SP0x02E#defineGAISLER_GRTM0x030#defineGAISLER_GRTC0x031#defineGAISLER_GRPW0x032#defineGAISLER_GRCTM0x033#defineGAISLER_GRHCAN0x034#defineGAISLER_GRFIFO0x035#defineGAISLER_GRADCDAC0x036#defineGAISLER_GRPULSE0x037#defineGAISLER_GRTIMER0x038#defineGAISLER_AHB2PP0x039#defineGAISLER_GRVERSION0x03A#defineGAISLER_LEON40x048#defineGAISLER_L2CACHE0x04B#defineGAISLER_FTAHBRAM0x050#defineGAISLER_FTSRCTRL0x051#defineGAISLER_AHBSTAT0x052#defineGAISLER_LEON3FT0x053#defineGAISLER_FTMCTRL0x05F#defineGAISLER_KBD0x060#defineGAISLER_VGA0x061#defineGAISLER_LOGAN0x062GRSIM-UMJune2017,Version1.
1.
5650www.
cobham.
com/gaisler#defineGAISLER_B1553BC0x070#defineGAISLER_B1553RT0x071#defineGAISLER_B1553BRM0x072#defineGAISLER_LEON20xffb#defineGAISLER_L2IRQ0xffc/*internaldevice:leon2interruptcontroller*/#defineGAISLER_L2TIME0xffd/*internaldevice:leon2timer*/#defineGAISLER_L2C0xffe/*internaldevice:leon2compat*/#defineGAISLER_PLUGPLAY0xfff/*internaldevice:plug&playconfigarea*//*ESAcores*/#defineESA_LEON20x002#defineESA_LEON2APB0x003#defineESA_L2IRQ0x005#defineESA_L2TIMER0x006#defineESA_L2UART0x007#defineESA_L2CFG0x008#defineESA_L2IO0x009#defineESA_MCTRL0x00F#defineESA_PCIARB0x010#defineESA_HURRICANE0x011#defineESA_SPW_RMAP0x012#defineESA_AHBUART0x013#defineESA_SPWA0x014#defineESA_BOSCHCAN0x015#defineESA_L2IRQ20x016#defineESA_L2STAT0x017#defineESA_L2WPROT0x018/*GLEICHMANNcores*/#defineGLEICHMANN_CUSTOM0x001#defineGLEICHMANN_GEOLCD010x002#defineGLEICHMANN_DAC0x003/*irqcpucmds*/#defineGRDRV_IRQ_SETLEVEL0#defineGRDRV_IRQ_SETRUNNING1#defineGRDRV_IRQ_GETRUNNING2/*drivercommands*/#defineGRDRV_NOP0#defineGRDRV_APBINIT1#defineGRDRV_OPTIONS2#defineGRDRV_INIT3#defineGRDRV_EXIT4#defineGRDRV_REPORT5#defineGRDRV_RESTART6#defineGRDRV_APBCONFREAD7#defineGRDRV_IRQCTRL_ATTACH8#defineGRDRV_IRQROUTE_ATTACH9#defineGRDRV_GDB_MODE10#defineGRDRV_CPU_SETPC11#defineGRDRV_CPU_GETPC12#defineGRDRV_CPU_ATTACH13#defineGRDRV_CPU_DISP_REGS14#defineGRDRV_CPU_ADD_WP15#defineGRDRV_CPU_DEL_WP16#defineGRDRV_CPU_SHOW_WP17#defineGRDRV_CPU_ADD_BP18#defineGRDRV_CPU_DEL_BP19#defineGRDRV_CPU_DEL_BP_GDB20#defineGRDRV_CPU_SHOW_BP21#defineGRDRV_CPU_STEP22#defineGRDRV_CPU_CONT23#defineGRDRV_CPU_GET_REGS24#defineGRDRV_CPU_SET_REGS25#defineGRDRV_CPU_GET_REGS_GDB26#defineGRDRV_CPU_SET_REGS_GDB27#defineGRDRV_CPU_FLUSH28#defineGRDRV_CPU_FLUSH_WIN29#defineGRDRV_CPU_GET_STATUS30#defineGRDRV_CPU_GDB_SYNC_REGS31#defineGRDRV_CPU_CACHE_SNOOP32#defineGRDRV_AMBA_READ_DONE33#defineGRDRV_AMBA_WRITE_DONE34#defineGRDRV_CPU_READ_SCRATCH35#defineGRDRV_CPU_WRITE_SCRATCH36#defineGRDRV_CPU_DISAS37#defineGRDRV_MCTRL_GET_USEABLE_STACK38#defineGRDRV_CPU_GET_SMPID39#defineGRDRV_CPU_PRINT_STATUS40#defineGRDRV_CPU_TRANSADDR41GRSIM-UMJune2017,Version1.
1.
5651www.
cobham.
com/gaisler#defineGRDRV_CPU_GETNPC42#defineGRDRV_BUS_GET_FREQ43#defineGRDRV_RESTART_CPU44#defineGRDRV_CPU_GET_SREGS45#defineGRDRV_CPU_REPORT_CACHE46#defineGRDRV_PREINIT47#defineGRDRV_SYSREG48#defineGRDRV_PREINIT249#defineGRDRV_PRELOAD50#endif/*DEBUG*/#ifndef__ASSEMBLER__/*AMBAconfigurationID*/#defineVENID(x)(((x)>>24)&0x0ff)#defineDEVID(x)(((x)>>12)&0x0fff)#defineCFGVER(x)(((x)>>10)&0x03)#defineVERID(x)(((x)>>5)&0x01f)#defineIRQNUM(x)(((x)>>0)&0x1f)/*UsedasmasterfordiagnosticaccessesontheAMBAbus*/#defineDIAGNULLstructahb_cfg_rec{intdevid;intcustom_cfg[3];intbar[4];};structahb_cfg_area{structahb_cfg_recmaster[64];structahb_cfg_recslave[64];};structapb_cfg_rec{intdevid;intbar;};structapb_cfg_area{structapb_cfg_recslave[64];};structahb_mem_rec{unsignedintstart;unsignedintend;unsignedinttype;};structahb_dev_rec;structgrdriver{shortvendor;shortversion;shortdevice;chardesc[32];int(*ctrl)(int,structahb_dev_rec*);int(*cmd)(char*,structahb_dev_rec*);};typedefstructacc_res{structahb_dev_rec*dev;intmexc;}AccRes_T;typedefint(*IrqFn_T)(structahb_dev_rec*dev,intcmd,intarg);typedefstruct{structahb_dev_rec*dev;IrqFn_Tfn;}IrqRouteEntry_T;GRSIM-UMJune2017,Version1.
1.
5652www.
cobham.
com/gaislertypedefstructamba_unit{/*identificationdata*/shortvendor;shortversion;shortdevice;chardesc[32];/*functions*/int(*read)(structahb_dev_rec*me,structahb_dev_rec*master,unsignedintaddress,unsignedint*data,unsignedintlength,unsignedintwsize);int(*write)(structahb_dev_rec*me,structahb_dev_rec*master,unsignedintaddress,unsignedint*data,unsignedintlength,unsignedintwsize);int(*read_done)(AccRes_T*result);int(*write_done)(AccRes_T*result);int(*ctrl)(intctl,structahb_dev_rec*me,void*args);int(*cmd)(char*cmd,structahb_dev_rec*me);}AmbaUnit_T;structahb_dev_rec{structahb_mem_recmem[4];structahb_mem_recapb;structgrdriver*drv;structamba_unit*simdrv;void*data;unsignedintdevid;unsignedcharirq;unsignedcharvendor;unsignedshortdevice;unsignedshortversion;unsignedchartype;unsignedcharindex;//accesswithtimingaccumulatedunsignedcharacc_access;unsignedintacc_ws;unsignedintbus;unsignedintcustom_cfg[3];/*Entriesonlyusedinsimulator*/void*sim;unsignedintbusid;};structbus_dev_rec{structahb_dev_recdev[128];intndevs;intioarea[4];intcfgarea;intnbus;};structvendor_lib{charname[64];intvendor;intversion;structgrdriver**drivers;structamba_unit**simdrivers;};typedefstructaddr_data{unsignedintaddr;unsignedint*data;}AddrData_T;enumregnames{G0,G1,G2,G3,G4,G5,G6,G7,O0,O1,O2,O3,O4,O5,SP,O7,L0,L1,L2,L3,L4,L5,L6,L7,I0,I1,I2,I3,I4,I5,FP,I7,F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,F23,GRSIM-UMJune2017,Version1.
1.
5653www.
cobham.
com/gaislerF24,F25,F26,F27,F28,F29,F30,F31,Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR};externvoidGetRegisters(void*lib,unsignedintregs[]);structmbus_rec{intfound;unsignedintcfgarea;floatffact;};#endif/*__ASSEMBLER__*/#endif/*_GRCOMMON_H*/GRSIM-UMJune2017,Version1.
1.
5654www.
cobham.
com/gaislerCobhamGaislerABKungsgatan1241119GothenburgSwedenwww.
cobham.
com/gaislersales@gaisler.
comT:+46317758650F:+4631421407CobhamGaislerAB,reservestherighttomakechangestoanyproductsandservicesdescribedhereinatanytimewithoutnotice.
ConsultCobhamoranauthorizedsalesrepresentativetoverifythattheinformationinthisdocumentiscurrentbeforeusingthisproduct.
Cobhamdoesnotassumeanyresponsibilityorliabilityarisingoutoftheapplicationoruseofanyproductorservicedescribedherein,exceptasexpresslyagreedtoinwritingbyCobham;nordoesthepurchase,lease,oruseofaproductorservicefromCobhamconveyalicenseunderanypatentrights,copyrights,trademarkrights,oranyotheroftheintellectualrightsofCobhamorofthirdparties.
Allinformationisprovidedasis.
Thereisnowarrantythatitiscorrectorsuitableforanypurpose,neitherimplicitnorexplicit.
Copyright2015CobhamGaislerAB

妮妮云(100元/月)阿里云香港BGP专线 2核 4G

妮妮云的来历妮妮云是 789 陈总 张总 三方共同投资建立的网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑妮妮云的市场定位妮妮云主要代理市场稳定速度的云服务器产品,避免新手购买云服务器的时候众多商家不知道如何选择,妮妮云就帮你选择好了产品,无需承担购买风险,不用担心出现被跑路 被诈骗的情况。妮妮云的售后保证妮妮云退款 通过于合作商的友好协商,云服务器提供2天内全额退款,超过2天不退款 物...

pacificrack:2021年七夕VPS特别促销,$13.14/年,2G内存/2核/60gSSD/1T流量,支持Windows

pacificrack官方在搞2021年七夕促销,两款便宜vps给的配置都是挺不错的,依旧是接入1Gbps带宽,KVM虚拟、纯SSD raid10阵列,支持包括Linux、Windows 7、10、server2003、2008、2012、2016、2019在内多种操作系统。本次促销的VPS请特别注意限制条件,见本文末尾!官方网站:https://pacificrack.com支持PayPal、支...

HoRain Cloud:国内特价物理机服务器,镇江机房,内地5线BGP接入,月付499元起

horain怎么样?horain cloud是一家2019年成立的国人主机商家,隶属于北京辰帆科技有限公司,horain持有增值电信业务经营许可证(B1-20203595),与中国电信天翼云、腾讯云、华为云、UCloud、AWS等签署渠道合作协议,主要提企业和个人提供云服务器,目前商家推出了几款特价物理机,都是在内地,性价比不错,其中有目前性能比较强悍的AMD+NVMe系列。点击进入:horain...

iproute为你推荐
3.2网易yeah支持ipadsqlserver数据库电脑如何找到sql server数据库支付宝调整还款日蚂蚁借呗还款日能改吗my.qq.commy.qq.com,QQ用户上不去?特朗普吐槽iPhone华为余承东吐槽iPhone X,除了贵啥优点都没有360公司迁至天津天津360公司?360开户哪家好?360开户费多少?360推广怎么样?360效果怎么样?360和百度相比哪个更合适?flashftp下载《蔓蔓青萝(全)》.TXT_微盘下载我要购买|我要查询|我要开户计算机cuteftp
电信服务器租赁 域名服务器的作用 工信部域名备案 域名备案网站 stablehost 59.99美元 kddi 鲜果阅读 架设服务器 老左正传 香港亚马逊 环聊 登陆空间 smtp服务器地址 国外在线代理服务器 lamp什么意思 如何登陆阿里云邮箱 葫芦机 apache启动失败 卡巴斯基免费版 更多