Changeset 953 for src/ASM/CPP2011
- Timestamp:
- Jun 15, 2011, 10:53:50 AM (10 years ago)
- Location:
- src/ASM/CPP2011
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ASM/CPP2011/cpp-2011.bib
r927 r953 1 @article 2 { asperti:user:2007, 3 author = {Andrea Asperti and Claudio Sacerdoti Coen and Enrico Tassi and Stefano Zacchiroli}, 4 title = {User interaction with the {Matita} proof assistant}, 5 journal = {Journal of Automated Reasoning}, 6 pages = {109--139}, 7 volume = {39}, 8 issue = {2}, 9 year = {2007} 10 } 11 12 @article 13 { bate:wcet:2011, 14 author = {Iain Bate and Usman Khan}, 15 title = {{WCET} analysis of modern processors using multi-criteria optimisation}, 16 journal = {Empirical Software Engineering}, 17 pages = {5--28}, 18 volume = {16}, 19 issue = {1}, 20 year = {2011} 21 } 22 1 23 @article 2 24 { klein:sel4:2010, … … 10 32 } 11 33 12 @proceedings 34 @article 35 { leroy:formal:2009, 36 author = {Xavier Leroy}, 37 title = {Formal verification of a realistic compiler}, 38 journal = {Communications of the {Association of Computing Machinery}}, 39 volume = {52}, 40 number = {7}, 41 pages = {107--115}, 42 year = {2009} 43 } 44 45 @article 46 { leroy:formally:2009, 47 author = {Xavier Leroy}, 48 title = {A formally verified compiler back-end}, 49 journal = {Journal of Automated Reasoning}, 50 volume = {43}, 51 number = {4}, 52 pages = {363--446}, 53 year = {2009} 54 } 55 56 @inproceedings 57 { blazy:formal:2006, 58 author = {Sandrine Blazy and Zaynah Dargaye and Xavier Leroy}, 59 title = {Formal Verification of a {C} Compiler Front-End}, 60 booktitle = {International Symposium on Formal Methods}, 61 pages = {460--475}, 62 year = {2006} 63 } 64 65 @inproceedings 13 66 { klein:sel4:2009, 14 67 author = {Gerwin Klein and June Andronick and Kevin Elphinstone and Gernot Heiser and David Cock and Philip Derrin and Dhammika Elkaduwe and Kai Engelhardt and Rafal Kolanski and Michael Norrish and Thomas Sewell, Harvey Tuch and Simon Winwood}, … … 18 71 } 19 72 73 @inproceedings 74 { yan:wcet:2008, 75 author = {Jun Yan and Wei Zhang}, 76 title = {{WCET} Analysis for Multi-Core Processors with Shared {L2} Instruction Caches}, 77 booktitle = {$\mathrm{14^{th}}$ {IEEE} Symposium on Real-time and Embedded Technology and Applications}, 78 pages = {80--89}, 79 year = {2008} 80 } 81 20 82 @misc 21 83 { cerco:2011, 22 title = {The {CerCo} project}, 23 url = {http://cerco.cs.unibo.it/}, 24 year = {2011} 84 title = {The {CerCo} {FET-Open} project}, 85 howpublished = {\url{http://cerco.cs.unibo.it/}}, 86 year = {2011}, 87 key = {cerco:2011} 88 } 89 90 @misc 91 { cerco-report-code:2011, 92 title = {{CerCo Deliverable D2.2}: prototype cost-preserving C compiler}, 93 howpublished = {\url{http://cerco.cs.unibo.it/raw-attachment/wiki/WikiStart/D2_2.pdf} and \url{http://cerco.cs.unibo.it/raw-attachment/wiki/WikiStart/D2_2_Code.tar.gz}}, 94 year = {2011}, 95 key = {cerco-2.2-report-code:2011} 25 96 } 26 97 … … 28 99 { compcert:2011, 29 100 title = {The {CompCert} project}, 30 url = {http://compcert.inria.fr/}, 31 year = {2011} 101 howpublished = {\url{http://compcert.inria.fr/}}, 102 year = {2011}, 103 key = {compcert:2011} 104 } 105 106 @misc 107 { sdcc:2011, 108 title = {Small Device {C} Compiler 3.0.0}, 109 howpublished = {\url{http://sdcc.sourceforge.net/}}, 110 year = {2011}, 111 key = {sdcc:2010} 32 112 } 33 113 … … 35 115 { sel4:2011, 36 116 title = {The {l4.verified} project}, 37 url = {http://ertos.nicta.com.au/research/l4.verified/},117 howpublished = {\url{http://ertos.nicta.com.au/research/l4.verified/}}, 38 118 year = {2011} 39 119 } 120 121 @misc 122 { siemens:2011, 123 title = {{Siemens Semiconductor Group} 8051 derivative instruction set}, 124 howpublished = {\url{http://www.win.tue.nl/~aeb/comp/8051/instruction-set.pdf}}, 125 year = {2011}, 126 key = {siemens:2011} 127 } 128 129 @techreport 130 { amadio:certifying:2010, 131 author = {Roberto M. Amadio and Nicolas Ayache and Yann R\'{e}gis-Gianas and Ronan Saillard}, 132 title = {Cerifying cost annotations in compilers}, 133 institution = {Universit\'{e} Paris Diderot {(Paris 7)}, Laboratoire {PPS}}, 134 year = {2010} 135 } -
src/ASM/CPP2011/cpp-2011.tex
r952 r953 27 27 \label{sect.introduction} 28 28 29 We consider the formalisation of an assembler for the Intel MCS-51 8-bit microprocessor in the Matita proof assistant .30 This formalisation forms a major component of the EU-funded CerCo project , concering the construction and formalisation of a concrete complexity preserving compiler for a large subset of the C programming language.29 We consider the formalisation of an assembler for the Intel MCS-51 8-bit microprocessor in the Matita proof assistant~\cite{asperti:user:2007}. 30 This formalisation forms a major component of the EU-funded CerCo project~\cite{cerco:2011}, concering the construction and formalisation of a concrete complexity preserving compiler for a large subset of the C programming language. 31 31 32 The MCS-51 dates from the early 1980s and is commonly called the 8051/8052. 33 Despite the microprocessor's age, derivatives are still widely manufactured by a number of semiconductor foundries and the processor is widely used, especially in embedded systems development, where well-tested, cheap, predictable microprocessors find a niche. 32 The MCS-51 dates from the early 1980s and commonly called the 8051/8052. 33 Despite the microprocessor's age, derivatives are still widely manufactured by a number of semiconductor foundries. 34 As a result the processor is widely used, especially in embedded systems development, where well-tested, cheap, predictable microprocessors find their niche. 34 35 35 36 The MCS-51 has a relative paucity of features compared to its more modern brethren. … … 37 38 Instead, each semiconductor foundry that produces an MCS-51 derivative is able to provide accurate timing information in clock cycles for each instruction in their derivative's instruction set. 38 39 It is important to stress that this timing information, unlike in more sophisticated processors, is not an estimate, it is a definition. 39 Withthe MCS-51, if a manufacturer states that a particular opcode takes three clock cycles to execute, then that opcode \emph{always} takes three clock cycles to execute.40 For the MCS-51, if a manufacturer states that a particular opcode takes three clock cycles to execute, then that opcode \emph{always} takes three clock cycles to execute. 40 41 41 42 This predicability of timing information is especially attractive to the CerCo consortium. 42 We are in the process of constructing a cost-preserving certified compiler for a realistic processor, and not for building and formalising the worst case execution time (WCET) tools that would be necessary to achieve the same result with, for example, a modern ARM or PowerPC microprocessor. 43 We are in the process of constructing a certified, concrete complexity compiler for a realistic processor, and not for building and formalising the worst case execution time (WCET) tools that would be necessary to achieve the same result with, for example, a modern ARM or PowerPC microprocessor. 44 43 45 However, the MCS-51's paucity of features is a double edged sword. 44 In particular, the MCS-51 features relatively miniscule memory spaces (including read-only code memory, stack and internal/external RAM) by modern standards.45 As a result , our compiler, to have any sort of hope of successfully compiling realistic C programs, mustproduce `tight' machine code.46 In particular, the MCS-51 features relatively miniscule memory spaces (including read-only code memory, stack and internal/external random access memory) by modern standards. 47 As a result our compiler, to have any sort of hope of successfully compiling realistic C programs, ought to produce `tight' machine code. 46 48 This is not simple. 47 49 48 To begin to understand the problems we faced, we here focus on a single issue in the MCS-51's instruction set: unconditional jumps.49 The MCS-51 features three conditional jump instructions: \texttt{LJMP} and \texttt{SJMP}---`long jump' and `short jump' respectively---and \texttt{AJMP}, an 11-bit oddity of the MCS-51 that we choose to ignore for simplicity's sake.\footnote{Ignoring \texttt{AJMP} and its analogue \texttt{ACALL} is not idiosyncratic. The Small Device C Compiler (SDCC), the leading open source C compiler for the MCS-51, also seemingly does not produce \texttt{AJMP} and \texttt{ACALL} instructions. Their utility in a modern context remains unclear.}50 We here focus on a single issue in the MCS-51's instruction set: unconditional jumps. 51 The MCS-51 features three conditional jump instructions: \texttt{LJMP} and \texttt{SJMP}---`long jump' and `short jump' respectively---and an 11-bit oddity of the MCS-51, \texttt{AJMP}, that the prototype CerCo compiler~\cite{cerco-report-code:2011} ignores for simplicity's sake.\footnote{Ignoring \texttt{AJMP} and its analogue \texttt{ACALL} is not idiosyncratic. The Small Device C Compiler (SDCC)~\cite{sdcc:2011}, the leading open source C compiler for the MCS-51, also seemingly does not produce \texttt{AJMP} and \texttt{ACALL} instructions. Their utility in a modern context remains unclear.} 50 52 Each of these three instructions expects arguments in different sizes and behaves in different ways. 51 For instance, \texttt{SJMP} expects an 8-bit offset which is added to the current program counter to produce a relative, local jump. 52 In contrast, \texttt{LJMP} expects a 16-bit addressing mode and can jump to any address in the MCS-51's memory space. 53 As a result, the size of each opcode is different, and to squeeze as much code as possible into the MCS-51's limited code memory, the smallest instruction that produces the required effect should be picked. 53 \texttt{SJMP} may only perform a `local jump' whereas \texttt{LJMP} may jump to any address in the MCS-51's memory space. 54 Consequently, the size of each opcode is different, and to squeeze as much code as possible into the MCS-51's limited code memory, the smallest possible opcode should be selected. 54 55 55 Having the compiler attempt to select the smallest possible jump instruction was deemed too high a burden, unneccessarily complicating the compilation chain. 56 Instead, we decided to have the compiler target an assembly language, complete with pseudoinstructions. 57 These pseudoinstructions included generic \texttt{Jmp} and \texttt{Call} instructions. 58 We also implemented labels, conditional jumps to labels, a program preamble containing global data and a \texttt{MOV} instruction for moving this global data into the MCS-51's one 16-bit register. 56 The prototype CerCo C compiler does not attempt to select the smallest jump opcode in this manner, as this was thought to unneccessarily complicate the compilation chain. 57 Instead, the compiler targets an assembly language, complete with pseudoinstructions including bespoke \texttt{Jmp} and \texttt{Call} instructions. 58 Labels, conditional jumps to labels, a program preamble containing global data and a \texttt{MOV} instruction for moving this global data into the MCS-51's one 16-bit register also feature. 59 59 This latter feature will ease any later consideration of separate compilation in the CerCo compiler. 60 Further, our conditional jumps to labels behave differently from their machine code counterparts. 61 At the machine code level, conditional jumps may only jump to a relative offset of the current program counter, limiting their scope. 62 However, at the assembly level, conditional jumps may jump to a label that appears anywhere in the program, significantly liberalising the use of conditional jumps. 60 An assembler is used to expand pseudoinstructions into MCS-51 machine code. 63 61 64 However, in line with CerCo's goal to produce a verified compilation chain, this assembly language to machine language translation must also be proved correct. 65 Assemblers are not as simple as they first appear, and are in fact quite hard to formalise. 66 In particular, the CerCo assembler needs to expand labels and pseudoinstructions into a correct representation at the machine level. 62 However, this assembly process is not trivial, for numerous reasons. 63 For example, our conditional jumps to labels behave differently from their machine code counterparts. 64 At the machine code level, conditional jumps may only jump to a relative offset, expressed in a byte, of the current program counter, limiting their range. 65 However, at the assembly level, conditional jumps may jump to a label that appears anywhere in the program, significantly liberalising the use of conditional jumps and further simplifying the design of the CerCo compiler. 67 66 68 Trying to na\"ively relate assembly programs with their machine code counterparts simply does not work.67 Further, trying to na\"ively relate assembly programs with their machine code counterparts simply does not work. 69 68 Machine code programs that fetch from code memory and programs that combine the program counter with constant shifts do not make sense at the assembly level. 70 69 More generally, memory addresses can only be compared with other memory addresses. … … 72 71 In short, the full preservation of the semantics of the two languages is impossible. 73 72 74 A further set of complications isadded by the peculiarities of the CerCo project itself.73 Yet more complications are added by the peculiarities of the CerCo project itself. 75 74 As mentioned, the CerCo consortium is in the business of constructing a verified compiler for the C programming language. 76 However, unlike CompCert ---currently representing the state of the art for `industrial grade' verified compilers---and similar projects,CerCo considers not just the \emph{intensional correctness} of the compiler, but also its \emph{extensional correctness}.75 However, unlike CompCert~\cite{compcert:2011,leroy:formal:2009,leroy:formally:2009}---which currently represents the state of the art for `industrial grade' verified compilers---CerCo considers not just the \emph{intensional correctness} of the compiler, but also its \emph{extensional correctness}. 77 76 That is, CompCert focusses solely on the preservation of the \emph{meaning} of a program during the compilation process, guaranteeing that the program's meaning does not change as it is gradually transformed into assembly code. 78 77 However in any realistic compiler (even the CompCert compiler!) there is no guarantee that the program's time properties are preserved during the compilation process; a compiler's `optimisations' could, in theory, even conspire to degrade the concrete complexity of certain classes of programs.
Note: See TracChangeset
for help on using the changeset viewer.