In electronics, a subtractor – a digital circuit that performs subtraction of numbers – can be designed using the same approach as that of an adder. The binary subtraction process is summarized below. As with an adder, in the general case of calculations on multi-bit numbers, three bits are involved in performing the subtraction for each bit of the difference: the minuend (), subtrahend (), and a borrow in from the previous (less significant) bit order position (). The outputs are the difference bit () and borrow bit . The subtractor is best understood by considering that the subtrahend and both borrow bits have negative weights, whereas the X and D bits are positive. The operation performed by the subtractor is to rewrite (which can take the values -2, -1, 0, or 1) as the sum . where ⊕ represents exclusive or. Subtractors are usually implemented within a binary adder for only a small cost when using the standard two's complement notation, by providing an addition/subtraction selector to the carry-in and to invert the second operand. (definition of two's complement notation) The half subtractor is a combinational circuit which is used to perform subtraction of two bits. It has two inputs, the minuend and subtrahend and two outputs the difference and borrow out . The borrow out signal is set when the subtractor needs to borrow from the next digit in a multi-digit subtraction. That is, when . Since and are bits, if and only if and . An important point worth mentioning is that the half subtractor diagram aside implements and not since on the diagram is given by This is an important distinction to make since subtraction itself is not commutative, but the difference bit is calculated using an XOR gate which is commutative. The truth table for the half subtractor is: Using the table above and a Karnaugh map, we find the following logic equations for and : Consequently, a simplified half-subtract circuit, advantageously avoiding crossed traces in particular as well as a negate gate is: X ── XOR ─┬─────── |X-Y|, is 0 if X equals Y, 1 otherwise ┌──┘ └──┐ Y ─┴─────── AND ── borrow, is 1 if Y > X, 0 otherwise where lines to the right are outputs and others (from the top, bottom or left) are inputs.

À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.

Graph Chatbot

Chattez avec Graph Search

Posez n’importe quelle question sur les cours, conférences, exercices, recherches, actualités, etc. de l’EPFL ou essayez les exemples de questions ci-dessous.

AVERTISSEMENT : Le chatbot Graph n'est pas programmé pour fournir des réponses explicites ou catégoriques à vos questions. Il transforme plutôt vos questions en demandes API qui sont distribuées aux différents services informatiques officiellement administrés par l'EPFL. Son but est uniquement de collecter et de recommander des références pertinentes à des contenus que vous pouvez explorer pour vous aider à répondre à vos questions.