首页 > > > Programming languages - C - Extensions to suppo…

Programming languages - C - Extensions to support embedded processors.pdf

Programming languages - C - Ext…

上传者: 老赞 2011-10-30 评分1 评论0 下载29 收藏10 阅读量316 暂无简介 简介 举报

简介:本文档为《Programming languages - C - Extensions to support embedded processorspdf》,可适用于专题技术领域,主题内容包含ISOIECJTCSCWGNDate:Referencenumberofdocument:ISOIECTRCommitteeidentificati符等。

ISOIECJTCSCWGNDate:Referencenumberofdocument:ISOIECTRCommitteeidentification:ISOIECJTCSCWGSCSecretariat:ANSIInformationTechnologyProgramminglanguagesCExtensionstosupportembeddedprocessorsWarningThisdocumentisanISOIECdraftTechnicalReportItisnotanISOIECInternationalTechnicalReportItisdistributedforreviewandcommentItissubjecttochangewithoutnoticeandshallnotbereferredtoasanInternationalTechnicalReportorInternationalStandardRecipientsofthisdraftareinvitedtosubmit,withtheircomments,notificationofanyrelevantpatentrightsofwhichtheyareawareandtoprovidesupportingdocumentationDocumenttype:TechnicalReportTypeDocumentsubtype:naDocumentstage:()ApprovalDocumentlanguage:ECopyrightnoticeThisISOdocumentisaworkingdraftorcommitteedraftandiscopyrightprotectedbyISORequestsforpermissiontoreproducethisdocumentforthepurposeofsellingitshouldbeaddressedasshownbelowortoISO’smemberbodyinthecountryoftherequester:ISOcopyrightofficeCasepostaleCHGenevaTelFaxEmailcopyrightisoorgWebwwwisoorgReproductionforsalespurposesmaybesubjecttoroyaltypaymentsoralicensingagreementViolatorsmaybeprosecutedContentsPageScopeReferencesConformanceFixedpointarithmeticOverviewandprinciplesofthefixedpointdatatypesThedatatypesSpellingofthenewkeywordsRoundingandOverflowTypeconversion,usualarithmeticconversionsFixedpointconstantsOperationsinvolvingfixedpointtypesFixedpointfunctionsFixedpointdefinitions<stdfixh>FormattedIOfunctionsforfixedpointargumentsDetailedchangestoISOIEC:NamedaddressspacesandnamedregisterstorageclassesOverviewandprinciplesofnamedaddressspacesAdditionaladdressspacesAddressspacetypequalifiersAddressspacenestingandrulesforpointersStandardlibrarysupportOverviewandprinciplesofnamedregisterstorageclassesAccesstomachineregistersNamedregisterstorageclassspecifiersEnsuringcorrectsideeffectsviaobjectsallocatedinregistersRelationshipbetweennamedregistersandIOregisterdesignatorsDetailedchangestoISOIEC:BasicIOhardwareaddressingRationaleBasicStandardizationObjectivesTerminologyBasicIOHardwareaddressingheader<iohwh>StandardizationprinciplesTheabstractmodelSpecifyingIOregistersIOregisterdesignatorsAccessestoindividualIOregistersIOregisterbuffersIOgroupsDirectandindirectdesignatorsOperationsonIOgroupsDetailedchangestoISOIEC:AnnexAFixedpointarithmeticAFixedpointdatatypesAIntroductionANumberofdatabitsinFractversusAccumAPossibleDataTypeImplementationsARoundingandOverflowATypeconversions,usualarithmeticconversionsAOperationsinvolvingfixedpointtypesAExceptionforand–MultiplicationResultsALinguisticVariablesandunsignedFract:anexampleofunsignedfixedpointAnnexBNamedaddressspacesandnamedregisterstorageclassesBEmbeddedsystemsextendedmemorysupportBModifiersfornamedaddressspacesBApplicationdefinedmultipleaddressspacesupportBIOregisterdefinitionforintrinsicoruserdefinedaddressspacesAnnexCImplementingthe<iohwh>headerCGeneralCRecommendedstepsCCompilerconsiderationsCOverviewofIOHardwareConnectionOptionsCMultiAddressingandIORegisterEndiannessCAddressInterleavingCIOConnectionOverview:CGenericbufferindexCIOregisterdesignatorsfordifferentIOaddressingmethodsCAtomicoperationCReadmodifywriteoperationsandmultiaddressingcasesCIOinitializationCIntrinsicFeaturesforIOHardwareAccessAnnexDMigrationpathfor<iohwh>implementationsDMigrationpathfor<iohwh>implementationsD<iohwh>implementationbasedonCmacrosDTheaccessspecificationmethodDAn<iohwh>implementationtechniqueDFeaturesDThe<iohwh>headerDTheuser’sIOregisterdesignatordefinitionsDThedriverfunctionAnnexEFunctionalitynotincludedinthisTechnicalReportECircularbuffersEComplexdatatypesEConsiderationofBCDdatatypesforEmbeddedSystemsEModwrapoverflowAnnexFCCompatibilityandMigrationissuesFFixedpointArithmeticFMultipleAddressSpacesSupportFBasicIOHardwareAddressingAnnexG–UpdatesandChangesintheSecondEditionofTRForewordISO(theInternationalOrganizationforStandardization)andIEC(theInternationalElectrotechnicalCommission)formthespecializedsystemforworldwidestandardizationNationalbodiesthataremembersofISOorIECparticipateinthedevelopmentofInternationalStandardsthroughtechnicalcommitteesestablishedbytherespectiveorganizationtodealwithparticularfieldsoftechnicalactivityISOandIECtechnicalcommitteescollaborateinfieldsofmutualinterestOtherinternationalorganizations,governmentalandnongovernmental,inliaisonwithISOandIEC,alsotakepartintheworkTechnicalReportsaredraftedinaccordancewiththerulesgivenintheISOIECDirectives,Part Inthefieldofinformationtechnology,ISOandIEChaveestablishedajointtechnicalcommittee,ISOIEC JTC DraftTechnicalReportsadoptedbythejointtechnicalcommitteearecirculatedtonationalbodiesforvotingPublicationasaTechnicalReportrequiresapprovalbyatleastofthememberbodiescastingavoteThemaintaskoftechnicalcommitteesistoprepareInternationalStandards,butinexceptionalcircumstancesatechnicalcommitteemayproposethepublicationofaTechnicalReportofoneofthefollowingtypes:type,whentherequiredsupportcannotbeobtainedforthepublicationofanInternationalStandard,despiterepeatedeffortstype,whenthesubjectisstillundertechnicaldevelopmentorwhereforanyotherreasonthereisthefuturebutnotimmediatepossibilityofanagreementonanInternationalStandardtype,whenatechnicalcommitteehascollecteddataofadifferentkindfromthatwhichisnormallypublishedasanInternationalStandard("stateoftheart",forexample)TechnicalReportsoftypesandaresubjecttoreviewwithinthreeyearsofpublication,todecidewhethertheycanbetransformedintoInternationalStandardsTechnicalReportsoftypedonotnecessarilyhavetoberevieweduntilthedatatheyprovideareconsideredtobenolongervalidorusefulISOIECTR,whichisaTechnicalReportoftype,waspreparedbyJointTechnicalCommitteeISOIEC JTC ,Informationtechnology,SubcommitteeSC,Programminglanguages,theirenvironments,andsystemsoftwareinterfacesEDITOR’SNOTEFORTHESCREVIEWVERSIONThefunctionaldifferencesbetweenthefirsteditionofTRandthisversionaredetailedinAnnexGDuetothedifferentfontsusedandthedetailedlayout,inafulldiffbarreddocumentthesedifferencesareblurredIfhoweversuchaversionisnecessaryforaproperreview,pleasecontacttheprojecteditorMrWillemWakker(willemwacenl)IntroductionInthefastgrowingmarketofembeddedsystemsthereisanincreasingneedtowriteapplicationprogramsinahighlevellanguagesuchasCBasicallytherearetworeasonsforthistrend:programsforembeddedsystemsbecomemorecomplex(andhencearedifficulttomaintaininassemblylanguage),andprocessormodelsforembeddedsystemshaveadecreasinglifespan(whichimpliesmorefrequentreadaptingofapplicationstonewinstructionsets)ThecodereusabilityachievedbyClevelprogrammingisconsideredtobeamajorstepforwardinaddressingtheseissuesVarioustechnicalareashavebeenidentifiedwherefunctionalityofferedbyprocessors(suchasDSPs)thatareusedinembeddedsystemscannoteasilybeexploitedbyapplicationswritteninCExamplesarefixedpointoperations,usageofdifferentmemoryspaces,lowlevelIOoperationsandothersThecurrentproposaladdressesonlyafewofthesetechnicalareasEmbeddedprocessorsareoftenusedtoanalyzeanaloguesignalsandprocessthesesignalsbyapplyingfilteringalgorithmstothedatareceivedTypicalapplicationscanbefoundinallwirelessdevicesThecommondatatypeusedinfilteringalgorithmsisthefixedpointdatatype,andinordertoachievethenecessaryspeed,embeddedprocessorsareoftenequippedwithspecialhardwareforfixedpointdataTheClanguage(asdefinedinISOIEC:)doesnotprovidesupportforfixedpointarithmeticoperations,currentlyleavingprogrammerswithnooptionbuttohandcraftmostoftheiralgorithmsinassemblylanguageThisTechnicalReportspecifiesafixedpointdatatypeforC,definableinarangeofprecisionandsaturationoptionsOptimizingCcompilerscangeneratehighlyefficientcodeforfixedpointdataaseasilyasforintegerandfloatingpointdataManyembeddedprocessorshavemultipledistinctbanksofmemoryandrequirethatdatabegroupedindifferentbankstoachievemaximumperformanceEnsuringthesimultaneousflowofdataandcoefficientdatatothemultiplieraccumulatorofprocessorsdesignedforFIRfiltering,forexample,iscriticaltotheiroperationInordertoallowtheprogrammertodeclarethememoryspacefromwhichaspecificdataobjectmustbefetched,thisTechnicalReportspecifiesbasicsupportformultipleaddressspacesAsaresult,optimizingcompilerscanutilizetheabilityofprocessorsthatsupportmultipleaddressspaces,forinstance,toreaddatafromtwoseparatememoriesinasinglecycletomaximizeexecutionspeedAstheClanguagehasmaturedovertheyears,variousextensionsforaccessingbasicIOhardware(iohw)registershavebeenaddedtoaddressdeficienciesinthelanguageTodayalmostallCcompilersforfreestandingenvironmentsandembeddedsystemssupportsomemethodofdirectaccesstoiohwregistersfromtheCsourcelevelHowever,theseextensionshavenotbeenconsistentacrossdialectsThisTechnicalReportprovidesanapproachtocodifyingcommonpracticeandprovidingasingleuniformsyntaxforbasiciohwregisteraddressingThefirsteditionofthisTechnicalReportwaspublishedasISOIECTR:thissecondeditionincludesanumberofcorrectionsandupdates,basedonimplementationexperiencesThemostimportantchangesaredescribedinAnnexGInformationTechnologyProgramminglanguagesCExtensionstosupportembeddedprocessorsScopeThisTechnicalReportspecifiesaseriesofextensionsoftheprogramminglanguage C,specifiedbytheinternationalstandardISOIEC :EachclauseinthisTechnicalReportdealswithaspecifictopicThefirstsubclausesofclauses ,andcontainatechnicaldescriptionofthefeaturesofthetopicThesesubclausesprovideanoverviewbutdonotcontainallthefinedetailsThelastsubclauseofeachclausecontainstheeditorialchangestothestandardnecessarytofullyspecifythetopicinthestandard,andtherebyprovidesacompletedefinitionAdditionalexplanationandrationaleareprovidedintheAnnexesReferencesThefollowingreferenceddocumentsareindispensablefortheapplicationofthisdocumentFordatedreferences,onlytheeditioncitedappliesForundatedreferences,thelatesteditionofthereferenceddocument(includinganyamendments)appliesISOIEC:–ProgramminglanguagesCConformanceThisTechnicalReportpresentsinthreeseparateclausesspecificationsforthree,inprincipleindependent,setsoffunctionality(clause :fixedpointarithmetic,clause :namedaddressspacesandnamedregisterstorageclasses,andclause :basicIOhardwareaddressing)AsthisisaTechnicalReporttherearenoconformancerequirementsandimplementersarefreetoselectthosespecificationsthattheyneedHowever,iffunctionalityisimplementedfromoneoftheclauses,implementersarestronglyencouragedtoimplementthatclauseinfull,andnotjustapartofitIf,atalaterstage,adecisionistakentoincorporatesomeorallofthetextofthisTechnicalReportintotheC standard,thenatthatmomenttheconformanceissueswithrespectto(partsof)thistextneedtobeaddressed(conformancewithrespecttofreestandingimplementationsetc)FixedpointarithmeticOverviewandprinciplesofthefixedpointdatatypesThedatatypesForthepurposeofthisTechnicalReport,fixedpointdatavaluesareeitherfractionaldatavalues(withvaluebetweenand),ordatavalueswithanintegralpartandafractionalpartAsthepositionoftheradixpointisknownimplicitly,operationsonthevaluesofthesedatatypescanbeimplementedwith(almost)thesameefficiencyasoperationsonintegralvaluesTypicalusageoffixedpointdatavaluesandoperationscanbefoundinapplicationsthatconvertanaloguevaluestodigitalrepresentationsandsubsequentlyapplysomefilteringalgorithmFormoreinformationoffixedpointdatatypes,seeclauseAintheAnnexofthisTechnicalReportForthepurposeofthisTechnicalReport,twogroupsoffixedpointdatatypesareaddedtotheC language:thefracttypesandtheaccumtypesThedatavalueofafracttypehasnointegralpart,hencevaluesofafracttypearebetweenandThevaluerangeofanaccumtypedependsonthenumberofintegralbitsinthedatatypeThefixedpointdatatypesaredesignatedwiththecorrespondingnewkeywordsandtypespecifiersFractandAccumThesetypespecifierscanbeusedincombinationwiththeexistingtypespecifiersshort,long,signedandunsignedtodesignatethefollowingtwelvefixedpointtypes:unsignedshortFractunsignedshortAccumunsignedFractunsignedAccumunsignedlongFractunsignedlongAccumsignedshortFractsignedshortAccumsignedFractsignedAccumsignedlongFractsignedlongAccumThesetwelvetypesarecollectivelycalledtheprimaryfixedpointtypesThefixedpointdatatypesshortFractshortAccumFractAccumlongFractlongAccumwithouteitherunsignedorsignedarealiasesforthecorrespondingsignedfixedpointtypesForeachprimaryfixedpointtypethereisacorresponding(butdifferent)saturatingfixedpointtype,designatedwiththetypespecifierSatTheprimaryfixedpointtypesandthesaturatingfixedpointtypesarecollectivelycalledthefixedpointtypesAnimplementationisrequiredtosupportallabovementionedtwentyfourfixedpointdatatypesJustasforintegertypes,thereisnorequirementthatthetypesallhavedifferentformatsThefixedpointtypesareassignedafixedpointrankThefollowingtypesarelistedinorderofincreasingrank:shortFract,Fract,longFract,shortAccum,Accum,longAccumEachunsignedfixedpointtypehasthesamesize(inbytes)andthesamerankasitscorrespondingsignedfixedpointtypeEachsaturatingfixedpointtypehasthesamerepresentationandthesamerankasitscorrespondingprimaryfixedpointtypeThebitsofanunsignedfixedpointtypearedividedintopaddingbits,fractionalbits,andintegralbitsThebitsofasignedfixedpointtypearedividedintopaddingbits,fractionalbits,integralbits,andasignbitThefractfixedpointtypeshavenointegralbitsconsequently,valuesofunsignedfracttypesareintherangeofto,andvaluesofsignedfracttypesareintherangeoftoTheminimalformatsforeachtypeare:signedshortFractssignedshortAccumssignedFractssignedAccumssignedlongFractssignedlongAccumsunsignedshortFractunsignedshortAccumunsignedFractunsignedAccumunsignedlongFractunsignedlongAccumsignedshortFractssignedshortAccumssignedFractssignedAccumssignedlongFractssignedlongAccumsunsignedshortFractunsignedshortAccumunsignedFractunsignedAccumunsignedlongFractunsignedlongAccum(Fortheunsignedformats,thenotation"xy"meansxintegralbitsandyfractionalbits,foratotalofx  ynonpaddingbitsTheadded"s"inthesignedformatsdenotesthesignbit)Animplementationmaygiveanyofthefixedpointtypesmorefractionalbits,andmayalsogiveanyoftheaccumtypesmoreintegralbitstherelevantrestrictionsaregiveninthetextforthenewclause (seeclauseofthisTechnicalReport)ForanexampleofunsignedfixedpointdatatypesseeASpellingofthenewkeywordsThenaturalspellingofthenewlyintroducedkeywordsFract,AccumandSat,isfract,accumandsatHowever,inordertoavoidnameclashesinexistingprogramsthenewkeywordsarehandledinthesamewayastheComplexkeywordintheISOIEC :standard:theformalnamesofthenewkeywordsstartwithanunderscore,followedbyacapitalletter,andintheforfixedpointarithmeticrequiredheader<stdfixh>,theseformalnamesareusedtodefinethenaturalspellingsasaliases,andmaybeusedtodefineotherspellings,forinstance,inanenvironmentwithpreexistingfixedpointsupportInthecodefragmentsinthisTechnicalReport,thenaturalspellingwillbeusedForinformationontheusageofthenewkeywordsinacombinedCCenvironment,seeAnnexFRoundingandOverflowConversionofarealnumericvaluetoafixedpointtypemayrequireroundingandormayoverflowIfthesourcevaluecannotberepresentedexactlybythefixedpointtype,thesourcevalueisroundedtoeithertheclosestfixedpointvaluegreaterthanthesourcevalue(roundedup)ortotheclosestfixedpointvaluelessthanthesourcevalue(roundeddown)Whenthesourcevaluedoesnotfitwithintherangeofthefixedpointtype,theconversionoverflowsOfthetwocommonapproachesforfixedpointoverflowhandling(saturationandmodularwraparound)onlysaturationisrequiredbythisTechnicalReportforadescriptionofmodularwraparound,seeAnnexEWhencalculatingthesaturatedresultonfixedpointoverflow,thesourcevalueisreplacedbytheclosestavailablefixedpointvalue(Forunsignedfixedpointtypes,thiswillbeeitherzeroorthemaximalpositivevalueofthefixedpointtypeForsignedfixedpointtypesitwillbethemaximalnegativeormaximalpositivevalueofthefixedpointtype)Overflowbehavioriscontrolledintwoways:Byusingexplicitsaturatingfixedpointtypes(eg,Sat Fract)Intheabsenceofanexplicitsaturatingfixedpointtype,overflowbehavioriscontrolledbytheFXFRACTOVERFLOWandFXACCUMOVERFLOWpragmaswithSATandDEFAULTaspossiblestatesWhenthestateoftheFXFRACTOVERFLOWpragmaisSAT,theoverfl

精彩专题

热门资料

20041201tft-lcd_TFT-LCD 產业的介绍.pdf

SAX解析陷阱.docx

Geodatabase.pdf

Linux命令文档,这一本就行了.pdf

该用户的其他资料

  • 名称/格式
  • 评分
  • 下载次数
  • 资料大小
  • 上传时间
  • 1
    69
    10.7MB
    2011-10-30

    实时嵌入式开发、系统软件开发等领域C语言是绝对的语言之王,本人收集了大家耳熟能详的所有C语言经典大作拿出来和大家分享。[立即查看]

  • 1
    35
    7.6MB
    2011-10-30
  • 1
    103
    2.2MB
    2011-10-30
  • 1
    19
    4.8MB
    2011-10-30
  • 1
    35
    11.0MB
    2011-10-30
  • 1
    78
    18.6MB
    2011-10-30
  • 1
    46
    5.9MB
    2011-10-30

    实时嵌入式开发、系统软件开发等领域C语言是绝对的语言之王,本人收集了大家耳熟能详的所有C语言经典大作拿出来和大家分享。[立即查看]

  • 0
    206
    126.9KB
    2011-10-30

    C语言之父的传世经典,一般认为有这本书就不需要其它C语言参考书了,希望对大家有帮助。[立即查看]

  • 0
    346
    4.8MB
    2011-10-30

    C语言之父的传世经典,一般认为有这本书就不需要其它C语言参考书了,希望对大家有帮助。[立即查看]

  • 0
    475
    3.1MB
    2011-10-30

    C语言之父的传世经典,一般认为有这本书就不需要其它C语言参考书了,希望对大家有帮助。[立即查看]

  • 1
    57
    1.6MB
    2011-10-30

    当前资料暂无简介~[立即查看]

  • 1
    93
    39.8MB
    2011-10-30

    如果你想成为出色的Linux开发人员,这些书籍你必须拥有,我习惯标出书籍出版的年份和页数,希望对你也有帮助。[立即查看]

用户评论

0/200
    暂无评论
上传我的资料

相关资料换一换

资料评价:

/ 64
所需积分:1 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!