ELEMENTOS Y TIPOS DE DATOS



Documentos relacionados
Diseño Lógico I Facultad de Ciencias Exactas y Tecnología UNT. LENGUAJES DE DESCRIPCIÓN DE HARDWARE

VHDL. Lenguaje de descripción hardware Tipos de datos

Elementos léxicos del lenguaje de programación Java

PRÁCTICA: LENGUAJE VHDL

Tema 3 Elementos básicos de programación

VHDL: Tipos de datos. Arquitectura del Computador 2017

Sistemas de numeración, operaciones y códigos.

Tipos de datos en VHDL

Electrónica Digital Departamento de Electrónica VHDL. Bioingeniería Facultad de Ingeniería - UNER

Objetos de VHDL. Un objeto en VHDL es un elemento que contiene un valor de tipo específico de dato

ACTIONSCRIPT (AS) Proyectos II. Audiovisuales. Dpto. Escultura. UPV. [sintaxis elemental]

Tema 2. El lenguaje de programación Java (Parte 1)

TEMA 1 Representación de la información

Objetos de VHDL.! Un objeto en VHDL es un elemento que contiene. un valor de tipo específico de dato

Capítulo 1: Sistemas de representación numérica Introducción. Dpto. de ATC, Universidad de Sevilla - Página 1 de 8


3.1 Introducción a VHDL

Materia Introducción a la Informática

Representación de la Información

4. SUMADORES EN BINARIO PURO (I)

Introducción a la Programación 11 O. Humberto Cervantes Maceda

9. Dibujar el diagrama de tiempos de las siguientes asignaciones de señales.

Unidad de trabajo 2: INFORMÁTICA BÁSICA (primera parte)

Naturaleza binaria. Conversión decimal a binario

Operadores y atributos en VHDL [1]

TEMA 2. Agenda. Fundamentos de JAVA

Práctica I Modelado y simulación de una máquina expendedora de refrescos

1. Informática e información. 2. Sistemas de numeración. 3. Sistema binario, operaciones aritméticas en binario, 4. Sistemas octal y hexadecimal. 5.

Clase 02: Representación de datos

!!!!!!!! !!!!! Práctica!4.! Programación!básica!en!C.! ! Grado!en!Ingeniería!!en!Electrónica!y!Automática!Industrial! ! Curso!2015H2016!

CONCEPTOS BASICOS DEL LENGUAJE JAVA

Por ejemplo convertir el número 131 en binario se realiza lo siguiente: Ahora para convertir de un binario a decimal se hace lo siguiente:

Diseño VHDL de módulos combinacionales básicos

Fundamentos de Informática 1er curso de ingeniería Industrial. Tema 2. Datos. Tema 2. Datos

INSTITUTO POLITÉCNICO NACIONAL ESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA INGENIERIA EN COMUNICACIONES Y ELECTRÓNICA ACADEMIA DE COMPUTACIÓN

INFORMÁTICA. Práctica 5. Programación en C. Grado en Ingeniería en Electrónica y Automática Industrial. Curso v1.0 (05.03.

Arrays y Cadenas en C

Tema 2. La Información y su representación

SINTAXIS BÁSICA DEL VHDL SIMPLIFICADO

Simulación avanzada con TestBench en HDL. Ing. Andrés Miguel Airabella. Ing. Facundo Aguilera.

LABORATORIO DE ARQUITECTURA DE COMPUTADORES. I. T. I. SISTEMAS / GESTIÓN GUÍA DEL ALUMNO

PL/SQL. Con PL/SQL vamos a poder programar las unidades de programa de la base de datos Oracle:

Sistemas de Numeración Operaciones - Códigos

1 ELEMENTOS BASICOS DEL LENGUAJE

Capítulo 2 REPRESENTACIÓN DE LOS DATOS. Presentación resumen del libro: "EMPEZAR DE CERO A PROGRAMAR EN lenguaje C"

4.3. Lenguaje VHDL Declaración de Packages

INGENIERÍA DE COMPUTADORES 3. Solución al Trabajo Práctico - Junio de 2013

VI. Especificación del Comportamiento

21/02/2012. Agenda. Unidad Central de Procesamiento (CPU)

Estructura de Datos. Unidad I Tipos de Datos

2.4. Modos de direccionamiento Distintas formas que tiene la arquitectura para especificar la ubicación de los operandos.

CONTADORES. Definición. Diseño y analisis de un contador binario hacia arriba de 3 bits con flip-flops JK. Otros contadores típicos.

Operaciones y Expresiones METATRADER, CONCEPTOS BÁSICOS DE PROGRAMACIÓN III

Identificadores, palabras reservadas, tipos de datos, operadores aritméticos y el sistema estándar de salida en Java

En la actualidad ASCII es un código de 8 bits, también conocido como ASCII extendido, que aumenta su capacidad con 128 caracteres adicionales

Curso PHP Módulo 1 R-Luis

TEMA II REPASO. SISTEMAS DE NUMERACIÓN USUALES EN INFORMÁTICA.

INFORMÁTICA. Matemáticas aplicadas a la Informática

PRACTICA 3. Lenguaje de descripción de hardware VHDL.

INFORME LABORATORIO No.1 Implementación de sistemas combinacionales en VHDL Diseño de una ALU. Nelson Antonio Becerra Carrillo

EJERCICIOS DEL TEMA 1

Representación de Datos. Una Introducción a los Sistemas Numéricos

by Tim Tran:

TEMA II: REPRESENTACIÓN DE LA INFORMACIÓN

TECNOLOGÍA 4º ESO Realizando la lectura como indica la flecha obtenemos: 20 10) = ) Lectura

El sistema decimal, es aquél en el que se combinan 10 cifras (o dígitos) del 0 al 9 para indicar una cantidad específica.

Tema 2. Funciones Lógicas. Algebra de Conmutación. Representación de circuitos digitales. Minimización de funciones lógicas.

Programa Java. El lenguaje de programación Java. Comentarios. Programa Java. Palabras reservadas. Identificadores

1. SISTEMAS DIGITALES

Primeros conmutadores: diodos de cristal y de tubos de vacío (1906). Transistor (TRT): más pequeño y fiable, de material semiconductor (1950).

Representación de Datos. Representación de datos numéricos. Representación de datos caracteres. Representación de otros tipos de datos

UD 1. Representación de la información

Código concurrente en VHDL [5]

Tema 1 - Sistemas numéricos y códigos

SITEMA BINARIO, OCTAL Y HEXADECIMAL: OPERACIONES

Sistemas Digitales - Examen temas 1, 2 y 3 - (6 de Abril 2016)

Unidad I. 1.1 Sistemas numéricos (Binario, Octal, Decimal, Hexadecimal)

Operaciones Aritméticas en Números con Signo

Sistemas Digitales - Examen temas 1, 2 y 3 - (6 de Abril 2016)

CODIFICADORES CON PRIORIDAD. Grupo 2

FUNCIONAMIENTO DIGITAL DE UN SISTEMA. EL SISTEMA BINARIO. Sistema Digital. Fr. Casares. Sistema Digital. Sistema Digital

Tema 3 - Modelado con HDL a nivel RTL

OR (+) AND( ). AND AND

Práctica 6. Diseño Lógico Digital mediante VHDL

TEMA 1: SISTEMAS INFORMÁTICOS. Parte 2: representación de la información

Escuela Politécnica Superior de Ingeniería Departamento de Ingeniería Informática

Conceptos básicos: 1,2 puntos

Modulo 1 El lenguaje Java

Capítulo. Cálculos con números binarios, octales, decimales y hexadecimales

DESARROLLO DE HABILIDADES DEL PENSAMIENTO LÓGICO

Introducción a los Sistemas Digitales

Los sistemas de numeración se clasifican en: posicionales y no posicionales.

ANEXO 2: REPRESENTACION DE LA INFORMACION EN LOS COMPUTADORES

Anexo B. Comunicaciones entre mc y PC

Examen final de CL 11 de Enero de 2012 Fecha de publicación de notas: Fecha de revisión:

SISTEMAS NUMERICOS CAMILO ANDREY NEIRA IBAÑEZ UNINSANGIL INTRODUCTORIO A LA INGENIERIA LOGICA Y PROGRAMACION

Transcripción:

1 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS Y TIPOS DE DATOS Elementos Tipos de datos Librerías Std_logic y Std_logic_vector

2 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS Elementos del VHDL: Comentarios Palabras reservadas. Identificadores Símbolos especiales Números Caracteres Cadenas y cadenas de bits.

3 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS: Comentarios y palabras reservadas Comentario: - Línea de comentario comienza con --. - Ejemplo: -- Esto es un comentario. Palabras reservadas: - Reservadas para uso específico del lenguaje. - No pueden ser usados para definir identificadores.

4 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS: Identificadores Identificadores: - Utilizados por usuario para nombrar objetos. - Se deben usar nombres que indiquen su propósito. - Pueden ser de cualquier longitud. - Reglas: 1. Deben empezar con una letra del alfabeto. 2. Pueden contener: - Letras del alfabeto ( A Z, a z ) - Números decimales ( 0 9 ). - Caracteres _. 3. No pueden terminar en _. 4. No pueden tener _ sucesivos.

5 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS: Símbolos especiales Símbolos especiales - Operadores: + - * / & ( ) = > < - Delimitan partes de las construcciones: # ` [ ] - Delimitadores léxicos:., ; : - Símbolos con dos caracteres: := => /= >= <= **

6 ELEMENTOS Y TIPOS DE DATOS Operadores Operadores lógicos and or nand nor xor not xnor Operadores relacionales = /= < <= > >= Precedencia de operadores Highest Lowest not = /= < <= > >= and or nand nor xor xnor

7 ELEMENTOS Y TIPOS DE DATOS Concatenación de vectores signal A: STD_LOGIC_VECTOR(3 downto 0); signal B: STD_LOGIC_VECTOR(3 downto 0); signal C, D, E: STD_LOGIC_VECTOR(7 downto 0); A <= 0000 ; B <= 1111 ; C <= A & B; -- C = 00001111 D <= 0 & 0001111 ; -- D <= 00001111 E <= 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 ; -- E <= 00001111

8 ELEMENTOS Y TIPOS DE DATOS Rotación de vectores.

9 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS: Números Números Dos tipos: Entero y real. Ambos tipos pueden ser representados en notación exponencial (46E5, 1.34E5).

10 ELEMENTOS Y TIPOS DE DATOS ELEMENTOS: Caracteres, cadenas y cadenas de bits Caracteres - Escritos entre comillas. Ejemplo: A, z. Cadenas: - Escritos entre doble comilla. Ejemplo: abcdefg, 123456. - Operación de concatenación con &. Ejemplo: abc & def => abcdef. Cadenas de bits: - Cadenas de números binarios, octales o hexadecimales. - Escritos entre doble comilla y precedidos de la base: B 10000, O 20, X 10.

11 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS. VHDL es un lenguaje basado en tipos de datos. Cada tipo determina las operaciones que pueden ser realizadas. Tipos pre-definidos: Integer Floating-point Physical Enumeration Array Record El usuario puede definir nuevos tipos.

12 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS. Types Access Composite Scalar Array Record Integer Real Enumerated Physical

13 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Integer Tipo predefinido para representar números enteros. Lenguaje estándar: Números en el rango: -2 31 1 2 31 1 El usario puede definir un sub-rango diferente:

14 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Integer Ejemplo: ARCHITECTURE test_int OF test IS BEGIN PROCESS (X) VARIABLE a: INTEGER; BEGIN a := 1; -- OK a := -1; -- OK a := 1.0; -- illegal END PROCESS; END test_int;

15 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Integer, operaciones Suma: + Resta o negación: - Multiplicación: * División: / Módulo: mod (-5) mod 3 = 1 Resto: rem (-5) rem 3 = -2 Valor absoluto: abs Exponenciación: ** Lógicos: =, /=, <, >, <=, >=

16 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Floating-Point Tipo predefinido para representar números en punto flotante. El usario puede definir un sub-rango diferente:

17 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Floating-Point Ejemplo: ARCHITECTURE test_real OF test IS BEGIN PROCESS (X) VARIABLE a: REAL; BEGIN a := 1.3; -- OK a := -7.5; -- OK a := 1; -- illegal a := 1.7E13; -- OK a := 5.3 ns; -- illegal END PROCESS; END test_real;

18 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Floating-Point, operaciones Suma: + Resta o negación: - Multiplicación: * División: / Valor absoluto: abs Exponenciación: ** Lógicos: =, /=, <, >, <=, >=

19 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Physical Usados para representar valores físicos (longitud, masa, tiempo y corriente). Definión similar al tipo de datos enteros, pero con definición adicional de unidad. Primary unit primer identificador después de la palabra units : es la unidad más pequeña.

20 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Physical Ejemplo: TYPE resistance IS RANGE 0 TO 10000000 UNITS ohm; -- ohm Kohm = 1000 ohm; -- i.e. 1 K Mohm = 1000 kohm; -- i.e. 1 M END UNITS;

21 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Physical, operaciones Suma: + Resta o negación: - Multiplicación por entero o real.: * División por entero o real: / Valor absoluto: abs Exponenciación: ** Lógicos: =, /=, <, >, <=, >=

22 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Physical, ejemplo. Time: Es un tipo predefinido, usado para medir tiempos en simulaciones y para generar relojes. Time: No es sintetizable

23 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Physical, ejemplo. Time: Simulación de un período de reloj (10ns).

24 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated Se pueden utilizar para dar valores o nombres a un objeto. Ejemplo: cuando se modela un procesador, para nombrar explícitamente las funciones que implementa (legibilidad del código).

25 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated Ejemplo: TYPE binary IS ( ON, OFF );... some statements... ARCHITECTURE test_enum OF test IS BEGIN PROCESS (X) VARIABLE a: binary; BEGIN a := ON; -- OK... more statements... a := OFF; -- OK... more statements... END PROCESS; END test_enum;

26 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated (Boolean) Es uno de los tipos enumerated predefinidos más útiles. Usado para representar valores de condición para control.

27 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Boolean, operaciones Muchas operaciones VHDL aplicadas a otros tipos de datos tienen como resultado un valor booleano: Relaciones: Igualdad ( = ) o desigualdad ( /= ) aplicado a datos del mismo tipo: Ejemplo: 32=32 (true), `VHDL /= `Verilog (true). Relaciones: Menor ( < ), menor-igual ( <= ), mayor ( > ), mayor-igual ( >= ). Aplicable a tipos con orden (enteros, caracteres), ambos operandos del mismo tipo. Ejemplo: 827 > 789 (true), `1 < `0 (false).

28 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Boolean, operaciones Operadores lógicos: and, or, nand, nor, xor, xnor, not. Todos los operandos booleanos. Resultado booleano. Ejemplo:

29 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Boolean, síntesis Síntesis del tipo booleano: true se sintetiza como el valor lógico 1 (vdd) false se sintetiza como el valor lógico 0 (gnd)

30 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated (Bit) Es uno de los tipos enumerated predefinidos. Es el tipo más frecuentemente utilizado. Diferencias: Valores Booleanos: Condiciones de control. Bits: representan niveles de voltaje.

31 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Bit, operaciones Operaciones: Lógicas: =, /=, <, >, <=, >= Booleanas: and, or, nand, nor, xor, xnor, not Shift: sll, srl, sla, sra, rol, ror Ejemplos:

32 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated (Characters) Es uno de los tipos enumerated predefinidos.

33 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Enumerated (Characters) Escritos entre comas sencillas. `A, `k Ejemplo: Cada carácter se representa con un número binario de 8 bits (formato ASCII).

34 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays array_type <= array ( discrete_range {, } ) of element_subtype_indication ; discrete_range <= discrete_subtype_indication expr ( to downto ) expr discrete_subtype_indication <= type_mark [ range expr ( to downto ) expr ]

35 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays type word1 is array (0 to 31) of bit; type word2 is array (31 downto 0) of bit; type state is (initial, idle, active, error); type state_counts1 is array (state) of natural; type state_counts2 is array (state range initial to active) of natural;

36 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays Ejemplo: TYPE data_bus IS ARRAY(0 TO 31) OF BIT; VARIABLE X : data_bus; VARIABLE Y : BIT; Y := X(12); -- Y gets value of element at index 12

37 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays Ejemplo: TYPE reg_type IS ARRAY(15 DOWNTO 0) OF BIT; VARIABLE X : reg_type; VARIABLE Y : BIT; Y := X(4); -- Y gets value of element at index 4

38 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays multidimensionales type symbol is ( a, t, d, h ); type state is range 0 to 6; type trans_matrix is array(state, symbol) of state; variable trans_table: trans_matrix; trans_table(0, a ) := 1;

39 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Unconstrained Arrays array_type <= array ( ( type_mark range <> ) {, } ) of element_subtype_indication ; type sample is array (natural range <>) variable short: sample (0 to 63); of integer;

40 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays (cadenas) string es un unconstrained array de tipo carácter. variable name: string (0 to 11) := (others => );

41 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays (vectores de bits) bit_vector es un unconstrained array de tipo bit. variable byte: bit_vector(0 to 7);

42 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays (vectores de bits) Operaciones sobre buses tipo bit.

43 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays, operaciones and, or, nand, nor, xor, xnor Pueden ser aplicados a arrays 2D del mismo tamaño y del mismo tipo (bit o booleano). sll, slr, sal, sar, rol, ror Pueden ser aplicados a un array 1D de tipo bit o booleano. sll or slr llenado con cero. sla or sra llenado con copias del elemento. rol and ror rotan. Operadores relacionales: <, >, <=, >=, =, /= Concatenación: &

44 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Arrays, secciones y conversión type array1 is array (1 to 100) of integer; variable a1,b1: array1; b1(1 to 50) := a1(51 to 100); -- array slices subtype big_type is bit_vector(0 to 15); subtype little_type is bit_vector(31 downto 16); variable big : big_type; variable little : little_type; big := little; -- array conversion

45 ELEMENTOS Y TIPOS DE DATOS TIPOS DE DATOS: Records Se utilizan para agrupar diferentes tipos en un único objeto. TYPE binary IS ( ON, OFF ); TYPE switch_info IS RECORD status : BINARY; IDnumber : INTEGER; END RECORD; VARIABLE switch : switch_info; switch.status := ON; -- status of the switch switch.idnumber := 30; -- e.g. number of the switch

46 ELEMENTOS Y TIPOS DE DATOS LIBRERÍAS Librería IEEE Cargando librería:

47 ELEMENTOS Y TIPOS DE DATOS LIBRERÍAS Paquetes estándar que definen operaciones y tipos de datos normalmente utilizados. Std_Logic_1164: Std_ulogic Std_ulogic_vector Std_logic Std_logic_vector Incluir en todos los diseños.

48 ELEMENTOS Y TIPOS DE DATOS DESVENTAJAS TIPO BIT Elementos únicos: `0 y `1 No suficiente para modelar el comportamiento de hardware real. No es posible indicar: Valores sin inicializar. Valores desconocidos (bus atacado simultáneamente por dos fuentes). Tri-state o alta impedancia.

49 ELEMENTOS Y TIPOS DE DATOS TIPOS Std_logic y Std_ulogic Parte de la librería IEEE (paquete std_logic_1164). Diseñado para modelar señales eléctricas.

50 ELEMENTOS Y TIPOS DE DATOS TIPOS Std_logic y Std_ulogic: Ejemplo Buffer Tri-state Errores en la señal de enable no afectan a data_out

51 ELEMENTOS Y TIPOS DE DATOS Std_logic vs. Std_ulogic Sistemas con 9 valores lógicos. Std_logic: resuelve de acuerdo a la tabla de resolución.

52 ELEMENTOS Y TIPOS DE DATOS Std_logic vs. Std_ulogic Std_ulogic: no puede estar atacado por más de un driver. En otro caso se producen errores. Bueno para diseños sin buses tri-state. Std_logic: permite múltiples drivers. Puede ser usado en diseños tri-state.

53 ELEMENTOS Y TIPOS DE DATOS Std_logic vs. Std_ulogic: Ejemplo Std_logic bus con múltiples drivers

54 ELEMENTOS Y TIPOS DE DATOS Std_ulogic_vector, Std_logic_vector Unconstrained arrays de valores std_ulogic y std_logic, respectivamente.

55 ELEMENTOS Y TIPOS DE DATOS Std_logic_vector

56 ELEMENTOS Y TIPOS DE DATOS Std_logic_vector signal A: STD_LOGIC; signal B: STD_LOGIC_VECTOR(3 downto 0); signal C: STD_LOGIC_VECTOR(3 downto 0); signal D: STD_LOGIC_VECTOR(7 downto 0); signal E: STD_LOGIC_VECTOR(15 downto 0); signal F: STD_LOGIC_VECTOR(8 downto 0);. A <= 1 ; B <= 0000 ; -- Binary base assumed by default C <= B 0000 ; -- Binary base explicitly specified D <= 0110_0111 ; -- You can use _ to increase readability E <= X AF67 ; -- Hexadecimal base F <= O 723 ; -- Octal base

57 ELEMENTOS Y TIPOS DE DATOS Funciones aritméticas Para usar funciones aritméticas con std_logic_vectors hay que incluir los siguientes paquetes: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;

58 ELEMENTOS Y TIPOS DE DATOS Funciones aritméticas