Un circuito codificador

download Un circuito codificador

of 11

Transcript of Un circuito codificador

  • 8/3/2019 Un circuito codificador

    1/11

    n circuito codificador, simplemente hace eso, codifica, posee d entradas de datos, n entradas de

    seleccin y 2^n salidas con la combinacin codificada, por ejemplo para pasar de un cdigo BCD a uno 7

    Segmentos, se utiliza un codificador, si lo piensas a la inversa, ves el funcionamiento de undecodificador, lo que ya est codificado lo pasas nuevamente al cdigo de donde sali, en este caso lo

    que sale como un cdigo para representar un dgito en un display 7 segmentos imginalo como entrada a

    un decodificador, en donde del cdigo de 7 segmentos se vuelve a un cdigo BCD, el mismo utilizado

    como dato en la codificacin.

    Un multiplexor tiene n entradas de seleccin, 2^n entradas de datos y una salida. Lo que se puede hacer

    con uno de estos circuitos combinatorios es elegir poniendo una cierta combinacin de bits en las n

    entradas de seleccin, una de las 2^n entradas de datos, para que esta sea la que salga por la lnea de

    salida, imagina un conmutador telefnico, tienes 32 lineas de telfono a pasar por un solo cable, tonces,

    imagina que seleccionas la lnea 24 (11000 en base 2), entonces el dato que se encuentre en la entrada

    de datos nmero 24 saldr por la salida de ese multiplexor. Ahora bien, al igual que en el caso delcodificador y el decodificador, imagina que a la salida del multiplexor pones un demultiplexor. Un

    demultiplexor cuenta con n entradas de seleccin, 1 entrada de datos, y 2^n salidas. En este caso, las

    entradas de seleccin sern las que digan por que salida va a salir el dato de la lnea de datos,

    supongamos que ponemos el mismo ejemplo que con el multiplexor, ponemos un 24 en binario en las

    entradas de control e ingresamos un bit por la l inea de datos, este ir a salir por la salida 24 del

    demultiplexor.

    Los circuitos aritmticos como los sumadores/restadores, comparadores, registros de despazamiento, se

    utilizan, en una computadora en la unidad aritmticologica de la unidad central de proceso. All es donde

    por medio de la unidad de control llegan instruccines para llevar a cabo una u otra tarea, es en este

    lugar en donde se le da uso a estos circuitos. Suponte que haces una suma de dos nmeros binarios en

    la ALU (unidad aritmticologica) y obtienes un resultado, all utilizastes un sumador, y ese resultadoactivar una serie de flags de una palabra de estado en donde se indicar que fue lo que paso, si el

    resultado di cero, si hubo desborde, si ha ocurrido algn acarreo, etc. Pero tambin podras haber

    hecho una operacin de multiplicar por dos, all puede que se use un registro de desplazamiento y lo que

    se hace es desplazar hacia la derecha la palabra compuesta de 1's y 0's que se halla ingresado para

    multiplicar por dos, fijate que de esta forma ests multiplicando por la base del sistema de numeracin,

    que en este caso es el binario, o sea por dos, ocurre lo mismo cuando en el nuestro, el que usamos

    siempre, el sistema decimal, multiplicas por diez, lo que haces es correr la coma hacia la derecha un

    lugar, bueno internament cuando multiplicas por dos o divides por dos, la unidad aritmticolgica puede

    estar desplazando a derecha o aizquierda segun cada caso.

    Bsicamente eso, hay muchisimo para hablar de este tema pero bueno espero haberte dado una

    explicacin ms o menos entendible y razonable de todo esto. No dudes en consultar libros de este tipo,

    libros de sistemas digitales, hay muy buenos, Wakerley es uno que us yo mucho tiempo, al igual que el

    de Milles Murdocca, etc. Nunca te quedes con una duda sobre este tema, si es lo que estas estudiando

    siempre debes llegar hasta lo ltimo, es un tema simple, pero sino te quedan claros los conceptos, a

    medida que avanzas todo se te har muy dificil de hilar.

  • 8/3/2019 Un circuito codificador

    2/11

    PDF

    Half Adders, Full Adders, Ripple Carry

    Adders

    2003 by Charles C. Lin. All rights reserved.

    Introduction

    At the very least, most people expect computers to do some kind of arithmetic

    computation, and thus, most people expect computers to add.

    We're going to construct combinational logic circuits that perform binary addition.The first question you should ask when adding binary numbers, given all the time

    we've spent talking about representation is "what representation are we talking

    about"?

    Clearly the choice of representation is going to affect how we perform the addition.

    Certain representations allow us to add in the way we add base ten numbers. So,

    initially, we assume UB representation.

    First, let's consider adding two 3-bit UB numbers.

    1 1 0+ 0 1 1-----------

    Most of add numbers right to left. We start at the rightmost column (the least

    signifcant bit) and work our way to the left.

    1 1 0

  • 8/3/2019 Un circuito codificador

    3/11

    + 0 1 1-----------

    1As we add, we may need to carry. We add 0 to 1. What should we carry? You mightanswer "Nothing". Technically, you don't have to carry anything. However, hardwareisn't so simple. In general, once you decide there is an output (such as carry), you need

    to generate that output all the time. Thus, we need to find a reasonable carry, even

    when there's "no need" to carry.

    In this case, a reasonable carry is to carry a 0, into the next column, and then add thatcolumn.

    01 1 0

    + 0 1 1-----------0 1

    This time, when we add the middle column, we get 0 + 1 + 1 which sums to 0, with a

    carry of 1.

    1 01 1 0

  • 8/3/2019 Un circuito codificador

    4/11

    + 0 1 1-----------(1) 0 0 1

    The final (leftmost) column adds 1 + 1 + 0, which sums to 0, and also generates a

    carry. We put the carry in parentheses on the left.

    Typically, when we perform an addition of two k-bit numbers, we expect the answer

    to be k-bits. If the numbers are represented in UB, the result can be k+1 bits. To

    handle that case, we have a carry bit (the one written in parentheses above).

    Building Blocks: Half Adders

    As you look at how numbers are added, it seems to be added column by column.

    While we might create an addition circuit which adds two 3-bit values at once, it

    might not allow us to generalize to adding two k-bit values.

    It makes some sense to design a circuit that adds in "columns". To begin, let'sconsider adding the rightmost column. We're adding two bits. So, the adder we want

    to create should have two inputs bits. It generates a sum bit for that column, plus a

    carry. So there should be two bits of output.

    This device is called a half-adder. I have no idea why, except that it can't really be

    used to (easily) build k-bit adders.

    y Data inputs: 2 (call them x and y)

    y Outputs: 2 (call them s, for sum, and c, for carry)

    Here's a truth table for half adders.

    Row x y c s

    0 0 0 0 0

    1 0 1 0 1

    2 1 0 0 1

  • 8/3/2019 Un circuito codificador

    5/11

    3 1 1 1 0

    Let's see what's happening. Look at row 3. We add x + y = 1 + 1. This has a sum of 0,

    and a carry of 1.

    Writing a Boolean Expression

    The first step to converting a truth table to a circuit is to write a Boolean expression.

    We use the same technique as before. Identify rows with 1, and create a minterm. This

    doesn't always produce a minimal expression, but at least it produces an expression

    without too much work.

    c = xys = \xy + x\y

    = x XOR yAgain, we use multiplication to denoteAND2and addition to denoteOR2.

    Drawingthe Circuit

    The next step is to draw the circuit. First, we draw it as a black box.

    Then, we add the detail of the circuits.

  • 8/3/2019 Un circuito codificador

    6/11

    In this circuit above, you see an AND2 gate and an XOR2 gate.

    Building Blocks: Full Adders

    The problem with a half-adder is that there it doesn't handle carries. When you look at the left

    column of the addition

    1 0

    1 1 0+ 0 1 1-----------(1) 0 0 1

    you see that you add three bits. Half adders only add two bits.

    We need a circuit that can add three bits. That circuit is called afulladder.

    Here are the characteristics of a full adder.

    y Data inputs: 3 (call them x, y, and cin, for carry in)

    y Outputs: 2 (call them s, for sum, and cout, for carry out)

  • 8/3/2019 Un circuito codificador

    7/11

    Notice we now need to make a distinction whether the carry is an input (cin) or an

    output (cout). Carry in's in column i are due to carry outs from column i - 1(assuming

    we number columns right to left, starting at column 0 at the least significant bit).

    Here's a truth table for full adders.

    Row x y cin cout s

    0 0 0 0 0 0

    1 0 0 1 0 1

    2 0 1 0 0 1

    3 0 1 1 1 0

    4 1 0 0 0 1

    5 1 0 1 1 0

    6 1 1 0 1 0

    7 1 1 1 1 1

    Exercise

    As an exercise, write out the Boolean expressions forcoutands. Draw the circuit, too.

    Ripple Carry Adders

    Once you have half adders and full adders, you can now construct ripple carry adders.

    A ripple carry adder allows you to add two k-bit numbers. We use the half adders and

    full adders and add them a column at a time.

    Let's put the adder together one step at a time.

    Before Adding

  • 8/3/2019 Un circuito codificador

    8/11

    Adding Column0

    We addx0toy0, to producez0.

    Adding Column 1

    In column 1, We addx1toy1andc1and, to producez1, andc2, whereciis the carry-in forcolumniandci + 1is the carry-out of columni.

  • 8/3/2019 Un circuito codificador

    9/11

    Adding Column 2

    In column 2, We addx2toy2andc2and, to producez2, andc3.

    Using Only Full Adders

    We don't really need to use the half adder. We could replace the half adder with a full adder, witha hardwired 0 for the carry in.

  • 8/3/2019 Un circuito codificador

    10/11

    Delay

    We know that combinational logic circuits can't compute the outputs instantaneously. There is

    some delay between the time the inputs are sent to the circuit, and the time the output iscomputed.

    Let's say the delay is T units of time.

    Suppose you want to implement an n-bit ripple carry adder. How much total delay is

    there?

    Since an n-bit ripple carry adder consists ofn adders, there will be a delay ofnT.

    This is O(n) delay.

    Why is there this much delay? After all, aren't the adders working in parallel?

    While the adders are working in parallel, the carrys must "ripple" their way from the

    least significant bit and work their way to the most significant bit. It takes T units for

    the carry out of the rightmost column to make it as input to the adder in the next to

    rightmost column.

    Thus, the carries slow down the circuit, making the addition linear with the number of

    bits in the adder.

    This is not a big problem, usually, because hardware adders are fixed in size. They

    add, say, 32 bits at a time. There's no way to make an adder add an arbitrary number

  • 8/3/2019 Un circuito codificador

    11/11

    of bits. It can be done in software, not in hardware. In effect, this is what makes

    hardware "hard". It's not flexible to change.

    Even though there are a fixed number of bits to add in an adder, there are ways to

    make the adder add more quickly (at least, by a constant).

    Carry lookahead adders add much faster than ripple carry adders. They do so by

    making some observations about carries. We will look at this at a later set of notes.