€•�Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ+/translations/zh_CN/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/zh_TW/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/it_IT/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ja_JP/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ko_KR/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/pt_BR/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/sp_SP/driver-api/mtd/nand_ecc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒNAND Error-correction Code”h]”hŒNAND Error-correction Code”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒE/var/lib/git/docbuild/linux/Documentation/driver-api/mtd/nand_ecc.rst”h´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hhÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhËh²hh³hÊh´KubhŒ paragraph”“”)�”}”(hXPHaving looked at the linux mtd/nand Hamming software ECC engine driver I felt there was room for optimisation. I bashed the code for a few hours performing tricks like table lookup removing superfluous code etc. After that the speed was increased by 35-40%. Still I was not too happy as I felt there was additional room for improvement.”h]”hXPHaving looked at the linux mtd/nand Hamming software ECC engine driver I felt there was room for optimisation. I bashed the code for a few hours performing tricks like table lookup removing superfluous code etc. After that the speed was increased by 35-40%. Still I was not too happy as I felt there was additional room for improvement.”…”�”}”(hhÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhÝ)�”}”(hŒ„Bad! I was hooked. I decided to annotate my steps in this file. Perhaps it is useful to someone or someone learns something from it.”h]”hŒ„Bad! I was hooked. I decided to annotate my steps in this file. Perhaps it is useful to someone or someone learns something from it.”…”�”}”(hhìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubeh}”(h]”Œ introduction”ah ]”h"]”Œ introduction”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒ The problem”h]”hŒ The problem”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´KubhÝ)�”}”(hŒ¬NAND flash (at least SLC one) typically has sectors of 256 bytes. However NAND flash is not extremely reliable so some error detection (and sometimes correction) is needed.”h]”hŒ¬NAND flash (at least SLC one) typically has sectors of 256 bytes. However NAND flash is not extremely reliable so some error detection (and sometimes correction) is needed.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubhÝ)�”}”(hX This is done by means of a Hamming code. I'll try to explain it in laymans terms (and apologies to all the pro's in the field in case I do not use the right terminology, my coding theory class was almost 30 years ago, and I must admit it was not one of my favourites).”h]”hXThis is done by means of a Hamming code. I’ll try to explain it in laymans terms (and apologies to all the pro’s in the field in case I do not use the right terminology, my coding theory class was almost 30 years ago, and I must admit it was not one of my favourites).”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubhÝ)�”}”(hXpAs I said before the ecc calculation is performed on sectors of 256 bytes. This is done by calculating several parity bits over the rows and columns. The parity used is even parity which means that the parity bit = 1 if the data over which the parity is calculated is 1 and the parity bit = 0 if the data over which the parity is calculated is 0. So the total number of bits over the data over which the parity is calculated + the parity bit is even. (see wikipedia if you can't follow this). Parity is often calculated by means of an exclusive or operation, sometimes also referred to as xor. In C the operator for xor is ^”h]”hXrAs I said before the ecc calculation is performed on sectors of 256 bytes. This is done by calculating several parity bits over the rows and columns. The parity used is even parity which means that the parity bit = 1 if the data over which the parity is calculated is 1 and the parity bit = 0 if the data over which the parity is calculated is 0. So the total number of bits over the data over which the parity is calculated + the parity bit is even. (see wikipedia if you can’t follow this). Parity is often calculated by means of an exclusive or operation, sometimes also referred to as xor. In C the operator for xor is ^”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubhÝ)�”}”(hŒ'Back to ecc. Let's give a small figure:”h]”hŒ)Back to ecc. Let’s give a small figure:”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K)hjh²hubhŒtable”“”)�”}”(hhh]”hŒtgroup”“”)�”}”(hhh]”(hŒcolspec”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhjRubhŒtbody”“”)�”}”(hhh]”(hŒrow”“”)�”}”(hhh]”(hŒentry”“”)�”}”(hhh]”hÝ)�”}”(hŒ byte 0:”h]”hŒ byte 0:”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjïubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hj4ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjKubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjbubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjyubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒrp0”h]”hŒrp0”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hj¾ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒrp2”h]”hŒrp2”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjÕubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒrp4”h]”hŒrp4”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjìubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 1:”h]”hŒ byte 1:”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjQubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjhubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hj°h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj­ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjÄubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjÛubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjòubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp1”h]”hŒrp1”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp2”h]”hŒrp2”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp4”h]”hŒrp4”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hj7ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjNubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hjeubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj7ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 2:”h]”hŒ byte 2:”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj…ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjœubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjáubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjøubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj&ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj=ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp0”h]”hŒrp0”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjTubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp3”h]”hŒrp3”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hjkubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp4”h]”hŒrp4”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj‚ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K/hj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj‚ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 3:”h]”hŒ byte 3:”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjçubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjþubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjCubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjZubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjqubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒrp1”h]”hŒrp1”…”�”}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjŸubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒrp3”h]”hŒrp3”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hj¶ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒrp4”h]”hŒrp4”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjäubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjûubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjÍubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 4:”h]”hŒ byte 4:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hj2ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjIubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjwubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjŽubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hj¼ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒrp0”h]”hŒrp0”…”�”}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjêubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒrp2”h]”hŒrp2”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒrp5”h]”hŒrp5”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hj/ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K1hjFubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K2hjfubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1jíhjcubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 254:”h]”hŒ byte 254:”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjûubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7”h]”hŒbit7”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6”h]”hŒbit6”…”�”}”(hj, h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj) ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5”h]”hŒbit5”…”�”}”(hjC h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj@ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4”h]”hŒbit4”…”�”}”(hjZ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjW ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3”h]”hŒbit3”…”�”}”(hjq h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjn ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2”h]”hŒbit2”…”�”}”(hjˆ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj… ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1”h]”hŒbit1”…”�”}”(hjŸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjœ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0”h]”hŒbit0”…”�”}”(hj¶ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj³ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒrp0”h]”hŒrp0”…”�”}”(hjÍ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjÊ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒrp3”h]”hŒrp3”…”�”}”(hjä h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjá ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒrp5”h]”hŒrp5”…”�”}”(hjû h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hjø ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubjî)�”}”(hhh]”hÝ)�”}”(hŒrp15”h]”hŒrp15”…”�”}”(hj) h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj& ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjøubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒ byte 255:”h]”hŒ byte 255:”…”�”}”(hjI h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjF ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit7 cp1 cp3 cp5”h]”hŒbit7 cp1 cp3 cp5”…”�”}”(hj` h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj] ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit6 cp0 cp3 cp5”h]”hŒbit6 cp0 cp3 cp5”…”�”}”(hjw h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjt ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit5 cp1 cp2 cp5”h]”hŒbit5 cp1 cp2 cp5”…”�”}”(hjŽ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj‹ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit4 cp0 cp2 cp5”h]”hŒbit4 cp0 cp2 cp5”…”�”}”(hj¥ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj¢ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit3 cp1 cp3 cp4”h]”hŒbit3 cp1 cp3 cp4”…”�”}”(hj¼ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj¹ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit2 cp0 cp3 cp4”h]”hŒbit2 cp0 cp3 cp4”…”�”}”(hjÓ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjÐ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit1 cp1 cp2 cp4”h]”hŒbit1 cp1 cp2 cp4”…”�”}”(hjê h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjç ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒbit0 cp0 cp2 cp4”h]”hŒbit0 cp0 cp2 cp4”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjþ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp1”h]”hŒrp1”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp3”h]”hŒrp3”…”�”}”(hj/ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hj, ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp5”h]”hŒrp5”…”�”}”(hjF h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjC ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒ...”h]”hŒ...”…”�”}”(hj] h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjZ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubjî)�”}”(hhh]”hÝ)�”}”(hŒrp15”h]”hŒrp15”…”�”}”(hjt h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K4hjq ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjC ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjåubeh}”(h]”h ]”h"]”h$]”h&]”uh1jãhjRubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jPhjMubah}”(h]”h ]”h"]”h$]”h&]”uh1jKhjh²hh³hÊh´NubhÝ)�”}”(hŒiThis figure represents a sector of 256 bytes. cp is my abbreviation for column parity, rp for row parity.”h]”hŒiThis figure represents a sector of 256 bytes. cp is my abbreviation for column parity, rp for row parity.”…”�”}”(hj¡ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K:hjh²hubhÝ)�”}”(hŒ%Let's start to explain column parity.”h]”hŒ'Let’s start to explain column parity.”…”�”}”(hj¯ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K=hjh²hubhŒ bullet_list”“”)�”}”(hhh]”hŒ list_item”“”)�”}”(hŒˆcp0 is the parity that belongs to all bit0, bit2, bit4, bit6. so the sum of all bit0, bit2, bit4 and bit6 values + cp0 itself is even. ”h]”(hÝ)�”}”(hŒ=cp0 is the parity that belongs to all bit0, bit2, bit4, bit6.”h]”hŒ=cp0 is the parity that belongs to all bit0, bit2, bit4, bit6.”…”�”}”(hjÈ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K?hjÄ ubhÝ)�”}”(hŒHso the sum of all bit0, bit2, bit4 and bit6 values + cp0 itself is even.”h]”hŒHso the sum of all bit0, bit2, bit4 and bit6 values + cp0 itself is even.”…”�”}”(hjÖ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KAhjÄ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hj¿ h²hh³hÊh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j½ h³hÊh´K?hjh²hubhÝ)�”}”(hŒ:Similarly cp1 is the sum of all bit1, bit3, bit5 and bit7.”h]”hŒ:Similarly cp1 is the sum of all bit1, bit3, bit5 and bit7.”…”�”}”(hjò h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KChjh²hubj¾ )�”}”(hhh]”(jà )�”}”(hŒ0cp2 is the parity over bit0, bit1, bit4 and bit5”h]”hÝ)�”}”(hj h]”hŒ0cp2 is the parity over bit0, bit1, bit4 and bit5”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KEhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj h²hh³hÊh´Nubjà )�”}”(hŒ1cp3 is the parity over bit2, bit3, bit6 and bit7.”h]”hÝ)�”}”(hj h]”hŒ1cp3 is the parity over bit2, bit3, bit6 and bit7.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KFhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj h²hh³hÊh´Nubjà )�”}”(hŒ1cp4 is the parity over bit0, bit1, bit2 and bit3.”h]”hÝ)�”}”(hj3 h]”hŒ1cp4 is the parity over bit0, bit1, bit2 and bit3.”…”�”}”(hj5 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KGhj1 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj h²hh³hÊh´Nubjà )�”}”(hŒ2cp5 is the parity over bit4, bit5, bit6 and bit7. ”h]”hÝ)�”}”(hŒ1cp5 is the parity over bit4, bit5, bit6 and bit7.”h]”hŒ1cp5 is the parity over bit4, bit5, bit6 and bit7.”…”�”}”(hjL h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KHhjH ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jð jñ uh1j½ h³hÊh´KEhjh²hubhÝ)�”}”(hŒ0Note that each of cp0 .. cp5 is exactly one bit.”h]”hŒ0Note that each of cp0 .. cp5 is exactly one bit.”…”�”}”(hjf h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KJhjh²hubhÝ)�”}”(hŒ*Row parity actually works almost the same.”h]”hŒ*Row parity actually works almost the same.”…”�”}”(hjt h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KLhjh²hubj¾ )�”}”(hhh]”(jà )�”}”(hŒ>rp0 is the parity of all even bytes (0, 2, 4, 6, ... 252, 254)”h]”hÝ)�”}”(hj‡ h]”hŒ>rp0 is the parity of all even bytes (0, 2, 4, 6, ... 252, 254)”…”�”}”(hj‰ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KNhj… ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubjà )�”}”(hŒ>rp1 is the parity of all odd bytes (1, 3, 5, 7, ..., 253, 255)”h]”hÝ)�”}”(hjž h]”hŒ>rp1 is the parity of all odd bytes (1, 3, 5, 7, ..., 253, 255)”…”�”}”(hj  h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KOhjœ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubjà )�”}”(hŒ^rp2 is the parity of all bytes 0, 1, 4, 5, 8, 9, ... (so handle two bytes, then skip 2 bytes).”h]”hÝ)�”}”(hŒ^rp2 is the parity of all bytes 0, 1, 4, 5, 8, 9, ... (so handle two bytes, then skip 2 bytes).”h]”hŒ^rp2 is the parity of all bytes 0, 1, 4, 5, 8, 9, ... (so handle two bytes, then skip 2 bytes).”…”�”}”(hj· h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KPhj³ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubjà )�”}”(hŒIrp3 is covers the half rp2 does not cover (bytes 2, 3, 6, 7, 10, 11, ...)”h]”hÝ)�”}”(hjÍ h]”hŒIrp3 is covers the half rp2 does not cover (bytes 2, 3, 6, 7, 10, 11, ...)”…”�”}”(hjÏ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KRhjË ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubjà )�”}”(hŒ“for rp4 the rule is cover 4 bytes, skip 4 bytes, cover 4 bytes, skip 4 etc. so rp4 calculates parity over bytes 0, 1, 2, 3, 8, 9, 10, 11, 16, ...)”h]”(hÝ)�”}”(hŒKfor rp4 the rule is cover 4 bytes, skip 4 bytes, cover 4 bytes, skip 4 etc.”h]”hŒKfor rp4 the rule is cover 4 bytes, skip 4 bytes, cover 4 bytes, skip 4 etc.”…”�”}”(hjæ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KShjâ ubhÝ)�”}”(hŒFso rp4 calculates parity over bytes 0, 1, 2, 3, 8, 9, 10, 11, 16, ...)”h]”hŒFso rp4 calculates parity over bytes 0, 1, 2, 3, 8, 9, 10, 11, 16, ...)”…”�”}”(hjô h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KUhjâ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubjà )�”}”(hŒKand rp5 covers the other half, so bytes 4, 5, 6, 7, 12, 13, 14, 15, 20, .. ”h]”hÝ)�”}”(hŒJand rp5 covers the other half, so bytes 4, 5, 6, 7, 12, 13, 14, 15, 20, ..”h]”hŒJand rp5 covers the other half, so bytes 4, 5, 6, 7, 12, 13, 14, 15, 20, ..”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KVhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj‚ h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jð jñ uh1j½ h³hÊh´KNhjh²hubhÝ)�”}”(hŒ=The story now becomes quite boring. I guess you get the idea.”h]”hŒ=The story now becomes quite boring. I guess you get the idea.”…”�”}”(hj& h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KXhjh²hubj¾ )�”}”(hhh]”(jà )�”}”(hŒ#rp6 covers 8 bytes then skips 8 etc”h]”hÝ)�”}”(hj9 h]”hŒ#rp6 covers 8 bytes then skips 8 etc”…”�”}”(hj; h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KZhj7 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ#rp7 skips 8 bytes then covers 8 etc”h]”hÝ)�”}”(hjP h]”hŒ#rp7 skips 8 bytes then covers 8 etc”…”�”}”(hjR h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K[hjN ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ%rp8 covers 16 bytes then skips 16 etc”h]”hÝ)�”}”(hjg h]”hŒ%rp8 covers 16 bytes then skips 16 etc”…”�”}”(hji h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K\hje ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ%rp9 skips 16 bytes then covers 16 etc”h]”hÝ)�”}”(hj~ h]”hŒ%rp9 skips 16 bytes then covers 16 etc”…”�”}”(hj€ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K]hj| ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ&rp10 covers 32 bytes then skips 32 etc”h]”hÝ)�”}”(hj• h]”hŒ&rp10 covers 32 bytes then skips 32 etc”…”�”}”(hj— h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K^hj“ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ&rp11 skips 32 bytes then covers 32 etc”h]”hÝ)�”}”(hj¬ h]”hŒ&rp11 skips 32 bytes then covers 32 etc”…”�”}”(hj® h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K_hjª ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ&rp12 covers 64 bytes then skips 64 etc”h]”hÝ)�”}”(hjà h]”hŒ&rp12 covers 64 bytes then skips 64 etc”…”�”}”(hjÅ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K`hjÁ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ&rp13 skips 64 bytes then covers 64 etc”h]”hÝ)�”}”(hjÚ h]”hŒ&rp13 skips 64 bytes then covers 64 etc”…”�”}”(hjÜ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KahjØ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ$rp14 covers 128 bytes then skips 128”h]”hÝ)�”}”(hjñ h]”hŒ$rp14 covers 128 bytes then skips 128”…”�”}”(hjó h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kbhjï ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubjà )�”}”(hŒ%rp15 skips 128 bytes then covers 128 ”h]”hÝ)�”}”(hŒ$rp15 skips 128 bytes then covers 128”h]”hŒ$rp15 skips 128 bytes then covers 128”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kchjubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj4 h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jð jñ uh1j½ h³hÊh´KZhjh²hubhÝ)�”}”(hŒJIn the end the parity bits are grouped together in three bytes as follows:”h]”hŒJIn the end the parity bits are grouped together in three bytes as follows:”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kehjh²hubjL)�”}”(hhh]”jQ)�”}”(hhh]”(jV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubjV)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jUhj5ubhŒthead”“”)�”}”(hhh]”jé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒECC”h]”hŒECC”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihjšubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 7”h]”hŒBit 7”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 6”h]”hŒBit 6”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KihjÈubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 5”h]”hŒBit 5”…”�”}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihjßubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 4”h]”hŒBit 4”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihjöubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 3”h]”hŒBit 3”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 2”h]”hŒBit 2”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihj$ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 1”h]”hŒBit 1”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubjî)�”}”(hhh]”hÝ)�”}”(hŒBit 0”h]”hŒBit 0”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KihjRubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj—ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhj”ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hj5ubjä)�”}”(hhh]”(jé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒECC 0”h]”hŒECC 0”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhj{ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp07”h]”hŒrp07”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhj’ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp06”h]”hŒrp06”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhj©ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp05”h]”hŒrp05”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KkhjÀubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp04”h]”hŒrp04”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhj×ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp03”h]”hŒrp03”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhjîubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp02”h]”hŒrp02”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp01”h]”hŒrp01”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubjî)�”}”(hhh]”hÝ)�”}”(hŒrp00”h]”hŒrp00”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kkhj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjxubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjuubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒECC 1”h]”hŒECC 1”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KlhjSubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp15”h]”hŒrp15”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhjjubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp14”h]”hŒrp14”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp13”h]”hŒrp13”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhj˜ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp12”h]”hŒrp12”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhj¯ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp11”h]”hŒrp11”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KlhjÆubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp10”h]”hŒrp10”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KlhjÝubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp09”h]”hŒrp09”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhjôubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubjî)�”}”(hhh]”hÝ)�”}”(hŒrp08”h]”hŒrp08”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhjPubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjuubjé)�”}”(hhh]”(jî)�”}”(hhh]”hÝ)�”}”(hŒECC 2”h]”hŒECC 2”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp5”h]”hŒcp5”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KmhjBubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp4”h]”hŒcp4”…”�”}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KmhjYubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp3”h]”hŒcp3”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhjpubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp2”h]”hŒcp2”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhj‡ubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp1”h]”hŒcp1”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhjžubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒcp0”h]”hŒcp0”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhjµubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hŒ1”h]”hŒ1”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KmhjÌubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubjî)�”}”(hhh]”hÝ)�”}”(hjÑh]”hŒ1”…”�”}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kmhjãubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj(ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjuubeh}”(h]”h ]”h"]”h$]”h&]”uh1jãhj5ubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”K uh1jPhj2ubah}”(h]”h ]”h"]”h$]”h&]”uh1jKhjh²hh³hÊh´NubhÝ)�”}”(hŒøI detected after writing this that ST application note AN1823 (http://www.st.com/stonline/) gives a much nicer picture.(but they use line parity as term where I use row parity) Oh well, I'm graphically challenged, so suffer with me for a moment :-)”h]”(hŒ?I detected after writing this that ST application note AN1823 (”…”�”}”(hjh²hh³Nh´NubhŒ reference”“”)�”}”(hŒhttp://www.st.com/stonline/”h]”hŒhttp://www.st.com/stonline/”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jhjubhŒ ) gives a much nicer picture.(but they use line parity as term where I use row parity) Oh well, I’m graphically challenged, so suffer with me for a moment :-)”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kphjh²hubhÝ)�”}”(hŒBAnd I could not reuse the ST picture anyway for copyright reasons.”h]”hŒBAnd I could not reuse the ST picture anyway for copyright reasons.”…”�”}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kuhjh²hubeh}”(h]”Œ the-problem”ah ]”h"]”Œ the problem”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 0”h]”hŒ Attempt 0”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjKh²hh³hÊh´KyubhÝ)�”}”(hŒGImplementing the parity calculation is pretty simple. In C pseudocode::”h]”hŒFImplementing the parity calculation is pretty simple. In C pseudocode:”…”�”}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K{hjKh²hubhŒ literal_block”“”)�”}”(hXHfor (i = 0; i < 256; i++) { if (i & 0x01) rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; else rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp0; if (i & 0x02) rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3; else rp2 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp2; if (i & 0x04) rp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp5; else rp4 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp4; if (i & 0x08) rp7 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp7; else rp6 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp6; if (i & 0x10) rp9 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp9; else rp8 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp8; if (i & 0x20) rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11; else rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10; if (i & 0x40) rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13; else rp12 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp12; if (i & 0x80) rp15 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp15; else rp14 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp14; cp0 = bit6 ^ bit4 ^ bit2 ^ bit0 ^ cp0; cp1 = bit7 ^ bit5 ^ bit3 ^ bit1 ^ cp1; cp2 = bit5 ^ bit4 ^ bit1 ^ bit0 ^ cp2; cp3 = bit7 ^ bit6 ^ bit3 ^ bit2 ^ cp3 cp4 = bit3 ^ bit2 ^ bit1 ^ bit0 ^ cp4 cp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ cp5 }”h]”hXHfor (i = 0; i < 256; i++) { if (i & 0x01) rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; else rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp0; if (i & 0x02) rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3; else rp2 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp2; if (i & 0x04) rp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp5; else rp4 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp4; if (i & 0x08) rp7 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp7; else rp6 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp6; if (i & 0x10) rp9 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp9; else rp8 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp8; if (i & 0x20) rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11; else rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10; if (i & 0x40) rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13; else rp12 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp12; if (i & 0x80) rp15 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp15; else rp14 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp14; cp0 = bit6 ^ bit4 ^ bit2 ^ bit0 ^ cp0; cp1 = bit7 ^ bit5 ^ bit3 ^ bit1 ^ cp1; cp2 = bit5 ^ bit4 ^ bit1 ^ bit0 ^ cp2; cp3 = bit7 ^ bit6 ^ bit3 ^ bit2 ^ cp3 cp4 = bit3 ^ bit2 ^ bit1 ^ bit0 ^ cp4 cp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ cp5 }”…”�”}”hjlsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jjh³hÊh´K~hjKh²hubeh}”(h]”Œ attempt-0”ah ]”h"]”Œ attempt 0”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kyubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 0”h]”hŒ Analysis 0”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj„h²hh³hÊh´KªubhÝ)�”}”(hŒøC does have bitwise operators but not really operators to do the above efficiently (and most hardware has no such instructions either). Therefore without implementing this it was clear that the code above was not going to bring me a Nobel prize :-)”h]”hŒøC does have bitwise operators but not really operators to do the above efficiently (and most hardware has no such instructions either). Therefore without implementing this it was clear that the code above was not going to bring me a Nobel prize :-)”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¬hj„h²hubhÝ)�”}”(hXnFortunately the exclusive or operation is commutative, so we can combine the values in any order. So instead of calculating all the bits individually, let us try to rearrange things. For the column parity this is easy. We can just xor the bytes and in the end filter out the relevant bits. This is pretty nice as it will bring all cp calculation out of the for loop.”h]”hXnFortunately the exclusive or operation is commutative, so we can combine the values in any order. So instead of calculating all the bits individually, let us try to rearrange things. For the column parity this is easy. We can just xor the bytes and in the end filter out the relevant bits. This is pretty nice as it will bring all cp calculation out of the for loop.”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K±hj„h²hubhÝ)�”}”(hŒISimilarly we can first xor the bytes for the various rows. This leads to:”h]”hŒISimilarly we can first xor the bytes for the various rows. This leads to:”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¸hj„h²hubeh}”(h]”Œ analysis-0”ah ]”h"]”Œ analysis 0”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kªubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 1”h]”hŒ Attempt 1”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÇh²hh³hÊh´K½ubjk)�”}”(hX* const char parity[256] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; void ecc1(const unsigned char *buf, unsigned char *code) { int i; const unsigned char *bp = buf; unsigned char cur; unsigned char rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; unsigned char rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; unsigned char par; par = 0; rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; for (i = 0; i < 256; i++) { cur = *bp++; par ^= cur; if (i & 0x01) rp1 ^= cur; else rp0 ^= cur; if (i & 0x02) rp3 ^= cur; else rp2 ^= cur; if (i & 0x04) rp5 ^= cur; else rp4 ^= cur; if (i & 0x08) rp7 ^= cur; else rp6 ^= cur; if (i & 0x10) rp9 ^= cur; else rp8 ^= cur; if (i & 0x20) rp11 ^= cur; else rp10 ^= cur; if (i & 0x40) rp13 ^= cur; else rp12 ^= cur; if (i & 0x80) rp15 ^= cur; else rp14 ^= cur; } code[0] = (parity[rp7] << 7) | (parity[rp6] << 6) | (parity[rp5] << 5) | (parity[rp4] << 4) | (parity[rp3] << 3) | (parity[rp2] << 2) | (parity[rp1] << 1) | (parity[rp0]); code[1] = (parity[rp15] << 7) | (parity[rp14] << 6) | (parity[rp13] << 5) | (parity[rp12] << 4) | (parity[rp11] << 3) | (parity[rp10] << 2) | (parity[rp9] << 1) | (parity[rp8]); code[2] = (parity[par & 0xf0] << 7) | (parity[par & 0x0f] << 6) | (parity[par & 0xcc] << 5) | (parity[par & 0x33] << 4) | (parity[par & 0xaa] << 3) | (parity[par & 0x55] << 2); code[0] = ~code[0]; code[1] = ~code[1]; code[2] = ~code[2]; }”h]”hX* const char parity[256] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; void ecc1(const unsigned char *buf, unsigned char *code) { int i; const unsigned char *bp = buf; unsigned char cur; unsigned char rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; unsigned char rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; unsigned char par; par = 0; rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; for (i = 0; i < 256; i++) { cur = *bp++; par ^= cur; if (i & 0x01) rp1 ^= cur; else rp0 ^= cur; if (i & 0x02) rp3 ^= cur; else rp2 ^= cur; if (i & 0x04) rp5 ^= cur; else rp4 ^= cur; if (i & 0x08) rp7 ^= cur; else rp6 ^= cur; if (i & 0x10) rp9 ^= cur; else rp8 ^= cur; if (i & 0x20) rp11 ^= cur; else rp10 ^= cur; if (i & 0x40) rp13 ^= cur; else rp12 ^= cur; if (i & 0x80) rp15 ^= cur; else rp14 ^= cur; } code[0] = (parity[rp7] << 7) | (parity[rp6] << 6) | (parity[rp5] << 5) | (parity[rp4] << 4) | (parity[rp3] << 3) | (parity[rp2] << 2) | (parity[rp1] << 1) | (parity[rp0]); code[1] = (parity[rp15] << 7) | (parity[rp14] << 6) | (parity[rp13] << 5) | (parity[rp12] << 4) | (parity[rp11] << 3) | (parity[rp10] << 2) | (parity[rp9] << 1) | (parity[rp8]); code[2] = (parity[par & 0xf0] << 7) | (parity[par & 0x0f] << 6) | (parity[par & 0xcc] << 5) | (parity[par & 0x33] << 4) | (parity[par & 0xaa] << 3) | (parity[par & 0x55] << 2); code[0] = ~code[0]; code[1] = ~code[1]; code[2] = ~code[2]; }”…”�”}”hjØsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´KÁhjÇh²hubhÝ)�”}”(hŒÃStill pretty straightforward. The last three invert statements are there to give a checksum of 0xff 0xff 0xff for an empty flash. In an empty flash all data is 0xff, so the checksum then matches.”h]”hŒÃStill pretty straightforward. The last three invert statements are there to give a checksum of 0xff 0xff 0xff for an empty flash. In an empty flash all data is 0xff, so the checksum then matches.”…”�”}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjÇh²hubhÝ)�”}”(hŒ‘I also introduced the parity lookup. I expected this to be the fastest way to calculate the parity, but I will investigate alternatives later on.”h]”hŒ‘I also introduced the parity lookup. I expected this to be the fastest way to calculate the parity, but I will investigate alternatives later on.”…”�”}”(hjôh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjÇh²hubeh}”(h]”Œ attempt-1”ah ]”h"]”Œ attempt 1”ah$]”h&]”uh1hµhh·h²hh³hÊh´K½ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 1”h]”hŒ Analysis 1”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj h²hh³hÊh´MubhÝ)�”}”(hŒÑThe code works, but is not terribly efficient. On my system it took almost 4 times as much time as the linux driver code. But hey, if it was *that* easy this would have been done long before. No pain. no gain.”h]”(hŒ�The code works, but is not terribly efficient. On my system it took almost 4 times as much time as the linux driver code. But hey, if it was ”…”�”}”(hjh²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*that*”h]”hŒthat”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjubhŒ> easy this would have been done long before. No pain. no gain.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhj h²hubhÝ)�”}”(hŒ4Fortunately there is plenty of room for improvement.”h]”hŒ4Fortunately there is plenty of room for improvement.”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhj h²hubhÝ)�”}”(hXIn step 1 we moved from bit-wise calculation to byte-wise calculation. However in C we can also use the unsigned long data type and virtually every modern microprocessor supports 32 bit operations, so why not try to write our code in such a way that we process data in 32 bit chunks.”h]”hXIn step 1 we moved from bit-wise calculation to byte-wise calculation. However in C we can also use the unsigned long data type and virtually every modern microprocessor supports 32 bit operations, so why not try to write our code in such a way that we process data in 32 bit chunks.”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M!hj h²hubhÝ)�”}”(hX¹Of course this means some modification as the row parity is byte by byte. A quick analysis: for the column parity we use the par variable. When extending to 32 bits we can in the end easily calculate rp0 and rp1 from it. (because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0 respectively, from MSB to LSB) also rp2 and rp3 can be easily retrieved from par as rp3 covers the first two MSBs and rp2 covers the last two LSBs.”h]”hX¹Of course this means some modification as the row parity is byte by byte. A quick analysis: for the column parity we use the par variable. When extending to 32 bits we can in the end easily calculate rp0 and rp1 from it. (because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0 respectively, from MSB to LSB) also rp2 and rp3 can be easily retrieved from par as rp3 covers the first two MSBs and rp2 covers the last two LSBs.”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M&hj h²hubhÝ)�”}”(hX0Note that of course now the loop is executed only 64 times (256/4). And note that care must taken wrt byte ordering. The way bytes are ordered in a long is machine dependent, and might affect us. Anyway, if there is an issue: this code is developed on x86 (to be precise: a DELL PC with a D920 Intel CPU)”h]”hX0Note that of course now the loop is executed only 64 times (256/4). And note that care must taken wrt byte ordering. The way bytes are ordered in a long is machine dependent, and might affect us. Anyway, if there is an issue: this code is developed on x86 (to be precise: a DELL PC with a D920 Intel CPU)”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M/hj h²hubhÝ)�”}”(hŒÃAnd of course the performance might depend on alignment, but I expect that the I/O buffers in the nand driver are aligned properly (and otherwise that should be fixed to get maximum performance).”h]”hŒÃAnd of course the performance might depend on alignment, but I expect that the I/O buffers in the nand driver are aligned properly (and otherwise that should be fixed to get maximum performance).”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M5hj h²hubhÝ)�”}”(hŒLet's give it a try...”h]”hŒLet’s give it a try...”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M9hj h²hubeh}”(h]”Œ analysis-1”ah ]”h"]”Œ analysis 1”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 2”h]”hŒ Attempt 2”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj™h²hh³hÊh´M=ubjk)�”}”(hX4 extern const char parity[256]; void ecc2(const unsigned char *buf, unsigned char *code) { int i; const unsigned long *bp = (unsigned long *)buf; unsigned long cur; unsigned long rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; unsigned long rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; unsigned long par; par = 0; rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; for (i = 0; i < 64; i++) { cur = *bp++; par ^= cur; if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; } /* we need to adapt the code generation for the fact that rp vars are now long; also the column parity calculation needs to be changed. we'll bring rp4 to 15 back to single byte entities by shifting and xoring */ rp4 ^= (rp4 >> 16); rp4 ^= (rp4 >> 8); rp4 &= 0xff; rp5 ^= (rp5 >> 16); rp5 ^= (rp5 >> 8); rp5 &= 0xff; rp6 ^= (rp6 >> 16); rp6 ^= (rp6 >> 8); rp6 &= 0xff; rp7 ^= (rp7 >> 16); rp7 ^= (rp7 >> 8); rp7 &= 0xff; rp8 ^= (rp8 >> 16); rp8 ^= (rp8 >> 8); rp8 &= 0xff; rp9 ^= (rp9 >> 16); rp9 ^= (rp9 >> 8); rp9 &= 0xff; rp10 ^= (rp10 >> 16); rp10 ^= (rp10 >> 8); rp10 &= 0xff; rp11 ^= (rp11 >> 16); rp11 ^= (rp11 >> 8); rp11 &= 0xff; rp12 ^= (rp12 >> 16); rp12 ^= (rp12 >> 8); rp12 &= 0xff; rp13 ^= (rp13 >> 16); rp13 ^= (rp13 >> 8); rp13 &= 0xff; rp14 ^= (rp14 >> 16); rp14 ^= (rp14 >> 8); rp14 &= 0xff; rp15 ^= (rp15 >> 16); rp15 ^= (rp15 >> 8); rp15 &= 0xff; rp3 = (par >> 16); rp3 ^= (rp3 >> 8); rp3 &= 0xff; rp2 = par & 0xffff; rp2 ^= (rp2 >> 8); rp2 &= 0xff; par ^= (par >> 16); rp1 = (par >> 8); rp1 &= 0xff; rp0 = (par & 0xff); par ^= (par >> 8); par &= 0xff; code[0] = (parity[rp7] << 7) | (parity[rp6] << 6) | (parity[rp5] << 5) | (parity[rp4] << 4) | (parity[rp3] << 3) | (parity[rp2] << 2) | (parity[rp1] << 1) | (parity[rp0]); code[1] = (parity[rp15] << 7) | (parity[rp14] << 6) | (parity[rp13] << 5) | (parity[rp12] << 4) | (parity[rp11] << 3) | (parity[rp10] << 2) | (parity[rp9] << 1) | (parity[rp8]); code[2] = (parity[par & 0xf0] << 7) | (parity[par & 0x0f] << 6) | (parity[par & 0xcc] << 5) | (parity[par & 0x33] << 4) | (parity[par & 0xaa] << 3) | (parity[par & 0x55] << 2); code[0] = ~code[0]; code[1] = ~code[1]; code[2] = ~code[2]; }”h]”hX4 extern const char parity[256]; void ecc2(const unsigned char *buf, unsigned char *code) { int i; const unsigned long *bp = (unsigned long *)buf; unsigned long cur; unsigned long rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; unsigned long rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; unsigned long par; par = 0; rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; for (i = 0; i < 64; i++) { cur = *bp++; par ^= cur; if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; } /* we need to adapt the code generation for the fact that rp vars are now long; also the column parity calculation needs to be changed. we'll bring rp4 to 15 back to single byte entities by shifting and xoring */ rp4 ^= (rp4 >> 16); rp4 ^= (rp4 >> 8); rp4 &= 0xff; rp5 ^= (rp5 >> 16); rp5 ^= (rp5 >> 8); rp5 &= 0xff; rp6 ^= (rp6 >> 16); rp6 ^= (rp6 >> 8); rp6 &= 0xff; rp7 ^= (rp7 >> 16); rp7 ^= (rp7 >> 8); rp7 &= 0xff; rp8 ^= (rp8 >> 16); rp8 ^= (rp8 >> 8); rp8 &= 0xff; rp9 ^= (rp9 >> 16); rp9 ^= (rp9 >> 8); rp9 &= 0xff; rp10 ^= (rp10 >> 16); rp10 ^= (rp10 >> 8); rp10 &= 0xff; rp11 ^= (rp11 >> 16); rp11 ^= (rp11 >> 8); rp11 &= 0xff; rp12 ^= (rp12 >> 16); rp12 ^= (rp12 >> 8); rp12 &= 0xff; rp13 ^= (rp13 >> 16); rp13 ^= (rp13 >> 8); rp13 &= 0xff; rp14 ^= (rp14 >> 16); rp14 ^= (rp14 >> 8); rp14 &= 0xff; rp15 ^= (rp15 >> 16); rp15 ^= (rp15 >> 8); rp15 &= 0xff; rp3 = (par >> 16); rp3 ^= (rp3 >> 8); rp3 &= 0xff; rp2 = par & 0xffff; rp2 ^= (rp2 >> 8); rp2 &= 0xff; par ^= (par >> 16); rp1 = (par >> 8); rp1 &= 0xff; rp0 = (par & 0xff); par ^= (par >> 8); par &= 0xff; code[0] = (parity[rp7] << 7) | (parity[rp6] << 6) | (parity[rp5] << 5) | (parity[rp4] << 4) | (parity[rp3] << 3) | (parity[rp2] << 2) | (parity[rp1] << 1) | (parity[rp0]); code[1] = (parity[rp15] << 7) | (parity[rp14] << 6) | (parity[rp13] << 5) | (parity[rp12] << 4) | (parity[rp11] << 3) | (parity[rp10] << 2) | (parity[rp9] << 1) | (parity[rp8]); code[2] = (parity[par & 0xf0] << 7) | (parity[par & 0x0f] << 6) | (parity[par & 0xcc] << 5) | (parity[par & 0x33] << 4) | (parity[par & 0xaa] << 3) | (parity[par & 0x55] << 2); code[0] = ~code[0]; code[1] = ~code[1]; code[2] = ~code[2]; }”…”�”}”hjªsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´MAhj™h²hubhÝ)�”}”(hX The parity array is not shown any more. Note also that for these examples I kinda deviated from my regular programming style by allowing multiple statements on a line, not using { } in then and else blocks with only a single statement and by using operators like ^=”h]”hX The parity array is not shown any more. Note also that for these examples I kinda deviated from my regular programming style by allowing multiple statements on a line, not using { } in then and else blocks with only a single statement and by using operators like ^=”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M”hj™h²hubeh}”(h]”Œ attempt-2”ah ]”h"]”Œ attempt 2”ah$]”h&]”uh1hµhh·h²hh³hÊh´M=ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 2”h]”hŒ Analysis 2”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÎh²hh³hÊh´M›ubhÝ)�”}”(hXcThe code (of course) works, and hurray: we are a little bit faster than the linux driver code (about 15%). But wait, don't cheer too quickly. There is more to be gained. If we look at e.g. rp14 and rp15 we see that we either xor our data with rp14 or with rp15. However we also have par which goes over all data. This means there is no need to calculate rp14 as it can be calculated from rp15 through rp14 = par ^ rp15, because par = rp14 ^ rp15; (or if desired we can avoid calculating rp15 and calculate it from rp14). That is why some places refer to inverse parity. Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13. Effectively this means we can eliminate the else clause from the if statements. Also we can optimise the calculation in the end a little bit by going from long to byte first. Actually we can even avoid the table lookups”•Њh]”hXeThe code (of course) works, and hurray: we are a little bit faster than the linux driver code (about 15%). But wait, don’t cheer too quickly. There is more to be gained. If we look at e.g. rp14 and rp15 we see that we either xor our data with rp14 or with rp15. However we also have par which goes over all data. This means there is no need to calculate rp14 as it can be calculated from rp15 through rp14 = par ^ rp15, because par = rp14 ^ rp15; (or if desired we can avoid calculating rp15 and calculate it from rp14). That is why some places refer to inverse parity. Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13. Effectively this means we can eliminate the else clause from the if statements. Also we can optimise the calculation in the end a little bit by going from long to byte first. Actually we can even avoid the table lookups”…”�”}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M�hjÎh²hubeh}”(h]”Œ analysis-2”ah ]”h"]”Œ analysis 2”ah$]”h&]”uh1hµhh·h²hh³hÊh´M›ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 3”h]”hŒ Attempt 3”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjõh²hh³hÊh´M­ubhÝ)�”}”(hŒOdd replaced::”h]”hŒ Odd replaced:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M¯hjõh²hubjk)�”}”(hXif (i & 0x01) rp5 ^= cur; else rp4 ^= cur; if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; if (i & 0x20) rp15 ^= cur; else rp14 ^= cur;”h]”hXif (i & 0x01) rp5 ^= cur; else rp4 ^= cur; if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; if (i & 0x20) rp15 ^= cur; else rp14 ^= cur;”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´M±hjõh²hubhÝ)�”}”(hŒwith::”h]”hŒwith:”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M¸hjõh²hubjk)�”}”(hŒžif (i & 0x01) rp5 ^= cur; if (i & 0x02) rp7 ^= cur; if (i & 0x04) rp9 ^= cur; if (i & 0x08) rp11 ^= cur; if (i & 0x10) rp13 ^= cur; if (i & 0x20) rp15 ^= cur;”h]”hŒžif (i & 0x01) rp5 ^= cur; if (i & 0x02) rp7 ^= cur; if (i & 0x04) rp9 ^= cur; if (i & 0x08) rp11 ^= cur; if (i & 0x10) rp13 ^= cur; if (i & 0x20) rp15 ^= cur;”…”�”}”hj0sbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´Mºhjõh²hubhÝ)�”}”(hŒand outside the loop added::”h]”hŒand outside the loop added:”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÁhjõh²hubjk)�”}”(hŒqrp4 = par ^ rp5; rp6 = par ^ rp7; rp8 = par ^ rp9; rp10 = par ^ rp11; rp12 = par ^ rp13; rp14 = par ^ rp15;”h]”hŒqrp4 = par ^ rp5; rp6 = par ^ rp7; rp8 = par ^ rp9; rp10 = par ^ rp11; rp12 = par ^ rp13; rp14 = par ^ rp15;”…”�”}”hjLsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´MÃhjõh²hubhÝ)�”}”(hŒ�And after that the code takes about 30% more time, although the number of statements is reduced. This is also reflected in the assembly code.”h]”hŒ�And after that the code takes about 30% more time, although the number of statements is reduced. This is also reflected in the assembly code.”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÊhjõh²hubeh}”(h]”Œ attempt-3”ah ]”h"]”Œ attempt 3”ah$]”h&]”uh1hµhh·h²hh³hÊh´M­ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 3”h]”hŒ Analysis 3”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjph²hh³hÊh´MÏubhÝ)�”}”(hXVery weird. Guess it has to do with caching or instruction parallelism or so. I also tried on an eeePC (Celeron, clocked at 900 Mhz). Interesting observation was that this one is only 30% slower (according to time) executing the code as my 3Ghz D920 processor.”h]”hXVery weird. Guess it has to do with caching or instruction parallelism or so. I also tried on an eeePC (Celeron, clocked at 900 Mhz). Interesting observation was that this one is only 30% slower (according to time) executing the code as my 3Ghz D920 processor.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÑhjph²hubhÝ)�”}”(hŒÿWell, it was expected not to be easy so maybe instead move to a different track: let's move back to the code from attempt2 and do some loop unrolling. This will eliminate a few if statements. I'll try different amounts of unrolling to see what works best.”h]”hXWell, it was expected not to be easy so maybe instead move to a different track: let’s move back to the code from attempt2 and do some loop unrolling. This will eliminate a few if statements. I’ll try different amounts of unrolling to see what works best.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÖhjph²hubeh}”(h]”Œ analysis-3”ah ]”h"]”Œ analysis 3”ah$]”h&]”uh1hµhh·h²hh³hÊh´MÏubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 4”h]”hŒ Attempt 4”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¥h²hh³hÊh´MÝubhÝ)�”}”(hŒCUnrolled the loop 1, 2, 3 and 4 times. For 4 the code starts with::”h]”hŒBUnrolled the loop 1, 2, 3 and 4 times. For 4 the code starts with:”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mßhj¥h²hubjk)�”}”(hX$for (i = 0; i < 4; i++) { cur = *bp++; par ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; rp10 ^= cur; if (i & 0x1) rp13 ^= cur; else rp12 ^= cur; if (i & 0x2) rp15 ^= cur; else rp14 ^= cur; cur = *bp++; par ^= cur; rp5 ^= cur; rp6 ^= cur; ...”h]”hX$for (i = 0; i < 4; i++) { cur = *bp++; par ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; rp10 ^= cur; if (i & 0x1) rp13 ^= cur; else rp12 ^= cur; if (i & 0x2) rp15 ^= cur; else rp14 ^= cur; cur = *bp++; par ^= cur; rp5 ^= cur; rp6 ^= cur; ...”…”�”}”hjÄsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´Mâhj¥h²hubeh}”(h]”Œ attempt-4”ah ]”h"]”Œ attempt 4”ah$]”h&]”uh1hµhh·h²hh³hÊh´MÝubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 4”h]”hŒ Analysis 4”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÚh²hh³hÊh´MôubhÝ)�”}”(hŒUnrolling once gains about 15%”h]”hŒUnrolling once gains about 15%”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MöhjÚh²hubhÝ)�”}”(hŒ+Unrolling twice keeps the gain at about 15%”h]”hŒ+Unrolling twice keeps the gain at about 15%”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MøhjÚh²hubhÝ)�”}”(hŒ@Unrolling three times gives a gain of 30% compared to attempt 2.”h]”hŒ@Unrolling three times gives a gain of 30% compared to attempt 2.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MúhjÚh²hubhÝ)�”}”(hŒTUnrolling four times gives a marginal improvement compared to unrolling three times.”h]”hŒTUnrolling four times gives a marginal improvement compared to unrolling three times.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MühjÚh²hubhÝ)�”}”(hŒ�I decided to proceed with a four time unrolled loop anyway. It was my gut feeling that in the next steps I would obtain additional gain from it.”h]”hŒ�I decided to proceed with a four time unrolled loop anyway. It was my gut feeling that in the next steps I would obtain additional gain from it.”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÿhjÚh²hubhÝ)�”}”(hXœThe next step was triggered by the fact that par contains the xor of all bytes and rp4 and rp5 each contain the xor of half of the bytes. So in effect par = rp4 ^ rp5. But as xor is commutative we can also say that rp5 = par ^ rp4. So no need to keep both rp4 and rp5 around. We can eliminate rp5 (or rp4, but I already foresaw another optimisation). The same holds for rp6/7, rp8/9, rp10/11 rp12/13 and rp14/15.”h]”hXœThe next step was triggered by the fact that par contains the xor of all bytes and rp4 and rp5 each contain the xor of half of the bytes. So in effect par = rp4 ^ rp5. But as xor is commutative we can also say that rp5 = par ^ rp4. So no need to keep both rp4 and rp5 around. We can eliminate rp5 (or rp4, but I already foresaw another optimisation). The same holds for rp6/7, rp8/9, rp10/11 rp12/13 and rp14/15.”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjÚh²hubeh}”(h]”Œ analysis-4”ah ]”h"]”Œ analysis 4”ah$]”h&]”uh1hµhh·h²hh³hÊh´Môubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 5”h]”hŒ Attempt 5”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjGh²hh³hÊh´M ubhÝ)�”}”(hŒÂEffectively so all odd digit rp assignments in the loop were removed. This included the else clause of the if statements. Of course after the loop we need to correct things by adding code like::”h]”hŒÁEffectively so all odd digit rp assignments in the loop were removed. This included the else clause of the if statements. Of course after the loop we need to correct things by adding code like:”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M hjGh²hubjk)�”}”(hŒrp5 = par ^ rp4;”h]”hŒrp5 = par ^ rp4;”…”�”}”hjfsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´MhjGh²hubhÝ)�”}”(hŒ|Also the initial assignments (rp5 = 0; etc) could be removed. Along the line I also removed the initialisation of rp0/1/2/3.”h]”hŒ|Also the initial assignments (rp5 = 0; etc) could be removed. Along the line I also removed the initialisation of rp0/1/2/3.”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjGh²hubeh}”(h]”Œ attempt-5”ah ]”h"]”Œ attempt 5”ah$]”h&]”uh1hµhh·h²hh³hÊh´M ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 5”h]”hŒ Analysis 5”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjŠh²hh³hÊh´MubhÝ)�”}”(hŒÖMeasurements showed this was a good move. The run-time roughly halved compared with attempt 4 with 4 times unrolled, and we only require 1/3rd of the processor time compared to the current code in the linux kernel.”h]”hŒÖMeasurements showed this was a good move. The run-time roughly halved compared with attempt 4 with 4 times unrolled, and we only require 1/3rd of the processor time compared to the current code in the linux kernel.”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjŠh²hubhÝ)�”}”(hŒ®However, still I thought there was more. I didn't like all the if statements. Why not keep a running parity and only keep the last if statement. Time for yet another version!”h]”hŒ°However, still I thought there was more. I didn’t like all the if statements. Why not keep a running parity and only keep the last if statement. Time for yet another version!”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjŠh²hubeh}”(h]”Œ analysis-5”ah ]”h"]”Œ analysis 5”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 6”h]”hŒ Attempt 6”…”�”}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¿h²hh³hÊh´M$ubhÝ)�”}”(hŒ-THe code within the for loop was changed to::”h]”hŒ,THe code within the for loop was changed to:”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M&hj¿h²hubjk)�”}”(hXˆfor (i = 0; i < 4; i++) { cur = *bp++; tmppar = cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; par ^= tmppar; if ((i & 0x1) == 0) rp12 ^= tmppar; if ((i & 0x2) == 0) rp14 ^= tmppar; }”h]”hXˆfor (i = 0; i < 4; i++) { cur = *bp++; tmppar = cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; par ^= tmppar; if ((i & 0x1) == 0) rp12 ^= tmppar; if ((i & 0x2) == 0) rp14 ^= tmppar; }”…”�”}”hjÞsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´M(hj¿h²hubhÝ)�”}”(hŒ™As you can see tmppar is used to accumulate the parity within a for iteration. In the last 3 statements is added to par and, if needed, to rp12 and rp14.”h]”hŒ™As you can see tmppar is used to accumulate the parity within a for iteration. In the last 3 statements is added to par and, if needed, to rp12 and rp14.”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MChj¿h²hubhÝ)�”}”(hXWhile making the changes I also found that I could exploit that tmppar contains the running parity for this iteration. So instead of having: rp4 ^= cur; rp6 ^= cur; I removed the rp6 ^= cur; statement and did rp6 ^= tmppar; on next statement. A similar change was done for rp8 and rp10”h]”hXWhile making the changes I also found that I could exploit that tmppar contains the running parity for this iteration. So instead of having: rp4 ^= cur; rp6 ^= cur; I removed the rp6 ^= cur; statement and did rp6 ^= tmppar; on next statement. A similar change was done for rp8 and rp10”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MGhj¿h²hubeh}”(h]”Œ attempt-6”ah ]”h"]”Œ attempt 6”ah$]”h&]”uh1hµhh·h²hh³hÊh´M$ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 6”h]”hŒ Analysis 6”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´MOubhÝ)�”}”(hX}Measuring this code again showed big gain. When executing the original linux code 1 million times, this took about 1 second on my system. (using time to measure the performance). After this iteration I was back to 0.075 sec. Actually I had to decide to start measuring over 10 million iterations in order not to lose too much accuracy. This one definitely seemed to be the jackpot!”h]”hX}Measuring this code again showed big gain. When executing the original linux code 1 million times, this took about 1 second on my system. (using time to measure the performance). After this iteration I was back to 0.075 sec. Actually I had to decide to start measuring over 10 million iterations in order not to lose too much accuracy. This one definitely seemed to be the jackpot!”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MQhjh²hubhÝ)�”}”(hŒ`There is a little bit more room for improvement though. There are three places with statements::”h]”hŒ_There is a little bit more room for improvement though. There are three places with statements:”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MXhjh²hubjk)�”}”(hŒrp4 ^= cur; rp6 ^= cur;”h]”hŒrp4 ^= cur; rp6 ^= cur;”…”�”}”hj=sbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´M[hjh²hubhÝ)�”}”(hŒ«It seems more efficient to also maintain a variable rp4_6 in the while loop; This eliminates 3 statements per loop. Of course after the loop we need to correct by adding::”h]”hŒªIt seems more efficient to also maintain a variable rp4_6 in the while loop; This eliminates 3 statements per loop. Of course after the loop we need to correct by adding:”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M]hjh²hubjk)�”}”(hŒrp4 ^= rp4_6; rp6 ^= rp4_6”h]”hŒrp4 ^= rp4_6; rp6 ^= rp4_6”…”�”}”hjYsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´Mahjh²hubhÝ)�”}”(hX2Furthermore there are 4 sequential assignments to rp8. This can be encoded slightly more efficiently by saving tmppar before those 4 lines and later do rp8 = rp8 ^ tmppar ^ notrp8; (where notrp8 is the value of rp8 before those 4 lines). Again a use of the commutative property of xor. Time for a new test!”h]”hX2Furthermore there are 4 sequential assignments to rp8. This can be encoded slightly more efficiently by saving tmppar before those 4 lines and later do rp8 = rp8 ^ tmppar ^ notrp8; (where notrp8 is the value of rp8 before those 4 lines). Again a use of the commutative property of xor. Time for a new test!”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mdhjh²hubeh}”(h]”Œ analysis-6”ah ]”h"]”Œ analysis 6”ah$]”h&]”uh1hµhh·h²hh³hÊh´MOubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 7”h]”hŒ Attempt 7”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj}h²hh³hÊh´MmubhÝ)�”}”(hŒThe new code now looks like::”h]”hŒThe new code now looks like:”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mohj}h²hubjk)�”}”(hXŒfor (i = 0; i < 4; i++) { cur = *bp++; tmppar = cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; notrp8 = tmppar; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 = rp8 ^ tmppar ^ notrp8; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; par ^= tmppar; if ((i & 0x1) == 0) rp12 ^= tmppar; if ((i & 0x2) == 0) rp14 ^= tmppar; } rp4 ^= rp4_6; rp6 ^= rp4_6;”h]”hXŒfor (i = 0; i < 4; i++) { cur = *bp++; tmppar = cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; notrp8 = tmppar; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; rp8 = rp8 ^ tmppar ^ notrp8; cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; cur = *bp++; tmppar ^= cur; rp6 ^= cur; cur = *bp++; tmppar ^= cur; rp4 ^= cur; cur = *bp++; tmppar ^= cur; par ^= tmppar; if ((i & 0x1) == 0) rp12 ^= tmppar; if ((i & 0x2) == 0) rp14 ^= tmppar; } rp4 ^= rp4_6; rp6 ^= rp4_6;”…”�”}”hjœsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´Mqhj}h²hubhÝ)�”}”(hŒ,Not a big change, but every penny counts :-)”h]”hŒ,Not a big change, but every penny counts :-)”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M‘hj}h²hubeh}”(h]”Œ attempt-7”ah ]”h"]”Œ attempt 7”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mmubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 7”h]”hŒ Analysis 7”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÀh²hh³hÊh´M•ubhÝ)�”}”(hŒ­Actually this made things worse. Not very much, but I don't want to move into the wrong direction. Maybe something to investigate later. Could have to do with caching again.”h]”hŒ¯Actually this made things worse. Not very much, but I don’t want to move into the wrong direction. Maybe something to investigate later. Could have to do with caching again.”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M—hjÀh²hubhÝ)�”}”(hŒˆGuess that is what there is to win within the loop. Maybe unrolling one more time will help. I'll keep the optimisations from 7 for now.”h]”hŒŠGuess that is what there is to win within the loop. Maybe unrolling one more time will help. I’ll keep the optimisations from 7 for now.”…”�”}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M›hjÀh²hubeh}”(h]”Œ analysis-7”ah ]”h"]”Œ analysis 7”ah$]”h&]”uh1hµhh·h²hh³hÊh´M•ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 8”h]”hŒ Attempt 8”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjõh²hh³hÊh´M ubhÝ)�”}”(hŒ Unrolled the loop one more time.”h]”hŒ Unrolled the loop one more time.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M¢hjõh²hubeh}”(h]”Œ attempt-8”ah ]”h"]”Œ attempt 8”ah$]”h&]”uh1hµhh·h²hh³hÊh´M ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Analysis 8”h]”hŒ Analysis 8”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´M¦ubhÝ)�”}”(hXIThis makes things worse. Let's stick with attempt 6 and continue from there. Although it seems that the code within the loop cannot be optimised further there is still room to optimize the generation of the ecc codes. We can simply calculate the total parity. If this is 0 then rp4 = rp5 etc. If the parity is 1, then rp4 = !rp5;”h]”hXKThis makes things worse. Let’s stick with attempt 6 and continue from there. Although it seems that the code within the loop cannot be optimised further there is still room to optimize the generation of the ecc codes. We can simply calculate the total parity. If this is 0 then rp4 = rp5 etc. If the parity is 1, then rp4 = !rp5;”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M¨hjh²hubhÝ)�”}”(hŒxBut if rp4 = rp5 we do not need rp5 etc. We can just write the even bits in the result byte and then do something like::”h]”hŒwBut if rp4 = rp5 we do not need rp5 etc. We can just write the even bits in the result byte and then do something like:”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M®hjh²hubjk)�”}”(hŒcode[0] |= (code[0] << 1);”h]”hŒcode[0] |= (code[0] << 1);”…”�”}”hjIsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´M±hjh²hubhÝ)�”}”(hŒLets test this.”h]”hŒLets test this.”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M³hjh²hubeh}”(h]”Œ analysis-8”ah ]”h"]”Œ analysis 8”ah$]”h&]”uh1hµhh·h²hh³hÊh´M¦ubh¶)�”}”(hhh]”(h»)�”}”(hŒ Attempt 9”h]”hŒ Attempt 9”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjmh²hh³hÊh´M·ubhÝ)�”}”(hXChanged the code but again this slightly degrades performance. Tried all kind of other things, like having dedicated parity arrays to avoid the shift after parity[rp7] << 7; No gain. Change the lookup using the parity array by using shift operators (e.g. replace parity[rp7] << 7 with::”h]”hXChanged the code but again this slightly degrades performance. Tried all kind of other things, like having dedicated parity arrays to avoid the shift after parity[rp7] << 7; No gain. Change the lookup using the parity array by using shift operators (e.g. replace parity[rp7] << 7 with:”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M¹hjmh²hubjk)�”}”(hŒErp7 ^= (rp7 << 4); rp7 ^= (rp7 << 2); rp7 ^= (rp7 << 1); rp7 &= 0x80;”h]”hŒErp7 ^= (rp7 << 4); rp7 ^= (rp7 << 2); rp7 ^= (rp7 << 1); rp7 &= 0x80;”…”�”}”hjŒsbah}”(h]”h ]”h"]”h$]”h&]”jzj{uh1jjh³hÊh´M¿hjmh²hubhÝ)�”}”(hŒNo gain.”h]”hŒNo gain.”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÄhjmh²hubhÝ)�”}”(hŒjThe only marginal change was inverting the parity bits, so we can remove the last three invert statements.”h]”hŒjThe only marginal change was inverting the parity bits, so we can remove the last three invert statements.”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÆhjmh²hubhÝ)�”}”(hX|Ah well, pity this does not deliver more. Then again 10 million iterations using the linux driver code takes between 13 and 13.5 seconds, whereas my code now takes about 0.73 seconds for those 10 million iterations. So basically I've improved the performance by a factor 18 on my system. Not that bad. Of course on different hardware you will get different results. No warranties!”h]”hX~Ah well, pity this does not deliver more. Then again 10 million iterations using the linux driver code takes between 13 and 13.5 seconds, whereas my code now takes about 0.73 seconds for those 10 million iterations. So basically I’ve improved the performance by a factor 18 on my system. Not that bad. Of course on different hardware you will get different results. No warranties!”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÉhjmh²hubhÝ)�”}”(hŒ’But of course there is no such thing as a free lunch. The codesize almost tripled (from 562 bytes to 1434 bytes). Then again, it is not that much.”h]”hŒ’But of course there is no such thing as a free lunch. The codesize almost tripled (from 562 bytes to 1434 bytes). Then again, it is not that much.”…”�”}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÐhjmh²hubeh}”(h]”Œ attempt-9”ah ]”h"]”Œ attempt 9”ah$]”h&]”uh1hµhh·h²hh³hÊh´M·ubh¶)�”}”(hhh]”(h»)�”}”(hŒCorrecting errors”h]”hŒCorrecting errors”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÚh²hh³hÊh´MÕubhÝ)�”}”(hŒpFor correcting errors I again used the ST application note as a starter, but I also peeked at the existing code.”h]”hŒpFor correcting errors I again used the ST application note as a starter, but I also peeked at the existing code.”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M×hjÚh²hubhÝ)�”}”(hŒóThe algorithm itself is pretty straightforward. Just xor the given and the calculated ecc. If all bytes are 0 there is no problem. If 11 bits are 1 we have one correctable bit error. If there is 1 bit 1, we have an error in the given ecc code.”h]”hŒóThe algorithm itself is pretty straightforward. Just xor the given and the calculated ecc. If all bytes are 0 there is no problem. If 11 bits are 1 we have one correctable bit error. If there is 1 bit 1, we have an error in the given ecc code.”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MÚhjÚh²hubhÝ)�”}”(hŒ¾It proved to be fastest to do some table lookups. Performance gain introduced by this is about a factor 2 on my system when a repair had to be done, and 1% or so if no repair had to be done.”h]”hŒ¾It proved to be fastest to do some table lookups. Performance gain introduced by this is about a factor 2 on my system when a repair had to be done, and 1% or so if no repair had to be done.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MßhjÚh²hubhÝ)�”}”(hŒQCode size increased from 330 bytes to 686 bytes for this function. (gcc 4.2, -O3)”h]”hŒQCode size increased from 330 bytes to 686 bytes for this function. (gcc 4.2, -O3)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MãhjÚh²hubeh}”(h]”Œcorrecting-errors”ah ]”h"]”Œcorrecting errors”ah$]”h&]”uh1hµhh·h²hh³hÊh´MÕubh¶)�”}”(hhh]”(h»)�”}”(hŒ Conclusion”h]”hŒ Conclusion”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj+h²hh³hÊh´MèubhÝ)�”}”(hŒÓThe gain when calculating the ecc is tremendous. Om my development hardware a speedup of a factor of 18 for ecc calculation was achieved. On a test on an embedded system with a MIPS core a factor 7 was obtained.”h]”hŒÓThe gain when calculating the ecc is tremendous. Om my development hardware a speedup of a factor of 18 for ecc calculation was achieved. On a test on an embedded system with a MIPS core a factor 7 was obtained.”…”�”}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mêhj+h²hubhÝ)�”}”(hŒoOn a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor 5 (big endian mode, gcc 4.1.2, -O3)”h]”hŒoOn a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor 5 (big endian mode, gcc 4.1.2, -O3)”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mîhj+h²hubhÝ)�”}”(hŒ~For correction not much gain could be obtained (as bitflips are rare). Then again there are also much less cycles spent there.”h]”hŒ~For correction not much gain could be obtained (as bitflips are rare). Then again there are also much less cycles spent there.”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mñhj+h²hubhÝ)�”}”(hXIt seems there is not much more gain possible in this, at least when programmed in C. Of course it might be possible to squeeze something more out of it with an assembler program, but due to pipeline behaviour etc this is very tricky (at least for intel hw).”h]”hXIt seems there is not much more gain possible in this, at least when programmed in C. Of course it might be possible to squeeze something more out of it with an assembler program, but due to pipeline behaviour etc this is very tricky (at least for intel hw).”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Môhj+h²hubhÝ)�”}”(hŒAuthor: Frans Meulenbroeks”h]”hŒAuthor: Frans Meulenbroeks”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mùhj+h²hubhÝ)�”}”(hŒ6Copyright (C) 2008 Koninklijke Philips Electronics NV.”h]”hŒ6Copyright (C) 2008 Koninklijke Philips Electronics NV.”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mûhj+h²hubeh}”(h]”Œ conclusion”ah ]”h"]”Œ conclusion”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mèubeh}”(h]”Œnand-error-correction-code”ah ]”h"]”Œnand error-correction code”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jíŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jÂŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j�jšhÿhüjHjEj�j~jÄjÁjjj–j“jËjÈjòjïjmjjj¢jŸj×jÔjDjAj‡j„j¼j¹j j jzjwj½jºjòjïjjjjjgj×jÔj(j%j•j’uŒ nametypes”}”(j�‰hÿ‰jH‰j�‰jĉj‰j–‰jˉjò‰jm‰j¢‰j׉jD‰j‡‰j¼‰j ‰jz‰j½‰jò‰j‰jj‰j׉j(‰j•‰uh}”(jšh·hühËjEjj~jKjÁj„jjÇj“j jÈj™jïjÎjjjõjŸjpjÔj¥jAjÚj„jGj¹jŠj j¿jwjjºj}jïjÀjjõjgjjÔjmj%jÚj’j+uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”(hŒsystem_message”“”)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhj&ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œline”K.Œsource”hÊuh1j$hjubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhjBubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K/Œsource”hÊuh1j$hjNubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhj]ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K0Œsource”hÊuh1j$hj™ubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhjxubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K1Œsource”hÊuh1j$hjäubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhj“ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K2Œsource”hÊuh1j$hj/ubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhj®ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K3Œsource”hÊuh1j$hjfubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhjÉubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K4Œsource”hÊuh1j$hj ubj%)�”}”(hhh]”hÝ)�”}”(hŒeUnexpected possible title overline or transition. Treating it as ordinary text because it's so short.”h]”hŒgUnexpected possible title overline or transition. Treating it as ordinary text because it’s so short.”…”�”}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhjäubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j?Œline”K5Œsource”hÊuh1j$hjZ ubeŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.