1 / 26

Arquitetura de Sistemas Embarcados

Arquitetura de Sistemas Embarcados. Edna Barros (ensb@cin.ufpe.br) Centro de Informática – UFPE. Introdução. Digital camera chip. CCD. CCD preprocessor. Pixel coprocessor. D2A. A2D. lens. JPEG codec. Microcontroller. Multiplier/Accum. DMA controller. Display ctrl.

josiah
Download Presentation

Arquitetura de Sistemas Embarcados

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Arquitetura de Sistemas Embarcados Edna Barros (ensb@cin.ufpe.br) Centro de Informática – UFPE

  2. Introdução Digital camera chip CCD CCD preprocessor Pixel coprocessor D2A A2D lens JPEG codec Microcontroller Multiplier/Accum DMA controller Display ctrl Memory controller ISA bus interface UART LCD ctrl • Processador • Circuito digital que implementa tarefa computacional • Controle e unidade de processamento • Propósito Geral: variedade de tarefas • Propósito Único: uma tarefa particular • Propósito Único e Customizado: tarefa não padrão • Processador de propósito único customizado: • Rápido, pequeno e baixo consumo • MAS : possui alto custo NRE, time-to-market long e apresenta pouca flexilibidade

  3. Revisão: Projetando um processador de propósito único customizado

  4. Roteiro • Conceitos Básicos • Lógica Combinacional • Lógica Sequencial • Projetando um processador de propósito único

  5. CMOS transistoresem silício source gate Conducts if gate=1 drain 1 gate oxide IC package IC source channel drain Silicon substrate • Transistor • O Componente Básico dos Sistemas Digitais • Atua com chave • Tensãono “gate” controla fluxo de corrente da fonte para o “drain”

  6. Implementações de Transistores CMOS source source gate Conducts if gate=0 gate Conducts if gate=1 drain drain pMOS nMOS 1 1 1 x x y x F = x' y F = (xy)' x F = (x+y)' y 0 x y 0 0 NOR gate inverter NAND gate • Complementary Metal Oxide Semiconductor • Níveis Lógicos • 0 é 0V, 1 é 5V • Dois tipos básicos • nMOS conduz se gate=1 • pMOS conduzse gate=0 • Portas Básicas • Inverter, NAND, NOR

  7. Portas Lógicas Básicas x x F F x x x F F y x F x x x x x x y y y y y y F F F F F F y 0 0 0 1 F y 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 x x x F x F F F y y y F = x y XNOR F = x Driver F = x y AND F = x + y OR F = x  y XOR F = x’ Inverter F = (x y)’ NAND F = (x+y)’ NOR

  8. Projeto de Circuitos Combinacionais B) Truth table C) Output equations D) Minimized output equations Outputs Inputs y bc y = a'bc + ab'c' + ab'c + abc' + abc a b c y z 00 01 11 10 a 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 z = a'b'c + a'bc' + ab'c + abc' + abc 0 1 0 0 1 0 1 1 1 0 y = a + bc z 1 0 0 1 0 bc 00 01 11 10 1 0 1 1 1 a 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 E) Logic Gates z = ab + b’c + bc’ a y b c z A) Problem description y is 1 if a is to 1, or b and c are 1. z is 1 if b or c is to 1, but not both, or if all are 1.

  9. Circuitos Combinacionais A B I1 I0 I(m-1) n n n … n bit, m function ALU S0 n-bit, m x 1 Multiplexor S0 … … S(log m) n S(log m) n O O A B I0 A I(log n -1) B n n … n log n x n Decoder n-bit Adder n-bit Comparator … n O(n-1) O1 O0 carry sum less equal greater O = I0 if S=0..00 I1 if S=0..01 … I(m-1) if S=1..11 less = 1 if A<B equal =1 if A=B greater=1 if A>B O = A op B op determined by S. O0 =1 if I=0..00 O1 =1 if I=0..01 … O(n-1) =1 if I=1..11 sum = A+B (first n bits) carry = (n+1)’th bit of A+B With enable input e  all O’s are 0 if e=0 With carry-in input Ci sum = A + B + Ci May have status outputs carry, zero, etc.

  10. Circuitos Sequenciais I n load shift n-bit Register n-bit Shift register n-bit Counter clear I Q n n Q Q Q = lsb - Content shifted - I stored in msb Q = 0 if clear=1, I if load=1 and clock=1, Q(previous) otherwise. Q = 0 if clear=1, Q(prev)+1 if count=1 and clock=1.

  11. Projeto de Circuitos Sequenciais C) Implementation Model D) State Table (Moore-type) x a Combinational logic I1 I0 Q1 Q0 B) State Diagram Outputs Inputs State register Q1 Q0 a I1 I0 x 0 0 0 0 0 x=1 x=0 a=0 a=0 0 I0 I1 0 0 1 0 1 0 3 a=1 0 1 0 0 1 0 0 1 1 1 0 a=1 a=1 1 0 0 1 0 0 1 0 1 1 1 1 2 1 1 0 1 1 1 a=1 1 1 1 0 0 a=0 a=0 x=0 x=0 A) Problem Description You want to construct a clock divider. Slow down your pre-existing clock so that you output a 1 for every four clock cycles

  12. Projeto de Circuitos Sequenciais E) Minimized Output Equations F) Combinational Logic D) State Table (Moore-type) Q1Q0 I1 00 01 11 10 a 0 0 1 1 a 0 I1 = Q1’Q0a + Q1a’ + Q1Q0’ x 0 1 0 1 1 Q1Q0 I0 00 01 11 10 a Outputs Inputs 0 1 1 0 I1 0 I0 = Q0a’ + Q0’a Q1 Q0 a I1 I0 x 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 1 0 0 x I0 Q1Q0 1 0 1 1 1 00 01 11 10 1 1 0 1 1 a 1 0 0 1 0 1 1 1 0 0 x = Q1Q0 0 0 0 1 0 Q1 Q0 1

  13. Modelo Básico de um Processador de Propósito Único … … external control inputs external data inputs controller datapath … … registers datapath control inputs next-state and control logic controller datapath datapath control outputs functional units state register … … external control outputs external data outputs … … a view inside the controller and datapath controller and datapath

  14. Exemplo: greatest common divisor !1 1: (a) black-box view (c) state diagram 1 !(!go_i) 2: !go_i x_i GCD go_i y_i 2-J: 3: x = x_i d_o 4: y = y_i (b) desired functionality !(x!=y) 5: 0: int x, y; 1: while (1) { 2: while (!go_i); 3: x = x_i; 4: y = y_i; 5: while (x != y) { 6: if (x < y) 7: y = y - x; else 8: x = x - y; } 9: d_o = x; } x!=y 6: x<y !(x<y) y = y -x x = x - y 7: 8: 6-J: 5-J: d_o = x 9: 1-J: • Descreva o algoritmo • Convertao algoritmo para uma FSM complexa • FSMD: finite-state machine with datapath • Templates podem ser usados

  15. Templates de Diagramas de Estado Assignment statement Loop statement Branch statement a = b next statement while (cond) { loop-body- statements } next statement if (c1) c1 stmts else if c2 c2 stmts else other stmts next statement !cond a = b C: C: c1 !c1*!c2 !c1*c2 cond next statement c1 stmts c2 stmts others loop-body- statements J: J: next statement next statement

  16. Criando a Unidade de Processamento !1 1: 1 !(!go_i) 2: !go_i 2-J: 3: x = x_i 4: y = y_i !(x!=y) 5: x!=y 6: x<y !(x<y) y = y -x x = x - y 7: 8: 6-J: 5-J: d_o = x 9: 1-J: • Crie um registrador para cada variável declarada • Crie uma unidade funcional para cada operação aritmética • Faça a conexão dos registradores às unidades funcionais • Baseado nas leituras e escritas • Use multiplexadores para fontes múltiplas • Crie um identificador único para cada saída e entrada da unidade de processamento x_i y_i Datapath x_sel n-bit 2x1 n-bit 2x1 y_sel x_ld 0: x 0: y y_ld != < subtractor subtractor 5: x!=y 5: x!=y 6: x<y 8: x-y 7: y-x x_neq_y x_lt_y 9: d d_ld d_o

  17. Criando um controle baseado em FSM !1 go_i 1: Controller !1 1 !(!go_i) 1: 0000 2: 1 !(!go_i) 0001 2: x_i y_i !go_i !go_i Datapath 2-J: 0010 2-J: x_sel n-bit 2x1 n-bit 2x1 3: x = x_i x_sel = 0 x_ld = 1 0011 3: y_sel x_ld 0: x 0: y 4: y = y_i y_sel = 0 y_ld = 1 y_ld 0100 4: !(x!=y) 5: !x_neq_y 0101 5: != < subtractor subtractor x!=y x_neq_y 5: x!=y 5: x!=y 6: x<y 8: x-y 7: y-x 6: 0110 6: x_neq_y x<y !(x<y) x_lt_y !x_lt_y x_lt_y 9: d y = y -x x = x - y y_sel = 1 y_ld = 1 x_sel = 1 x_ld = 1 7: 8: 7: 8: d_ld 0111 1000 d_o 6-J: 1001 6-J: 5-J: 1010 5-J: d_o = x 9: d_ld = 1 1011 9: 1-J: 1100 1-J: • Mesma estrutura que uma FSMD • Substitua ações complexas por configurações da unid. de processamento

  18. Conectando controle e unidade de processamento x_i y_i (b) Datapath x_sel n-bit 2x1 n-bit 2x1 y_sel x_ld 0: x 0: y y_ld != < subtractor subtractor Controller implementation model 5: x!=y 5: x!=y 6: x<y 8: x-y 7: y-x go_i x_neq_y x_sel Combinational logic y_sel x_lt_y 9: d x_ld d_ld y_ld d_o x_neq_y x_lt_y d_ld Q3 Q2 Q1 Q0 State register I3 I2 I1 I0 go_i Controller !1 1: 0000 1 !(!go_i) 0001 2: !go_i 0010 2-J: x_sel = 0 x_ld = 1 0011 3: y_sel = 0 y_ld = 1 0100 4: x_neq_y=0 0101 5: x_neq_y=1 0110 6: x_lt_y=1 x_lt_y=0 y_sel = 1 y_ld = 1 x_sel = 1 x_ld = 1 7: 8: 0111 1000 1001 6-J: 1010 5-J: d_ld = 1 1011 9: 1100 1-J:

  19. Inputs Outputs Tabela de Estado para o controle do GCD Q3 Q2 Q1 Q0 x_neq_y x_lt_y go_i I3 I2 I1 I0 x_sel y_sel x_ld y_ld d_ld 0 0 0 0 * * * 0 0 0 1 X X 0 0 0 0 0 0 1 * * 0 0 0 1 0 X X 0 0 0 0 0 0 1 * * 1 0 0 1 1 X X 0 0 0 0 0 1 0 * * * 0 0 0 1 X X 0 0 0 0 0 1 1 * * * 0 1 0 0 0 X 1 0 0 0 1 0 0 * * * 0 1 0 1 X 0 0 1 0 0 1 0 1 0 * * 1 0 1 1 X X 0 0 0 0 1 0 1 1 * * 0 1 1 0 X X 0 0 0 0 1 1 0 * 0 * 1 0 0 0 X X 0 0 0 0 1 1 0 * 1 * 0 1 1 1 X X 0 0 0 0 1 1 1 * * * 1 0 0 1 X 1 0 1 0 1 0 0 0 * * * 1 0 0 1 1 X 1 0 0 1 0 0 1 * * * 1 0 1 0 X X 0 0 0 1 0 1 0 * * * 0 1 0 1 X X 0 0 0 1 0 1 1 * * * 1 1 0 0 X X 0 0 1 1 1 0 0 * * * 0 0 0 0 X X 0 0 0 1 1 0 1 * * * 0 0 0 0 X X 0 0 0 1 1 1 0 * * * 0 0 0 0 X X 0 0 0 1 1 1 1 * * * 0 0 0 0 X X 0 0 0

  20. Completando o projeto do Processador de Funcionalidade Ùnica - GCD … … controller datapath registers next-state and control logic functional units state register … … a view inside the controller and datapath • Projeto dos Componentes da Unidade de Processamento • Implementação da lógica combinacional para a unidade de controle • Esta não é uma implementação otimizada mas FUNCIONA

  21. Otimizando processadores de propósito único • Otimização: melhorar métricas de projeto • Oportunidades de Otimização • Especificação inicial • FSMD • Unidade de Processamento • FSM

  22. Otimizando a Descrição Inicial • Análise do programa de forma a identificar possíveis otimizações • Número computações • Tamanho das variáveis • Complexidade de tempo e espaço • Operações usadas

  23. Otimizando o programa original program optimized program 0: int x, y; 1: while (1) { 2: while (!go_i); 3: x = x_i; 4: y = y_i; 5: while (x != y) { 6: if (x < y) 7: y = y - x; else 8: x = x - y; } 9: d_o = x; } 0: int x, y, r; 1: while (1) { 2: while (!go_i); // x must be the larger number 3: if (x_i >= y_i) { 4: x=x_i; 5: y=y_i; } 6: else { 7: x=y_i; 8: y=x_i; } 9: while (y != 0) { 10: r = x % y; 11: x = y; 12: y = r; } 13: d_o = x; } replace the subtraction operation(s) with modulo operation in order to speed up program GCD(42, 8) - 9 iterations to complete the loop x and y values evaluated as follows : (42, 8), (43, 8), (26,8), (18,8), (10, 8), (2,8), (2,6), (2,4), (2,2). GCD(42,8) - 3 iterations to complete the loop x and y values evaluated as follows: (42, 8), (8,2), (2,0)

  24. Otimizando a FSMD • Possíveis otimizações • Merge de Estados • Estados com constantes nas transições podem ser eliminados, transições são conhecidas • Estados com operações independentes podem ser agrupados • Separação de Estados • Estados incluindo operações complexas (a*b*c*d) podem ser quebrados em estados menores • Escalonamento

  25. Otimizando a FSMD (cont.) int x, y; optimized FSMD !1 original FSMD 1: int x, y; 1 Elimina Estado 1 !(!go_i) 2: 2: go_i !go_i !go_i x = x_i y = y_i 2-J: 3: merge estados 2 e 2J x = x_i 3: 5: 4: y = y_i x<y x>y merge estados 3 e 4 y = y -x 8: x = x - y 7: !(x!=y) 5: x!=y 9: d_o = x merge estados 5 e 6 6: x<y !(x<y) y = y -x x = x - y 8: 7: Elimina estados 5J e 6J 6-J: 5-J: Elimina estado 1-J d_o = x 9: 1-J:

  26. Resumo • Processadores de Propósito ÚNICO • Técnicas de projeto • Implementação de Algoritmos • Tipicamente se começa com uma FSMD • Ferramentas de CAD são imprescindíveis

More Related