BCD digit arithmetic और excess-three conversion
Decimal digits को binary fields में रखना
Representation में हर field का अर्थ तय होना चाहिए। Unsigned 8421 binary-coded decimal (BCD) में हर decimal digit अलग चार binary bits में encode होता है। Valid digit codes 0000 से 1001 हैं। 1010 से 1111 के छह patterns valid BCD digits नहीं, भले सामान्य चार-bit binary integers हों।
पूर्वज्ञान: binary/hex representation,adders,Boolean conditions और multiplexers। BCD तथा excess-three broad syllabus topics के चुने code/arithmetic implementations हैं, अलग named clauses नहीं। यहाँ केवल unsigned decimal digits हैं; packed sign nibbles,decimal floating point और signed decimal subtraction contract के बाहर हैं।
हल किया उदाहरण 1: decimal 73 का BCD 0111 0011 है,एक nibble 7 और एक 3 के लिए। पूरे bit string को unsigned binary integer पढ़ने पर 0x73=115 मिलता है। Decimal 73 का सामान्य आठ-bit binary 01001001 है। Intended संख्या समान हो सकती है,लेकिन encodings के bit patterns interchangeable नहीं।
k BCD digits d_(k−1)…d_0 का मान Σ d_i10^i और storage 4k bits है। 16^k possible patterns में 10^k valid digit strings हैं। दो BCD digits आठ bits में 00…99 रखते हैं:256 में 100 valid patterns। यहाँ leading decimal zeros allowed हैं। चार digits को sixteen bits चाहिए,लेकिन maximum9999 है,65535 नहीं।
Invalid digit पहचानें
Nibble b_3b_2b_1b_0 में values10…15 ठीक तब हैं जब b_3=1 और b_2,b_1 में कम-से-कम एक1 है। इसलिए invalid=b_3 AND(b_2 OR b_1);valid उसका complement है। b_0 validity नहीं बदलता। 8=1000 और9=1001 दोनों valid हैं,भले top bit1 है।
Invalid inputs संभव हों तो error flag या explicit output behavior तय करें। Invalid codes को minimization don't-cares तभी मान सकते हैं जब input contract उन्हें exclude करे। इससे invalid-input detector अपने आप नहीं बनता। Digit adder में valid inputs की शर्त रखेंगे और converter को अलग से सभी sixteen inputs पर define करेंगे।
One-digit BCD addition
a,b valid digits0…9 हों और c_in∈{0,1} incoming decimal carry हो। Exact total t=a+b+c_in,0…19 में है। पहले four-bit binary adder से low nibble z और binary carry k पाएँ,ताकि t=16k+z।
Decimal correction ठीक तब चाहिए जब t≥10। Valid inputs के लिए Boolean signal है:
c_dec = k OR [z_3 AND (z_2 OR z_1)]।
c_dec=1 हो तो z में0110 जोड़कर चार bits रखें;नहीं तो z रखें। Final decimal carry,c_dec है और corrected digit d=(z+6c_dec) mod16। छह क्यों? Binary nibble16 पर wrap करता है,decimal digit10 पर करना चाहिए;16−10=6 दोनों boundaries मिलाता है।
तीन ranges से प्रमाण: t≤9 पर k=0 और बिना correction d=t,c_dec=0। 10≤t≤15 पर z=t;छह जोड़ने से t−10 और carry1 मिलता है। 16≤t≤19 पर k=1,z=t−16;छह जोड़ने से6…9 में t−10 मिलता है,लेकिन second addition में नया carry नहीं। हर case में t=10c_dec+d और0≤d≤9। यही दिखाता है कि केवल correction adder का carry हमेशा final decimal carry नहीं है।
हल किया उदाहरण2:6+7+1=14। First binary sum0 1110 है। z>9 होने से correction:1110+0110=1 0100। Decimal carry1,digit4,अर्थात14 है।
हल किया उदाहरण3:9+8+1=18। First sum1 0010 है,इसलिए k=1 और correction जरूरी है,भले low nibble0010≤9 है। छह जोड़ें:0010+0110=1000। Second adder में carry नहीं,लेकिन decimal carry c_dec=1 रहता है। Final digits1 और8 हैं। केवल z>9 जाँचना या first carry छोड़ना यहाँ गलत होगा।
Decimal carries को cascade करें
Multi-digit adder में units से ऊपर जाएँ और हर c_dec अगले decimal digit में दें। हर stage अपना correction करता है। Final carry एक अतिरिक्त decimal digit जोड़ता है; overflow तभी कहेंगे जब fixed-digit destination बड़ा नहीं हो सकता।
हल किया उदाहरण4:47+58। Units:7+8=15,तो5 रखें और carry1 भेजें। Tens:4+5+1=10,तो0 रखें और carry1 भेजें। Three-digit result105,BCD0001 0000 0101 है। Two-digit destination05 रखता है और final decimal carry1 है;यह105 का exact representation नहीं। पूरे आठ-bit raw sum पर केवल एक correction लगाने से per-digit contract पूरा नहीं होता।
Excess-three को स्पष्ट code conversion मानें
Excess-three में digit d का four-bit code d+3 है। Valid codes zero के लिए0011 से nine के लिए1100 तक हैं। यह8421 BCD नहीं;excess-three code1001 का अर्थ digit6 है,9 नहीं।
| Decimal digit | BCD | Excess-three |
|---|---|---|
| 0 | 0000 | 0011 |
| 1 | 0001 | 0100 |
| 2 | 0010 | 0101 |
| 3 | 0011 | 0110 |
| 4 | 0100 | 0111 |
| 5 | 0101 | 1000 |
| 6 | 0110 | 1001 |
| 7 | 0111 | 1010 |
| 8 | 1000 | 1011 |
| 9 | 1001 | 1100 |
पूरा BCD-to-excess-three circuit,validity detector,b+3 adder और output MUX से बन सकता है। हमारे interface में valid BCD b पर v=1,output b+3;invalid पर v=0,output fixed0011 है। Fixed output घोषित placeholder है,invalid input का numerical अर्थ zero होने का दावा नहीं। Flag इसे valid input zero से अलग करता है। Storage नहीं चाहिए;यह component-level combinational composition है।
Excess-three decode करने को पहले3≤u≤12 जाँचें,फिर u−3 लौटाएँ। हल किया उदाहरण5:BCD0110→1001;unsigned9−3=6 से वापस digit6। सभी चार excess-three bits उलटने से digit का nine's complement मिलता है:15−(d+3)=12−d=(9−d)+3। इसलिए1001 का complement0110,digit3=9−6 का excess-three code है। यह self-complementing गुण decimal digit coding का है,two's-complement signed negation का नहीं।
मुख्य बातें और checking strategy
Multi-digit BCD string को powers of sixteen से न पढ़ें। Invalid digits reject या explicitly define करें। First binary carry,correction-adder carry और decimal carry अलग रखें। सभी10×10×2=200 valid digit-addition cases को t=10c_dec+d से जाँचें। Converter के सभी sixteen inputs,six invalid cases सहित,और दस valid round trips जाँचें। कुछ examples मिलना इन छोटे domains की exhaustive जाँच से कमजोर है।
मौलिक अभ्यास
ये छह single-correct MCQ सीखने के लिए बनाए गए मौलिक प्रश्न हैं, पिछले वर्षों के प्रश्न नहीं। हर प्रश्न में ठीक एक विकल्प चुनें।
C01. Unsigned8421 BCD में decimal73 क्या है?
A. 0100 1001 B. 0111 0011 C. 0111 1010 D. 1001 0011
उत्तर: B
A गलत है: यह ordinary binary73 है,लेकिन BCD digits4,9 हैं।
B सही है: decimal digits7 और3 अलग encode करें।
C गलत है:1010 valid BCD digit नहीं।
D गलत है: BCD digits9,3 से93 मिलता है।
C02. Leading zero सहित आठ bits में कितने valid two-digit unsigned BCD patterns हैं?
A. 256 B. 99 C. 100 D. 200
उत्तर: C
A गलत है:256 में10…15 वाले invalid nibbles भी हैं।
B गलत है:valid00 छूट गया।
C सही है:दो digits के दस-दस choices से10²=100।
D गलत है:digit choices multiply होते हैं,जोड़कर double नहीं।
C03. Valid BCD digits9,8 और c_in=1 में corrected digit,decimal carry और second-adder carry क्या हैं?
A. 8,1,0 B. 2,1,0 C. 8,0,0 D. 2,0,1
उत्तर: A
A सही है:t=18 से k=1,z=2;2+6=8 में second carry नहीं,लेकिन decimal carry1 है।
B गलत है:low nibble correction नहीं किया।
C गलत है:first carry से decimal carry1 जरूरी है।
D गलत है:digit और carry interpretation दोनों गलत हैं।
C04. Two-digit BCD destination में47+58 के retained decimal digits और final decimal carry क्या हैं?
A. 15 और0 B. 05 और0 C. 99 और1 D. 05 और1
उत्तर: D
A गलत है:exact योग105 है,15 नहीं।
B गलत है:05 सही है,पर hundreds carry1 चाहिए।
C गलत है:बताया adder digits रखता है,saturation value नहीं।
D सही है:105 से05 तथा अतिरिक्त hundreds carry1 मिलता है।
C05. Excess-three code1001 के सभी bits उलटें। Result कौन-सा decimal digit है?
A. 6 B. 3 C. 9 D. −6
उत्तर: B
A गलत है:छह original digit है,nine's complement नहीं।
B सही है:complement0110,unsigned6 है;excess-three decode6−3=3।
C गलत है:nine का code1100 है।
D गलत है:यह unsigned decimal-digit code है,signed negation नहीं।
C06. पूरा converter valid BCD b पर(v,b+3) और अन्यथा(0,0011) देता है। Input1010 का output क्या है?
A. (1,1101) B. (1,0011) C. (0,0011) D. Output defined नहीं
उत्तर: C
A गलत है:1010 invalid BCD है,इसलिए valid arithmetic path नहीं।
B गलत है:placeholder सही है,पर v को invalidity बतानी है।
C सही है:invalid=1 AND(0 OR1)=1,इसलिए v=0 और declared placeholder।
D गलत है:contract सभी sixteen input patterns को define करता है।
सीमा और स्रोत
यह Digital Logic के एक सीमित हिस्से का पाठ है, पूरे GATE CS की तैयारी नहीं। आधिकारिक पाठ्यक्रम केवल विषय की प्रासंगिकता की पुष्टि करता है; व्युत्पत्तियाँ, उदाहरण और अभ्यास मौलिक हैं। तकनीकी संदर्भों से representation और circuit की conventions जाँची गई हैं; उनके अभ्यास प्रश्न नहीं दोहराए गए।
- Official GATE 2027 CS syllabus Section 2
- KFUPM original arithmetic circuits lecture: decimal correction convention
- IISc NPTEL decimal code conventions
स्रोत 14 अक्टूबर 2026 को जाँचे गए।
प्रगति सहेजने के लिए साइन इन करें। साइन इन