La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Computadoras de la Arena al Lenguaje C

Presentaciones similares


Presentación del tema: "Computadoras de la Arena al Lenguaje C"— Transcripción de la presentación:

1 Computadoras de la Arena al Lenguaje C
1 Electrónica Digital Computadoras de la Arena al Lenguaje C Ing. Jose Luis Hamkalo

2 Construyendo una Computadora Paso 1: La CPU
EL camino de datos Registros Register file ALU Bus Señales disponibles El ciclo de instrucción Búsqueda (Fetch) Decodificación Ejecución Secuenciamiento de instrucciones Microoperaciones Ejemplos

3 Registro con Salida de Alta Impedancia
D_in_31 D_in_30 D_in_0 D Q D Q D Q Ck Ck Ck R_in R_out D_out_31 D_out_30 D_out_0

4 Transferencias entre Registros por un BUS
Din Ain A Aout Dout Din Bin B Bout Dout BUS Para Copiar el contenido de A en B: Poner Aout y Bin en 1 (las otras en 0)

5 Transferencias entre Registros por un BUS (continuación)
Din Bin B Din Bout Ain Dout A Aout Dout Din Cin C Cout Dout BUS Para Copiar el contenido de A en B y C al mismo tiempo!!!: Poner Aout , Bin y Cin en 1 (las otras en 0)

6 Decodificador Binario
Pone en 1 la salida correspondiente al número binario que se pone en las entradas . El resto de las salidas en 0. Se usa en todas la memorias (RAM)

7 La Unidad Aritmético Lógica (ALU)
Solo hace cálculos (ni más ni menos!): aritméticos, lógicos, comparaciones, etc. Un ejemplo simple: opera sobre 2 bits (a y b) solo hace OR y AND: Ahora hacela de 32 bits y que además sume, reste, multiplique, divida, etc.!!!

8 La Unidad Aritmético Lógica (ALU)
Solo hace cálculos (ni más ni menos!) Pueder haber especializadas y más de una! A B 1 Sumar ALU Restar ... Dividir A+B

9 La Unidad de Control Es un circuito secuencial (Máquina de estado Finito). Recibe un código de operación como entrada y genera una secuencia de señales de control en tiempo en forma. Salida (Señales de Control, i.e. Aout, Bin, SUMAR, etc.) Lógica Combinacional Entrada (código de Operación, i.e sumar, copiar, etc) Estado Unidad de Control

10 Memoria Celdas con información. Se pueden leer o escribir.
Se acceden por su dirección (posición en un arreglo). Tipos RAM ROM (solo lectura) FLASH

11 Memoria Ejemplo RAM de 4 x 2 bits (que chiquita!, quiero una de 4Gbytes!)

12 El Camino de Datos (Data Path)
Poniéndolo todo junto Qué es cada cosa?

13 Tenemos estas Señales REGISTER control signal Effect ALUadd
Configures the ALU to add its inputs ALUand Configures the ALU to bitwise AND its inputs ALUxor Configures the ALU to bitwise eXclusive OR its inputs ALUor Configures the ALU to bitwise OR its inputs ALUsll Configures the ALU to shift left logical; the result is (bus << Y) ALUslt Configures the ALU to compare its inputs; the result is (Y < bus) ALUsrl Configures the ALU to shift right logical; the result is (bus >> Y) ALUsub Configures the ALU to subtract the buss input from Y CONST(value) Places the constant value onto the bus

14 Y estas otras (quiero más!)
IRaddrout Tri-state enables the portion of the Instruction Register that contains the (26 bit, MIPS "J" format) address, along with the top 6 bits of the Program Counter, to be driven onto the bus IRimmedout Tri-state enables the portion of the Instruction Register that contains the (16 bit, MIPS "I" format) 2's complement immediate value to be sign-extended to 32 bits and driven onto the bus IRin Latches the bus data into the Instruction Register at the trailing edge of the clock cycle IRoffsetout Tri-state enables the Instruction Register's shifted and sign extended value from the offset field to be driven onto the bus (used for branches) JUMP(label) Microcode jump to label JUMPonop Microcode jump to label named like the opcode; e.g., if an "Addi" is in the IR, jumps to the microcode label Addi MARin Latches the bus data into the Memory Address Register at the trailing edge of the clock cycle MARout Tri-state enables the Memory Address Register's output to be driven onto the bus

15 y las últimas MDRin Latches the bus data into the Memory Data Register at the trailing edge of the clock cycle MDRout Tri-state enables the Memory Data Register's output to be driven onto the bus MEMread Initiate a memory read from the address in the MAR; here, you may assume that the memory will take 2 clock cycles to respond MEMwrite Initiate a memory write using the data in the MDR and the address in the MAR; in this simple design, you may assume that a memory write takes precisely 1 clock cycle PCin Latches the bus data into the Program Counter at the trailing edge of the clock cycle PCinif0 Only if the value in Z is zero, latch the bus data into the Program Counter at the trailing edge of the clock cycle PCout Tri-state enables the Program Counter's output to be driven onto the bus REGin Latches the bus data into whichever register is selected by SELrs, SELrt, or SELrd; the value is latched at the trailing edge of the clock cycle REGout Tri-state enables the output of whichever register is selected by SELrs, SELrt, or SELrd; the selected value is driven onto the bus SELrs Selects the rs field of the IR to be used to control the register file's decoder SELrt Selects the rt field of the IR to be used to control the register file's decoder SELrd Selects the rd field of the IR to be used to control the register file's decoder UNTILmfc Repeat this state until the memory has issued a memory fetch complete signal, indicating that the fetched value will be valid to read from the MDR in the next clock cycle Yin Latches the bus data into the Y register at the trailing edge of the clock cycle; this register is needed because, with only one bus, one of the two operands for a binary operation (e.g., Add) must come from somewhere other than the bus Yout Tri-state enables the Y register's output to be driven onto the bus Zin The ALU is always producing a result, but we only make note of that result if we latch the ALU's output into the Z register at the trailing edge of the clock cycle Zout Tri-state enables the Z Register's output to be driven onto the bus

16 Como hago una suma?: Paso a Paso (Secuenciamiento de Instrucciones)
Start: PCout, MARin, MEMread, Yin CONST(4), ALUadd, Zin Zout, PCin, UNTILmfc MDRout, Irin, JUMPonop ... Add: SELrs, REGout, Yin SELrt, REGout, ALUadd, Zin Zout, SELrd, REGin, JUMP(Start) -Cada renglón se hace en un ciclo -Las señales dentro de un renglón se hacen al mismo tiempo (en paralelo) -En 7 ciclos logro sumar 2 registros! (El resultado lo guardo en un tercero)

17 Que tipos de instrucciones hay?
Aritmético-Lógicas Acceso a Memoria (Load y Store) Saltos Condicionales Incondicionales Aritméticas de Punto Flotante (FP) Sistema

18 Como vamos por ahora? Una CPU que obtiene sus instrucciones y datos de la memoria. Y es capaz de ejecutarlas!

19 Que Clase de Computadora Queremos?
Computadoras de escritorio PCs y workstations Precio-desempeño óptimo Servidores Web Disponibilad Escalabilidad Procesadores embarcados Desempeño a precio mínimo Mínimo conumo de potencia

20 Un Mouse es un Sistema de Cómputo!
2020 Un Mouse es un Sistema de Cómputo! -Mouse Óptico LED ilumina el escritorio Cámara de baja resol. Procesador básico de Imágenes detecta mov. Botones y rueda. -Supera al mouse mecánico de bolita.

21 Quiero una computadora de alto desempeño: La Arquitectura MIPS 32
Conjunto de instrucciones simple, Load/Store o tipo RISC (pocas instrucciones). Diseñada para eficiencia del pipeline (procesamiento en línea de montaje) Eficiencia para el compilador

22 La Arquitectura MIPS 32 Registros Tipos de datos
2222 La Arquitectura MIPS 32 Registros 32 registros de 32 bits: $0, $1, $2, $31 (int) 32 registros de 32 bits: $f0, $f1, $f2, $f31 (fp) Tipos de datos Bytes (8 bits), Half Word (16 bits), Words (32 bits) Double words (fp) Modos de direccionamiento (Qué?) Inmediato Desplazamiento

23 2323 CPU y FPU de MIPS 32 Para el Sistema (Windows, linux ...)

24 Convención de Uso de Registros
2424 Convención de Uso de Registros Registers Name Number Use Callee must preserve? $zero $0 constant 0 N/A $at $1 assembler temporary No $v0–$v1 $2–$3 values for function returns and expression evaluation $a0–$a3 $4–$7 function arguments $t0–$t7 $8–$15 temporaries $s0–$s7 $16–$23 saved temporaries Yes $t8–$t9 $24–$25 $k0–$k1 $26–$27 reserved for OS kernel $gp $28 global pointer $sp $29 stack pointer $fp $30 frame pointer $ra $31 return address

25 Formatos de Instrucciones MIPS
2525 Formatos de Instrucciones MIPS

26 Instrucción del Tipo I addi
2626 Instrucción del Tipo I addi addi rt, rs, imm regs[rt] ← regs[rs] + imm 31 8 rs rt imm Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

27 Ejemplo Instrucción del Tipo I addi
2727 Ejemplo Instrucción del Tipo I addi regs[1] ← regs[2] + 15 (Hardware) 001000 00010 00001 Op Code fuente destino inmediato Suma el contenido del registro fuente (rs) a una constante y lo guarda en el registro destino (rd)

28 Programando a Nivel de la Máquina
2828 Programando a Nivel de la Máquina Programa en MIPS 32 que calcula la suma de los cuadrados de los numeros de 0 a 100.

29 Programando en Lenguaje Ensamblador
2929 Programando en Lenguaje Ensamblador Da una sintaxis con mnemónicos para las instrucciones, registros y modos de direccionamiento.

30 Instrucción del Tipo I addi
3030 Instrucción del Tipo I addi (Texto) addi rt, rs, imm regs[rt] ← regs[rs] + imm Ensamblado 31 8 rs rt imm (Hardware) Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

31 Ejemplo de addi 3131 (Texto) addi $1, $2, 15 regs[1] ← regs[2] + 15
Ensamblado 001000 00010 00001 (Hardware) Op Code fuente destino inmediato

32 Instrucción del Tipo I: lw
3232 Instrucción del Tipo I: lw (Texto) lw rt, offset(rs) Regs[rt] ← Mem[Regs[rs] + imm] Ensamblado 31 0x23 rs rt Offset (Hardware) Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

33 Ejemplo de lw 3333 (Texto) lw $3, 33($4) Regs[3] ← Mem[Regs[4] + 33]
Ensamblado 31 010111 00100 00011 (Hardware) Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

34 Instrucción del Tipo I: bne
3434 Instrucción del Tipo I: bne bne rs, rt, label if (Regs[rs] ≠ Regs[rt]) then PC ← PC+4+(Offsetx4) (Texto) else PC ← PC+4 Ensamblado 31 5 rs rt Offset (Hardware) Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

35 3535 Ejemplo de bne bne $5, $6, loop if (Regs[5] ≠ Regs[6]) then PC ← PC+4+(-5x4) Loop: else PC ← PC+4 bne $5, $6,-16 31 000101 000110 Op Code fuente destino inmediato (6 bits) (5 bits) (5 bits) (16 bits)

36 Instrucción del Tipo R: add
3636 Instrucción del Tipo R: add (Texto) add rd, rs, rt Regs[rd] ← Regs[rs] + Regs[rt] Ensamblado 31 (Hardware) rs rt rd 0x20 Op Code fuente 1 fuente 2 destino función (6 bits) (5 bits) (5 bits) (5 bits) (6 bits)

37 3737 Ejemplo de add: (Texto) add $7, $8, $ Regs[rd] ← Regs[rs] + Regs[rt] Ensamblado 31 (Hardware) 01000 01001 00111 0x20 Op Code fuente 1 fuente 2 destino función (6 bits) (5 bits) (5 bits) (5 bits) (6 bits)

38 Instrucción del Tipo R: sll
3838 Instrucción del Tipo R: sll (Texto) sll rd, rt, shamt Regs[rd] ← Regs[rt] << shamt Ensamblado 31 (Hardware) rt rd shamt Op Code fuente destino despl. función (6 bits) (5 bits) (5 bits) (5 bits) (6 bits)

39 Instrucción del Tipo J: j
3939 Instrucción del Tipo J: j (Texto) j target pc ← target* Ensamblado 31 (Hardware) 2 target Op Code destino (6 bits) (26 bits)

40 Instrucción del Tipo J: jal
4040 Instrucción del Tipo J: jal (Texto) jal target Regs[31] ← pc pc ← target* Ensamblado 31 (Hardware) 3 target Op Code destino (6 bits) (26 bits)

41 Instrucciones Aritmético Lógicas en MIPS 32
4141 Instrucciones Aritmético Lógicas en MIPS 32 add, addu, addi, addiu, sub and, andi, xor, xori, nor, or, ori clo, clz div (cociente en lo, resto en hi), divu mult, multu (resultado en hi lo) mul (especifica rdest) madd, maddu, msub, msubu (resultado en hi lo) sll, sllv, sra, srav, srl, srlv

42 Instrucciones que Manipulan Constantes y de Comparación
4242 Instrucciones que Manipulan Constantes y de Comparación lui slt, sltu, slti, sltiu,

43 Instrucciones de Branch
4343 Instrucciones de Branch beq bgez, bgezal bgtz blez bltz, bltzal bne

44 4444 Instrucciones de Jump j, jal jr, jalr

45 Instrucciones de carga-almacenamiento
4545 Instrucciones de carga-almacenamiento lb, lbu, lh, lhu, lw sb, sh, sw

46 Instrucciones de Movimiento de Datos
4646 Instrucciones de Movimiento de Datos mfhi, mflo mthi, mtlo movn movz

47 Instrucciones de Llamada al Sistema
4747 Instrucciones de Llamada al Sistema eret syscall break

48 Instrucción que no Hace Nada
4848 Instrucción que no Hace Nada nop

49 Pseudoinstrucciones (Facilidades del Assembler)
4949 Pseudoinstrucciones (Facilidades del Assembler) Name instruction syntax Real instruction translation meaning Move move $rt,$rs addi $rt,$rs,0 R[rt]=R[rs] Clear clear $rt add $rt,$zero,$zero R[rt]=0 Load Address la $at, LabelAddr lui $at, LabelAddr[31:16]; ori $at,$at, LabelAddr[15:0] $at = Label Address Load Immediate li $at, IMMED[31:0] lui $at, IMMED[31:16]; ori $at,$at, IMMED[15:0] $at = 32 bit Immediate value Branch if greater than bgt $rs,$rt,Label slt $at,$rt,$rs; bne $at,$zero,Label if(R[rs]>R[rt]) PC=Label Branch if less than blt $rs,$rt,Label slt $at,$rs,$rt; bne $at,$zero,Label if(R[rs]<R[rt]) PC=Label Branch if greater than or equal bge $rs,$rt,Label slt $at,$rs,$rt; beq $at,$zero,Label if(R[rs]>=R[rt]) PC=Label Branch if less than or equal ble $rs,$rt,Label slt $at,$rt,$rs; beq $at,$zero,Label if(R[rs]<=R[rt]) PC=Label Branch if greater than unsigned bgtu $rs,$rt,Label if(R[rs]=>R[rt]) PC=Label Branch if greater than zero bgtz $rs,$rt,Label if(R[rs]>0) PC=Label Multiplies and returns only first 32 bits mul $1, $2, $3 mult $2, $3; mflo $1 $1 = $2 * $3

50 Programando en Lenguaje Ensamblador (con abstracciones)
5050 Programando en Lenguaje Ensamblador (con abstracciones) Agrega: directivas, labels, pseudoinstrucciones, modos de direccionamiento no soportados por el procesador.

51 Proceso de producir un ejecutable
5151 Proceso de producir un ejecutable

52 Ensamblador Programa que traduce el código assembly a binario.
5252 Ensamblador Programa que traduce el código assembly a binario. Genera como salida un archivo objeto. Archivo objeto generado por un assembler en Unix

53 5353 Modelo de memoria

54 5454 Llamados a Funciones

55 Necesidad de Mayores Abstracciones: Lenguajes de Alto Nivel
5555 Necesidad de Mayores Abstracciones: Lenguajes de Alto Nivel #include <stdio.h> int main() { int i, sum = 0; for(i=0;i<=100;i++) sum = sum + i*i; printf("La suma de es \n%10d",sum); return 0; }

56 5656 El Compilador

57 Generación de un Ejecutable
5757 Generación de un Ejecutable

58 Linker Enlaza los archivos objeto y genera el ejecutable.
5858 Linker Enlaza los archivos objeto y genera el ejecutable. Resuelve las referencias a bibliotecas externas. Asigna las posiciones finales en memoria.

59 Construyendo una Computadora Paso 2: Los Dispositivos de Entrada Salida

60 Sistemas basados en MIPS
6060 Sistemas basados en MIPS Routers Cablemodem ADSL Smart Cards Impresoras laser Decodificadores PlaySation 2 Robots Celulares

61 Arquitectura MIPS presente en los siguientes procesadores
6161 Arquitectura MIPS presente en los siguientes procesadores IDT RC32438; ATI Xilleon; Alchemy Au1000, 1100, 1200; Broadcom Sentry5; RMI XLR7xx, Cavium Octeon CN30xx, CN31xx, CN36xx, CN38xx and CN5xxx; Infineon Technologies EasyPort, Amazon, Danube, ADM5120, WildPass, INCA-IP, INCA-IP2; Microchip Technology PIC32; NEC EMMA and EMMA2, NEC VR4181A, VR4121, VR4122, VR4181A, VR5432, VR5500; Oak Technologies Generation; PMC-Sierra RM11200; QuickLogic QuickMIPS ESP; Toshiba Donau, Toshiba TMPR492x, TX4925, TX9956, TX7901.

62 Supercomputadoras basadas en MIPS.
6262 Supercomputadoras basadas en MIPS. Supercomputadoras Servidores Estaciónes de Trabajo gráficas 1990 1996 2005 Evolución SGI

63 Supercomputadoras basadas en MIPS.
6363 Supercomputadoras basadas en MIPS. SGI Origin 2000

64 Supercomputadoras basadas en MIPS. Sircortex startup (2007)
6464 Supercomputadoras basadas en MIPS. Sircortex startup (2007) Sircortex SC5832 CHIP (nodo): multinucleo 6 MIPS 64 Topologia Kautz graph Controlador de memoria crossbar interconnect DMA engine, Gigabit Ethernet y PCI Express en un chip que consume 10 watts Desempeño pico de 6 Gigaflops. Configuración tope (un solo gabinete): 972 nodos, total de 5832 nucleos MIPS64 y 8.2 teraFLOPS de desempeño pico.

65 Que Micros estamos Usando?
Todos se basan en los principios del que acabamos de estudiar

66 Que Micros estamos Usando?
Múltiples Núcleos Cada Núcleo ejecuta varias instrucciones en un ciclo Memorias Cache Y a una altísima velocidad!!! ( millones de ciclos por segundo)

67 6767 Plataforma Intel 975

68 Ejemplo chipset intel 975

69 6969 FIN El intel 4004, primer microprocesador (1971)


Descargar ppt "Computadoras de la Arena al Lenguaje C"

Presentaciones similares


Anuncios Google