Type Associated - Computer Science - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Computer Science which includes Bit Adder, Code, Vector, Bcdcarryout, Architecture Behavioral, Component, Signal, Waveform, Logic etc. Key important points are: Type Associated, Data Types, Type Associated, Set of Operation, Values, Object, Bit, Boolean, Character, Integer

Typology: Slides

2012/2013

Uploaded on 03/23/2013

dhruv
dhruv ๐Ÿ‡ฎ๐Ÿ‡ณ

4.3

(12)

194 documents

1 / 42

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Data Types
โ€ขEach data object has a type associated with
it.
โ€ขThe type defines the set of values that the
object can have and the set of operation that
are allowed on it.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Partial preview of the text

Download Type Associated - Computer Science - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Data Types

  • Each data object has a type associated with

it.

  • The type defines the set of values that the

object can have and the set of operation that

are allowed on it.

Data types defined in the

standard package

  • Predefined data type are as follows:
    • Bit
    • Bit_vector
    • Boolean
    • Character
    • File_open_kind*
    • File_open_status*
    • Integer
    • Natural
    • Positive
    • Real
    • Severity_level
    • String
    • Time* Docsity.com

Data Types

  • A type declaration defines the name of the

type and the range of the type.

  • Type declaration are allowed in package

declaration sections, entity declaration

sections, architecture declaration sections,

subprogram declaration section and process

declaration sections.

Types available in VHDL

  • Scalar types
    • Integer types
    • Real types
    • Enumerated
    • Physical
  • Composite Types
    • Arrays type
    • Records
  • Access Types (equivalent of pointers in C)
  • File types

Example - Integer

Architecture test of test is

Begin

Process (x) Variable a: integer; Begin a := 1; --ok a := -1 ; -- ok a := 1.0; -- error End process;

End test;

Real Types

  • Real Types are used to declare objects that

emulate mathematical real numbers.

  • Real number can be used to represent

numbers out of the range of integer value as

well as fractional values.

  • Minimum Range: -1.0E+38 to +1.0E+

Enumerated types

  • Enumerated type is used to represent exactly the values required for a specific operation.
  • All of the values of an enumerated type are user- defined.
  • This values can be identifiers or single-character literals.
  • A typical example:

TYPE fourval IS (โ€˜xโ€™, โ€˜0โ€™, โ€˜1โ€™, โ€˜zโ€™); TYPE color IS (red,yellow, blue,green,orange);

IEEE standard 1164

Type std_logic is (

โ€˜Uโ€™, -- uninititalized โ€˜Xโ€™, -- forcing unknown โ€˜0โ€™, -- forcing 0 โ€˜1โ€™, -- forcing 1 โ€˜Zโ€™, --high impedence โ€˜Wโ€™, --weak unknown โ€˜Lโ€™, --weak 0 โ€˜Hโ€™, -- weak 1 โ€˜-โ€™); -- donโ€™t care

Predefined VHDL aggregate data

types

  • Bit_vector array (natural range<>) of bit
  • String array (natural range<>) of char
  • Text file of โ€œstringโ€

IEEE standard 1164 aggregate

data type

  • Std_logic_vector array (natural range <>) of

std_ulogic;

  • Std_logic_vector array (natural range<>) of

std_logic;

Architecture test_ar of mp is

Type color is range in (yellow,red);

Begin

process (test) begin case test is when red => a := data; end case; end process;

End test_ar; Docsity.com

Physical Types

  • Physical types are used to represent physical quantities such as distance,current, time and so on.
  • A physical type provides for a base unit,and successive units are then defined in terms of this unit.
  • The smallest unit represented is one base unit.
  • The largest unit is determined by the range specified in physical type declaration.
  • TIME is a predefined physical types

Example โ€“ Physical Type

Package example is

type current is range 0 to 10000000000 units na; ua = 1000 na; -- nano amp ma = 1000 ua; -- micro amp a = 1000 ma; End units; type load_factor is (small, med, big);

End example;

Architecture delay-cal of delay is

Begin

delay <= 10 ns when (load = small) else 20 ns when (load = med) else 30 ns when (load = big) else 40 ns; out-current <= 1000 ua when (load= small) else 1 ma when (load = med) else 100 ua;

End delay-cal;