Comparators priority encoders और code circuits
पहले information की शर्त तय करें
Bit vector किसी संख्या, requests के set या error-detection code को दर्शा सकता है। Interpretation के अनुसार वही gates अलग काम करती हैं। हर circuit में simplification से पहले input क्रम, output अर्थ और सभी allowed inputs का व्यवहार तय करें।
पूर्वज्ञान: Boolean gates, XOR/XNOR, minterms और combinational implementation। अलग बताए बिना signals आदर्श active-high bits हैं और outputs settling के बाद पढ़ते हैं। इस पाठ में unsigned comparator, priority encoder, binary/Gray converters और even-parity circuit हैं। Electrical pinouts, asynchronous synchronization और error-correcting codes शामिल नहीं।
सबसे महत्वपूर्ण अंतर से unsigned comparison
एक bit में X>Y तब XY′=1; X<Y तब X′Y=1; equality X XNOR Y है। कई-bit unsigned words में सबसे ऊपरी अलग position तुलना तय करती है, क्योंकि उसका भार सभी नीचे के भारों के योग से बड़ा है। Equality में हर corresponding pair match होना चाहिए, केवल parity समान नहीं।
दो-bit X=x_1x_0,Y=y_1y_0 में e_1=x_1 XNOR y_1 और e_0=x_0 XNOR y_0 रखें। तब:
EQ=e_1e_0; GT=x_1y_1′+e_1x_0y_0′; LT=x_1′y_1+e_1x_0′y_0.
Low-bit तुलना तभी मायने रखती है जब high bits समान हों। हल किया उदाहरण 1: X=10,Y=01 में high pair 1 बनाम 0 है, इसलिए GT=1, भले low bits 0 बनाम 1 हों। X=10,Y=11 में high bits समान हैं और low pair से LT=1। हर input pair पर EQ,GT,LT में ठीक एक 1 है।
लंबे words में यही संरचना दोहराएँ: lower-position greater term तभी active हो जब सभी ऊपरी pairs match हों। इसे two's-complement ordering पर बिना बदले न लगाएँ। जैसे unsigned में 1000>0111 यानी 8>7, लेकिन signed में −8<7। Signed operands के signs अलग हों तो sign interpretation अलग संभालें।
Ordinary encoder और priority encoder
Ordinary one-hot encoder में ठीक एक asserted input चाहिए, या zero-input case अलग परिभाषित हो। d_3…d_0 वाले one-hot 4-to-2 encoder में asserted input का index output है। y_1=d_3+d_2,y_0=d_3+d_1 की सरल equations उसी सीमित contract में सही हैं। d_2=d_1=1 होने पर वे 11 देती हैं, जो गलत index 3 है: multiple requests one-hot शर्त तोड़ती हैं।
Priority encoder कई requests साथ स्वीकार करता है। Priority d_3 सबसे ऊपर, फिर d_2,d_1,d_0 रखें। v बताए कि कोई request है या नहीं; कोई न हो तो output 00,v=0 तय करें।
| d_3 d_2 d_1 d_0 | v | y_1 y_0 |
|---|---|---|
| 1 X X X | 1 | 11 |
| 0 1 X X | 1 | 10 |
| 0 0 1 X | 1 | 01 |
| 0 0 0 1 | 1 | 00 |
| 0 0 0 0 | 0 | 00 |
यहाँ X lower-priority input के अप्रासंगिक होने का चिन्ह है; ऐसी हर row कई concrete Boolean assignments दर्शाती है। Table से:
v=d_3+d_2+d_1+d_0; y_1=d_3+d_2; y_0=d_3+d_2′d_1.
हल किया उदाहरण 2: requests 0111 में d_2 चुना जाता है, code 10,v=1। d_2′d_1 term, d_2 asserted होने पर lower request दबाता है। अकेला code 00, no request और d_0 जीतने में फर्क नहीं बताता; इस contract में v जरूरी है।
Commercial encoders के inputs, outputs या enable active-low हो सकते हैं। TI SN74HC148 अलग आठ-input component है, जिसकी अपनी polarity/cascade conventions हैं। इस educational table को data sheet जाँचे बिना उसके pins पर लागू न करें।
Binary से reflected Gray code
Reflected binary Gray code में successive count values के codewords ठीक एक bit में अलग होते हैं। यह सीधे जोड़ने वाला unsigned positional numeral नहीं। Binary b_3b_2b_1b_0 के लिए:
g_3=b_3; g_2=b_3⊕b_2; g_1=b_2⊕b_1; g_0=b_1⊕b_0.
हल किया उदाहरण 3: binary 1011 से g_3=1,g_2=1,g_1=1,g_0=0, इसलिए Gray 1110। उलटे conversion में cumulative XOR: b_3=g_3,b_2=b_3⊕g_2,b_1=b_2⊕g_1,b_0=b_1⊕g_0। 1110 से फिर 1011 मिलता है।
दो-bit counting के binary 00,01,10,11 से Gray 00,01,11,10 मिलता है। इसी क्रम को Karnaugh-map axes में लेते हैं। One-bit adjacency केवल consecutive encoded counts के लिए है, मनमाने Gray words के लिए नहीं। इससे अपने आप सुरक्षित clock-domain crossing या physical transition समस्याओं का अभाव सिद्ध नहीं होता।
Even parity बनाना और जाँचना
Even-parity bit p ऐसा चुनें कि data और p में ones की संख्या सम हो। Data x_0…x_(n−1) के लिए p=x_0⊕…⊕x_(n−1)। पूरे codeword का XOR zero है क्योंकि p⊕p=0।
हल किया उदाहरण 4: data 1011 में तीन ones हैं, इसलिए p=1; अंत में जोड़ने पर 10111 में चार ones। Receiver सभी data और parity bits का XOR करता है। Result 1 odd parity बताता है, जो even-parity contract से अलग है। Result 0 केवल parity consistent बताता है; हर bit सही होने की गारंटी नहीं।
एक bit flip से total XOR toggle होता है। इसलिए odd संख्या के flips detect होते हैं; even संख्या parity न बदल सकती है। Single parity-check code में अलग bit positions के हर even संख्या वाले flips parity unchanged रखते हैं। Parity result error की position नहीं बताता, इसलिए अकेले वह single-bit error भी correct नहीं करता।
Word equality को parity comparison से नहीं बदल सकते: 00 और 11 की parity समान है लेकिन words अलग हैं। इसी तरह कुछ output bits होने मात्र से priority code, parity code नहीं बन जाता।
पूरे छोटे circuit की जाँच
दो-bit comparator के सभी 16 input pairs, priority encoder के सभी 16 request vectors और चार-bit converter के सभी 16 inputs enumerate करें। Binary→Gray→binary round trip और successive words का Hamming distance जाँचें। Parity में no error, एक data-bit flip, parity-bit flip और दो अलग flips लें। इतने छोटे exhaustive checks व्यावहारिक हैं और कुछ सामान्य examples से छूटने वाली contract गलतियाँ पकड़ते हैं।
मौलिक अभ्यास
ये छह single-correct MCQ सीखने के लिए बनाए गए मौलिक प्रश्न हैं, पिछले वर्षों के प्रश्न नहीं। हर प्रश्न में ठीक एक विकल्प चुनें।
C01. Unsigned दो-bit X=10,Y=01 के लिए सही तुलना क्या है?
A. X<Y B. X=Y C. X>Y D. दोनों में एक 1 होने से तुलना नहीं कर सकते
उत्तर: C
A गलत है: high bit का भार low bit से बड़ा है।
B गलत है: corresponding bits अलग हैं।
C सही है: unsigned 2, 1 से बड़ा है।
D गलत है: समान parity numerical comparison नहीं रोकती।
C02. Active-high priority encoder में d_3 सबसे ऊपर, फिर d_2,d_1,d_0 हैं। Requests 0111 पर (v,code) क्या हैं?
A. 1,10 B. 1,11 C. 1,01 D. 0,00
उत्तर: A
A सही है: asserted requests में d_2 सबसे ऊपर है और request मौजूद है।
B गलत है: d_3 asserted नहीं।
C गलत है: d_1 की priority d_2 से कम है।
D गलत है: तीन requests हैं, v zero नहीं।
C03. No requests और केवल d_0, दोनों में code 00 हो तो valid bit क्यों चाहिए?
A. Numeric index दोगुना करने के लिए B. OR को XOR बनाने के लिए C. हर output one-hot बनाने के लिए D. दोनों input स्थितियों को अलग पहचानने के लिए
उत्तर: D
A गलत है: validity index scale नहीं करती।
B गलत है: validity अलग information signal है।
C गलत है: output binary encoded ही रहता है।
D सही है: अकेला code no input और index zero अलग नहीं करता।
C04. Binary 1101 का चार-bit reflected Gray code क्या है?
A. 1101 B. 1011 C. 1001 D. 0111
उत्तर: B
A गलत है: conversion के बिना binary copy किया।
B सही है: high 1 रखें; फिर 1⊕1=0,1⊕0=1,0⊕1=1।
C गलत है: तीसरा output bit 1 होना चाहिए।
D गलत है: high Gray bit, high binary bit 1 के बराबर है।
C05. Data 1011 में even parity पाने के लिए कौन-सा parity bit जोड़ना है?
A. 0 B. कोई भी C. 1 D. कोई parity bit काम नहीं कर सकता
उत्तर: C
A गलत है: तीन ones odd रहेंगे।
B गलत है: दो में केवल एक choice total even करती है।
C सही है: तीन data ones और parity 1 से चार ones।
D गलत है: 1 जोड़ने से valid even-parity codeword बनता है।
C06. Single even-parity check में codeword के ठीक दो अलग bits flip हुए। Parity check क्या बताती है?
A. Parity even रहती है, यह error detect नहीं होता। B. Odd parity, error हमेशा detect होता है। C. दोनों flips की exact locations। D. दोनों flips का automatic correction।
उत्तर: A
A सही है: XOR के दो toggles cancel होकर parity रखते हैं।
B गलत है: even flips से मूल parity रहती है।
C गलत है: एक parity bit error locations नहीं बताता।
D गलत है: केवल parity check correction नहीं देता।
सीमा और स्रोत
यह Digital Logic के एक सीमित हिस्से का पाठ है, पूरे GATE CS की तैयारी नहीं। आधिकारिक पाठ्यक्रम केवल विषय की प्रासंगिकता की पुष्टि करता है; व्युत्पत्तियाँ, उदाहरण और अभ्यास मौलिक हैं। तकनीकी संदर्भों से representation और circuit की conventions जाँची गई हैं; उनके अभ्यास प्रश्न नहीं दोहराए गए।
- Official GATE 2027 CS syllabus Section 2
- NPTEL Digital Systems combinational functions and codes
- TI SN74HC148 official priority encoder data sheet
स्रोत 14 अक्टूबर 2026 को जाँचे गए।
प्रगति सहेजने के लिए साइन इन करें। साइन इन