Aula 27 - Contadores (continuação) Prof. Renan Sebem Disciplina de eletrônica digital Departemanto de engenharia elétrica Centro de Ciências Tecnológicas (CCT) Universidade Do Estado de Santa Catarina (UDESC) Joinville-SC Brasil 07 de julho de 2016 ELD0001 Prof. Renan Sebem Aula 27 1 / 25
Itens da aula Avisos Contadores Divisores de frequência Exercícios Exemplos Referências ELD0001 Prof. Renan Sebem Aula 27 2 / 25
Avisos Avisos Lab. da semana que vem está disponível na página do professor. ELD0001 Prof. Renan Sebem Aula 27 3 / 25
Contadores Denições Estado; Módulo; Contador assíncrono; Contador síncrono; Sequência de contagem. ELD0001 Prof. Renan Sebem Aula 27 4 / 25
Contadores Resumo Contadores Síncronos: Caso 1 e 2: FFT e FFD com módulo 2 n ; Caso 3 e 4: FFT e FFD com módulo M; Caso 5: Estado inicial diferente de 0. Contadores Síncronos: Caso 1: FFT e FFD com módulo 2 n ; Caso 2: FFT e FFD com módulo M; Divisores de frequência: Caso 1: Divisão por 2 n ; Caso 2: Divisão por M (fase assimétrica); Caso 3: Divisão por M (fase simétrica). ELD0001 Prof. Renan Sebem Aula 27 5 / 25
Divisores de frequência Exemplo do relógio O ponteiro de segundo tem o período de 1s; O ponteiro de minuto tem o período de 60s; O ponteiro de segundo varia com a frequência de uma vez por segundo; O ponteiro de minuto varia com a frequência de uma vez por 60 segundos; Ou seja, o ponteiro de minuto "conta"até sessenta segundos. ELD0001 Prof. Renan Sebem Aula 27 6 / 25
Divisores de frequência Caso 1 - Divisor de frequência por 2 n Observe que cada coluna à esquerda demora o dobro do número de transições no clock: transições CK Q 3 Q 2 Q 1 Q 0 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 10 1 0 1 0 11 1 0 1 1 12 1 1 0 0 13 1 1 0 1 14 1 1 1 0 15 1 1 1 1 ELD0001 Prof. Renan Sebem Aula 27 7 / 25
Divisores de frequência Caso 1 - Divisor de frequência por 2 n 14.3 Asynchronous Counters 369 FIGURE 14.15. Asynchronous modulo-2 N downward counters: (a) Using TFFs without toggle-enable input; (b) Showing the most common choice for the TFF s internal structure (DFF-based); (c) Same counter, now with a global counter-enable (ena) input; (d) Partial timing diagram. Qual o tipo do contador? the last two. In Figure 14.16(a), q is used instead of q to feed the clock to the next stage. In Figure 14.16(b), negative-edge TFFs are utilized. Equivalent ELD0001 circuits are shown Prof. Renan in Figures Sebem 14.16(c) Aula and 27 (d), but with DFFs 8 / 25
Divisores de frequência Caso 1 - Divisor de frequência por 2 n 370 CHAPTER 14 Sequential Circuits Qual o tipo do contador? Qual a diferença entre este e o circuito anterior? FIGURE 14.16. Asynchronous modulo-2 N upward counters constructed with (a) and (b) TFFs or (c) and (d) DFFs. q 2, and so on. Therefore, there is no risk of accidentally resetting the flip-flops during state transitions. Then all that needs to be done is to monitor the bits that must be '1' when the counter reaches the state ELD0001 Prof. Renan Sebem Aula 27 9 / 25
Divisores de frequência Caso 1 - Divisor de frequência por 2 n 356 CHAPTER 14 Sequential Circuits FIGURE 14.3. Synchronous modulo-2 N counters with (a) parallel enable and (b) serial enable. All flip-flops are positive-edge Qual TFFs, o tipo where do t is a contador? toggle-enable port (Figure 13.24(b)). A partial timing diagram is shown in (c). Qual a diferença entre este e os circuitos anteriores? A partial timing diagram is shown in Figure 14.3(c). It depicts the behavior of the first three stages in ELD0001 Figure 14.3(a), which produce the vector q 2 q 1 q 0, thus Prof. Renan Sebem counting from 0 ("000") Aula 27 10 / 25 to 7 ("111"). Looking at the
Divisores de frequência Caso 1 - Divisor de frequência por 2 n Ou seja: O divisor de frequência por 2 n pode ser implementado a partir de qualquer contador com módulo 2 n. ELD0001 Prof. Renan Sebem Aula 27 11 / 25
Divisores de frequência Caso 2 - Divisão por M com fase assimétrica 14.5 Frequency Dividers 375 FIGURE 14.21. Timing diagram for binary (a) 0-to-4 (M = 5) and (b) 0-to-5 (M = 6) counters. FIGURE 14.22. Timing diagram for a divide-by-9 with symmetric phase. based on the timing diagram of Figure 14.22, where M = 9. Note that the desired signal (q) has transitions at both clock edges, so this is a dual-edge signal generator. One way of obtaining q is by first generating the signal called q a, which stays low during (M 1)/2 clock cycles and high during (M + 1)/2 clock ELD0001 periods. A copy Prof. of Renan this signal, Sebem called qaula b, is 27 then created, which is 12 / 25
Divisores de frequência Caso 2 - Divisão por M com fase assimétrica Divisão por M = contador de módulo M. 14.4 Signal Generators 371 Exemplo: Para divisão da frequência por 6, utiliza-se um contador de módulo M=6 (conta de 0 a 5). (= 6) is reached, causing the counter to return to zero. The corresponding timing diagram is included in Figure 14.17. As can be observed, this approach, though simple, does exhibit a brief glitch when the output value is 6 (the glitch occurs in q 1 ). The time delays are depicted in the inset, where the vertical lines are 1 ns apart (it takes 4 ns for the glitch to occur and it lasts 2 ns). FIGURE 14.17. Asynchronous 0-to-5 counter of Example 14.7. ELD0001 Prof. Renan Sebem Aula 27 13 / 25
Divisores de frequência Caso 2 - Divisão por M com fase simétrica O período do semiciclo em nível lógico igual a zero deve ser igual ao período do semiciclo em nível alto: FIGURE 14.21. Timing diagram for binary (a) 0-to-4 (M = 5) and (b) 0-to-5 (M = 6) counters. FIGURE 14.22. Timing diagram for a divide-by-9 with symmetric phase. based on the timing diagram of Figure 14.22, where M = 9. Note that the desired signal (q) has transitions at both clock edges, so this is a dual-edge signal generator. One way of obtaining q is by first generating the signal called q a, which stays low during (M 1)/2 clock cycles and high during (M + 1)/2 clock periods. A copy of this signal, called q b, is then created, which is one-half of a clock cycle behind q a. By ANDing these two signals, the desired output (q = q a q b ) results. Note that if q a is glitch-free, then q is automatically guaranteed to be glitch-free because q a and q b cannot change at the same time (they operate at different clock edges). This design approach can then be summarized as follows: Suppose that M is odd and that no dualedge DFFs are available. Take a regular (sequential) positive-edge 0-to-(M 1) counter (Sections 14.2 and 14.3) and create a two-window signal (Section 14.4) that stays low during (M 1)/2 clock cycles and ELD0001 Prof. Renan Sebem Aula 27 14 / 25 high during (M + 1)/2 cycles (q in Figure 14.22). Make a copy of this signal into another DFF, operating
Divisores de frequência 356 CHAPTER 14 Sequential Circuits Caso 2 - Divisão por M par com fase simétrica Exemplo: Divisão da frequência por 6; Utiliza-se um contador de 1 a 6; Observa-se no diagrama temporal que a saída Q 2 possui fase simétrica contando de 1 a 6. FIGURE 14.3. Synchronous modulo-2 N counters with (a) parallel enable and (b) serial enable. All flip-flops are positive-edge TFFs, where t is a toggle-enable port (Figure 13.24(b)). A partial timing diagram is shown in (c). A partial timing diagram is shown in Figure 14.3(c). It depicts the behavior of the first three stages in Figure 14.3(a), which produce the vector q 2 q 1 q 0, thus counting from 0 ("000") to 7 ("111"). Looking at the waveforms for q 2, q 1, and q 0 (in that order), we observe the following sequence: "000" "001" "010" "011"... etc. In the first stage of Figure 14.3(a), t 0 is permanently at '1', so the first TFF toggles every time a positive clock transition occurs (highlighted ELD0001 by arrows Prof. Renan in the Sebem clock waveform Aula 27of Figure 14.3(c)), 15 / 25
Divisores de frequência Caso 2376 -CHAPTER Divisão 14 Sequential por Circuits M impar com fase simétrica high during five (q a ) can be easily obtained (as in Example 14.8). Such a signal generator is shown within the dark box in Figure 14.23 with the OR + AND pair processing x (= 3 = "0011" in this case, so q 3 q 2 q 1 q 0 must be monitored) and the NAND + AND pair processing y (= 8 = "1000", so q 3 q 2 q 1 q 0 must be monitored; recall, however, that only the '1's are needed in the counter s last value, so the NAND can be replaced with an inverter). This circuit operates at the rising clock edge and produces q a. A delayed (by one half of a clock period) copy of this signal is produced by the second DFF, which operates at the negative transition of the clock. By ANDing these two signals, the desired waveform (q) results, which is guaranteed to be glitch-free because q a and q b are glitch-free (they come directly from flip-flops), and they can never change at the same time (we will discuss glitches in more detail in Chapter 15 see, for example, Section 15.3). Exemplo: Divisão da frequência por 9; Utiliza-se um contador com M=9 e saídas Q 3 Q 2 Q 1 Q 0 (LSB); Q 3 Q 2 Q 1 Q 0 = 1000 2 = 8 10, é a condição para resetar Q a ; Q 3 Q 2 Q 1 Q 0 = 0011 2 = 3 10, é a condição para setar Q a ; FIGURE 14.23. Divide-by-9 circuit with symmetric phase (0-to-8 counter not shown; signal generator is within dark area). Case 4 Circuits with multiple dividers In certain applications a cascade of frequency dividers are needed. This is the case, for example, when we need to measure time. Suppose, for example, that we need to construct a timer that displays seconds. If f clk = 1 Hz, then a simple counter would do. This, of course, is never the case, because f clk is invariably in the multi-mhz or GHz range (for accuracy and practical purposes). The classical approach in this case is to use two (or more) counters with the first employed to reduce the frequency down to 1 Hz and the other(s) to provide the measurement of seconds. As will be shown in the example below, what the first counter in fact produces is a 1 Hz clock when it is asynchronous or a 1 Hz enable when it is synchronous. ELD0001 Prof. Renan Sebem Aula 27 16 / 25
Exercícios Exercício contador assíncrono Projete um contador assíncrono que conte de 0 a 7. Qual é o módulo? Como ca o circuito com ip-op T? Como ca o circuito com ip-op D? ELD0001 Prof. Renan Sebem Aula 27 17 / 25
Exercícios Exercício contador assíncrono Projete um contador assíncrono que conte de 2 a 7. Qual é o módulo? Como ca o circuito com ip-op T? Como ca o circuito com ip-op D? ELD0001 Prof. Renan Sebem Aula 27 18 / 25
Exercícios Exercício contador síncrono Projete um contador síncrono que conte de 4 a 8. Qual é o módulo? Como ca o circuito com ip-op T? Como ca o circuito com ip-op D? ELD0001 Prof. Renan Sebem Aula 27 19 / 25
Exemplos Exemplos do livro Estes exemplos possuem resolução de três maneiras diferentes: 14.1=14.2 14.3 14.5 ELD0001 Prof. Renan Sebem Aula 27 20 / 25
Exemplos Contador síncrono com sequência arbitrária Exemplo - Projete um contador síncrono com a seguinte sequência: transições CK Q 3 Q 2 Q 1 Q 0 0 0 0 0 0 1 0 0 0 1 14 1 1 1 0 9 1 0 0 1 12 1 1 0 0 2 0 0 1 0 7 0 1 1 1 5 0 1 0 1 ELD0001 Prof. Renan Sebem Aula 27 21 / 25
Exemplos Divisor de frequência por M par com fase simétrica Projete um divisor de frequência por M=10 com fase simétrica. Desenhe um diagrama contendo o clock original e o clock de saída desejado. ELD0001 Prof. Renan Sebem Aula 27 22 / 25
Exemplos Divisor de frequência por M impar com fase simétrica Projete um divisor de frequência por M=5 com fase assimétrica. Desenhe um diagrama contendo o clock original e o clock de saída desejado. ELD0001 Prof. Renan Sebem Aula 27 23 / 25
Referências [1] Mairton de Oliveira Melo. Eletrônica Digital Teoria e Laboratório. Editora Udesc, 2002. [2] Volnei Pedroni. Digital electronics and design with VHDL. Morgan Kaufmann, 2008. ELD0001 Prof. Renan Sebem Aula 27 24 / 25
Aula 27 - Contadores (continuação) Prof. Renan Sebem Disciplina de eletrônica digital Departemanto de engenharia elétrica Centro de Ciências Tecnológicas (CCT) Universidade Do Estado de Santa Catarina (UDESC) Joinville-SC Brasil 07 de julho de 2016 Obrigado. ELD0001 Prof. Renan Sebem Aula 27 25 / 25