EE295 - ASIC Design With VHDL Class - Fall 2002

Scalar Data Types and Operations

Assignment:

 VHDL borrows from the structured programming technique of utilizing
data types for both the  sequential and behavioral sides of the language.
The full range of types found in such popular programming
languages as C or Pascal is available as well as some electrically
significant ones. Often novice designers find 'type mismatch' errors
in seemingly intuitive assignment statements or expression evaluations.
On the plus side, the use of data types can be a powerful means of
design expression. Remember..


Outline:


Data Objects..


Constants


Variables


Type Declarations


The Predefined Package Standard



Integer


Floating Point ( Real )


Physical Types


Enumerated Types


Character


Boolean



Bit


IEEE Standard Logic

IEEE Charters Extensions to the Language


Type Classification:



Sub Types


Type Qualification


Type Conversion Functions

 We discussed the strongly enforced Typing
that's part of VHDL. Conversion Functions are your means of satisfying
these type matching requirements.

Attributes of Scalar Types

Assuming T represents a scalar type and x a value in that type.
T'high
Returns Upper Bound of a Type/SubType
T'low
Returns Lower Bound of a Type/SubType
T'left
Returns Left-Most ( or First ) of a Type/SubType
T'right
Returns Right-Most ( or Last ) of a Type/SubType
T'ascending
Returns true if Type is Ascending, false otherwise

 

 

VHDL-93 Only

T'image(x)
Returns a string representing the value of x
T'value(s)
Returns the value in Type that is represented by s

Attributes of Scalar Types - Discrete & Physical Types

type'pos(x)
Returns Position of x in T
type'val
Returns Lower Bound of a Type/SubType
type'succ
Returns Left-Most ( or First ) of a Type/SubType
type'pred
Returns Right-Most ( or Last ) of a Type/SubType
type'leftof
Returns true if Type is Ascending, false otherwise
type'rightof
Returns true if Type is Ascending, false otherwise

 

 


Expressions

In Order of Precedence - Highest to Lowest
  • miscellaneous
  • abs - Absolute Value of Any Numeric
  • not - Inversion of Type Bit
  • ** - Exponentiation of Integer or Floating Point to an Integer Power

  • multiplication
  • *
  • /
  • mod
  • rem
  • Integer and Floating Point
  • * and / Are Defined For Physical and Integer, Physical and Real, Physical and Physical

  • sign
  • +
  • -
  • adding
  • +
  • -
    • For any Numeric Type
  • & - concatenation
    • For One-Dimensional Arrays


     
  • shift - VHDL-93
  • sll - shift left logical
  • srl - shift right logical
  • sla - shift left arithmetic
  • sra - shift right arithmetic
  • rol - rotate left
  • ror - rotate right


  •  
  • relational
  • = - equals
  • /= - not equals
  • < - less than
  • <= - less than or equals
  • > - greater than
  • >= - greater than or equals
  • Must Compare Objects of Same Type
  • Returns Type Boolean


  •  
  • logical
  • and
  • or
  • xor
  • xnor VHDL-93
  • nand
  • nor
  • Returns type Bit ( '0' or '1' ) or Boolean ( True or False )

    How was the class? Send your comments to jswift@us.ibm.com
    Return to Class Home Page


    © Copyright 1999, 2002 James Swift
    Copying this document without the permission of the author is prohibited and a violation of international copyright laws.