N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n...
-
date post
21-Dec-2015 -
Category
Documents
-
view
216 -
download
0
Transcript of N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n...
![Page 1: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/1.jpg)
Objects Constants Variables Types and Type Declarations Numbers Physical Types Enumeration Types Subtypes Operators
![Page 2: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/2.jpg)
Objects, Types, Objects, Types, and Operationsand Operations
![Page 3: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/3.jpg)
OutlineOutline Objects
Object Classes
Class Types
Operations on Types of Classes
![Page 4: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/4.jpg)
ObjectsObjects Classes of Objects Can Be of Different Types
![Page 5: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/5.jpg)
What are Objects?What are Objects? Object: Anything That Has a Name and
Is of a Specified Type
Four Classes of Objects– Constants
– Variables
– Signals (already discussed, will be more)
– Files (discussion deferred to later)
![Page 6: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/6.jpg)
Object DeclarationObject Declaration Before an Object Can Be Used, It Must Be Declared
Declarations of objects– Specify a unique identifier– Define the type – May specify initial (default) value
![Page 7: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/7.jpg)
ConstantsConstants Constant initialized to a Value That Cannot Change
– If not initialized, called a deferred constant
– Not initialized constant may only appear in package declaration
Constant declaration insures that a Value has a Type
Every value must have a type
![Page 8: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/8.jpg)
Constant SyntaxConstant Syntax
constant identifier_list : subtype_indication [ := expression ] ;
where
identifier_list <= identifier { , ... }
![Page 9: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/9.jpg)
Constant Declaration, Constant Declaration, e.g.,e.g.,constant PI : real := 3.1415926535897 ;
constant BUS_WIDTH : integer := 32 ;
constant
INTENSITY_DYNAMIC_RANGE :
real := 16 # FF . F ;
constant START_TIME_MINUTES : integer := 00 ;
![Page 10: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/10.jpg)
VariablesVariables Variable: an Object Whose Value May be
Changed After Creation
Initialization Value is Optional.
If variable is not Initialized the Default for Scalar Types is: – The first in the list of an enumeration type– The lowest in an ascending range– The highest in a descending range
![Page 11: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/11.jpg)
Variables SyntaxVariables Syntax Variable can be declared only where
it can be Accessed by One Process
variable identifier_list :
subtype_indication [ := expression ] ;
![Page 12: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/12.jpg)
Variable Declaration, Variable Declaration, e.g.,e.g.,
variable ControlValue : real := 3.68 ;
variable MinTemp, MaxTemp, MeanTemp: real := 0.0;
![Page 13: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/13.jpg)
Variable DeclarationVariable Declaration, e.g.,, e.g.,variable ImageWidth, ImageHeight :
integer := 256 ;
variable DiskSize, MemUsed, MemLeft : integer ;
variable MBus : bit_vector
( 31 downto 0 ) ;
![Page 14: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/14.jpg)
Variable Assignment SyntaxVariable Assignment Syntax
Immediately Overwrites Variable with the New Value
Unlike the way a Signal Does
:= Replacement Operator for Variables
<= Replacement Operator for Signals
[ label : ] identifier := expression ;
Important
![Page 15: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/15.jpg)
Variable Assignment, Variable Assignment, e.g., e.g., MinTemp := 0.0 ;
ImageWidth := 128 ;
MainBus := 16 # ffff_ffff ;
MainBus := x “ FFFF_FFFF “ ;
![Page 16: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/16.jpg)
TypesTypes Composite Type
There are many Predefined Types
![Page 17: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/17.jpg)
What are Types?What are Types? The Type of a Data Object:
– type defines the set of values an object can take on
– the type defines operations which can be performed on object
Scalar Type– Consists of a set of single, indivisible values
![Page 18: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/18.jpg)
Type SyntaxType Syntax Type Qualification Is Used to Avoid Type
Ambiguity in Overloaded Enumeration Literals
type_name ‘ ( expression )
– Only states type of value Type qualification
![Page 19: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/19.jpg)
Type SyntaxType Syntax Type Conversion Can Be Used to
Perform Mixed Arithmetic
New_Type ( Value_of_Old_Type )
e.g.,
real ( 238 )
positive ( My_Integer_Value )
– Rounds to nearest integer
– Changes type of value
![Page 20: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/20.jpg)
Type Declaration SyntaxType Declaration Syntax
type identifier is type_definition ;
type_definition <=
scalar_type_definition
| composite_type_definition
| access_type_definition
| file_type_definition
![Page 21: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/21.jpg)
Type DeclarationType Declaration, e.g., e.g.
Identical Type Declarations Are Distinct
type MidTermGrades is range 0 to 100 ;
type FinalGrades is range 0 to 100 ;
These are still different types
![Page 22: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/22.jpg)
Scalar Type DeclarationScalar Type Declaration Scalar Types:
– 1. Number types
– 2. Enumerated list
– 3. Physical quantities
![Page 23: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/23.jpg)
Scalar Type Declaration SyntaxScalar Type Declaration Syntax
scalar_type_definition <=
enumeration_type_definition
| integer_type_definition
| floating_type_definition
| physical_type_definition
![Page 24: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/24.jpg)
Predefined Predefined Integer TypeInteger Type
Integer Type– A range of integer values within a specified
range including the endpoints
Integer Type Range– minimum range ( - 231 + 1 ) to ( + 231 - 1 )
![Page 25: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/25.jpg)
Operations on Integer TypesOperations on Integer Types
Highest precedence: ** abs not
* / mod rem
+ (sign) – (sign)
+ – &
= /= < <= > >=
Lowest precedence: and or nand nor xor
Table 7-1. Operators and precedence.
*Ashenden, VHDL cookbook
power
![Page 26: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/26.jpg)
Integer Type Definition SyntaxInteger Type Definition Syntax
range simple_expression ( to | downto )
simple_expression
to : left to right from smallest value to largest
downto : left to right from largest value to smallest
![Page 27: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/27.jpg)
Integer Type Definition Integer Type Definition , e.g.,, e.g.,
type StreetNumbers is range 10107 to 12568 ;
type ImagingSensors is range 0 to 5 ;
type Celsius is range 100 downto 0 ;
type PointSpread is range 14 downto 0 ;
![Page 28: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/28.jpg)
Pre-defined Pre-defined Floating-Point TypeFloating-Point Type
Floating-Point Type– A range of real values within a specified range including
the endpoints Real
– Minimum range ( -1.0E+38 ) to ( +1.0E+38 ) – 6-digits minimum precision– Corresponds to IEEE 32-bit representation– Floating-point type
![Page 29: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/29.jpg)
Operations on Floating-Operations on Floating-Point TypesPoint Types
Binary Operators + Add
- Subtraction
* Multiplication
/ Division
** Exponentiation
![Page 30: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/30.jpg)
Operations on Floating-Point TypesOperations on Floating-Point Types
Unary Operators - Negation
+ Identity
abs Absolute value
![Page 31: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/31.jpg)
Floating-Point Type Floating-Point Type SyntaxSyntax
range simple_expression ( to | downto ) simple_expression
to : left to right from smallest value to largest
downto : left to right from largest value to smallest
![Page 32: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/32.jpg)
Floating-Point TypeFloating-Point Type, e.g.,, e.g.,type StreetPosition is range
101.07 to 125.68 ;
type ImagingSensorSensitivity is range
0.0 to 5.0 ;
![Page 33: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/33.jpg)
Floating-Point TypeFloating-Point Type, e.g.,, e.g.,
type Celsius is range 100.0 downto 0.0 ;
type PointSpread is range 15.0 downto 0.0 ;
![Page 34: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/34.jpg)
Physical TypePhysical Type identifier Is the Primary Unit With the Smallest
Unit Represented
identifier-n Secondary Units Defined in Terms of Primary Unit
![Page 35: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/35.jpg)
Operations on Physical TypesOperations on Physical Types Binary Operators
* Multiplication by an integer or float
/ Division by an integer or float» Division by objects of same physical type yields an
integer
![Page 36: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/36.jpg)
Operations on Physical TypesOperations on Physical Types
Unary Operators
- negation
+ identity
![Page 37: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/37.jpg)
Physical Type Definition SyntaxPhysical Type Definition Syntax
range simple_expression ( to | downto ) simple_expression
units
identifier ;
{ identifier-n = physical_literal ; }
end units [ identifier ] ;
![Page 38: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/38.jpg)
Operations on Physical TypesOperations on Physical Types Multiplication or Division of Different Physical
Types is Not Allowed
If multiplication of different physical types is Required, then:– Convert to integers– Perform operation– Convert result to correct type
![Page 39: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/39.jpg)
Predefined Physical Type, Predefined Physical Type, e.ge.g., .,
type time is range implementation defined
units
fs ;
ps = 1000 fs ; ns = 1000 ps ;
us = 1000 ns ; ms = 1000 us ;
sec = 1000 ms ; min = 60 sec ;
hr = 60 min ;
end units ; [ time ]
identifier
Identifier-n
![Page 40: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/40.jpg)
Simulation Time Resolution LimitSimulation Time Resolution Limit
The Resolution Limit Determines the Precision to Which Time Values Are Represented.
Values of Time Smaller Than the Resolution Limit Round Down to Zero.
fs Is the Normal Resolution Limit During Model Simulation. FEMTOSECOND
We used it in inertial versus transport delay example
![Page 41: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/41.jpg)
Simulation Time Resolution LimitSimulation Time Resolution Limit
Larger Values of Time Can Be Used As a Secondary Time Resolution Limit
– Units of all physical literals involving time must not be smaller than the secondary resolution limit
![Page 42: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/42.jpg)
Physical Type DefinitionPhysical Type Definition, e.g.,, e.g.,type capacitance is range 0 to 1e12
units
picofarad ;
nanofarad = 1000 picofarad ;
microfarad = 1000 nanofarad ;
farad = 1e6 microfarad ;
end units capacitance ;
![Page 43: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/43.jpg)
Physical Type ResolutionPhysical Type Resolution 47 picofarad
10.6 nanofarad
4.7 picofarad
– rounds DOWN to 4 picofarads since pf is smallest unit
– can only have integer value of base unit
![Page 44: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/44.jpg)
Enumeration Type Enumeration Type DefinitionDefinition
Enumeration Type– It is an ordered set of identifiers or characters
– The identifiers and characters within a single enumeration type must be unique.
– Identifiers and characters may be reused in different enumeration types.
( ( identifier | character_literal ) { , ... } )
![Page 45: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/45.jpg)
Enumeration Type, Enumeration Type, e.ge.g.,.,type Buffer_Direction is ( in , out , tri_state ) ;
type FF_Type is
( Toggle , Set_Reset , Data , JK ) ;
![Page 46: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/46.jpg)
Enumeration Type, Enumeration Type, e.ge.g.,.,type MemoryType is ( Read_Only ,
Write_Only ,
RW ) ;
type GateType is ( AND , OR , INVERT ) ;
![Page 47: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/47.jpg)
Predefined Predefined Enumeration TypesEnumeration Types
type severity_level is ( note , warning ,
error , failure ) ;
type Boolean is ( false , true ) ;
– Used to model abstract conditions
type bit is ( ' 0 ', ' 1 ' ) ;
– Used to model hardware logic levels
![Page 48: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/48.jpg)
Predefined Enumeration TypesPredefined Enumeration Types
type file_open_status is
( open_ok , status_error , name_error , mode_error ) ;
type character is ( NUL , SOH , ... ) ;
– All characters in ISO 8-bit character set
IEEE std_logic_1164 Accounts for Electrical Properties
![Page 49: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/49.jpg)
SubtypesSubtypes Subtype:
– Values which may be taken on by an object,
– Are a subset of some base type,
– May include all values.
![Page 50: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/50.jpg)
Subtype CasesSubtype Cases A Subtype May Constrain Values From a Scalar
Type to Be Within a Specified Range
subtype Pin_Count is integer range 0 to 400;
subtype Octal_Digits is character
range ' 0 ' to ' 7 ' ;
![Page 51: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/51.jpg)
Subtype CasesSubtype Cases
A Subtype May Constrain an Otherwise Unconstrained Array Type by Specifying Bounds for the Indices
subtype id is string ( 1 to 20 ) ;
subtype MyBus is bit_vector ( 8 downto 0 ) ;
![Page 52: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/52.jpg)
Subtype (Slice)Subtype (Slice)
Subtype: Values which may be Taken on by an Object are a Subset of some Base Type and may Include All Values.
subtype identifier is subtype_indication ;
subtype_indication <=
name [ range simple_expression
( to | downto ) simple_expression ]
![Page 53: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/53.jpg)
SubtypesSubtypes Subtypes Mixed in Expressions
– Computations done in base type
– Assignment fails if result is not within range of result variable type or subtype
![Page 54: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/54.jpg)
Subtype SyntaxSubtype Syntaxsubtype identifier is subtype_indication ;
subtype_indication <=
identifier [ range simple_expression ( to | downto ) simple_expression ]
![Page 55: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/55.jpg)
Predefined Numeric Predefined Numeric SubtypesSubtypes
subtype natural is integer range 0 to highest_integer ;
subtype positive is integer range 1 to highest_integer ;
subtype delay_length is time range 0 fs to highest_time ;
![Page 56: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/56.jpg)
Scalar Type Scalar Type AttributesAttributes
Predefined Attributes Associated With Each Type
Type_Name ‘ Attribute_Name
T’left leftmost value in T
example
![Page 57: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/57.jpg)
All Scalar Type AttributesAll Scalar Type Attributes
T’left leftmost value in T
T’right rightmost value in T
T’low least value in T
T’high greatest value in T
T’ascending True if ascending range, else false
T’image(x) a string representing x
T’value(s) the value in T that is represented by s
Type_Name
![Page 58: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/58.jpg)
Discrete and Physical Scalar Discrete and Physical Scalar Type AttributesType Attributes
T’pos(x) position number of x in T
T’val(n) value in T at position n
T’succ(x) value in T at position one greater than that of x
T’pred(x) value in T at position one less
than that of x
T’leftof(x) value in T at position one to the left of x
T’rightof(x) value in T at position one to the right of x
![Page 59: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/59.jpg)
OperatorsOperators “Short-Circuit” Operators
– Behavior with binary operators:»Evaluate left operand
»If value of operand determines the value of expression, set result
»Else evaluate right operand» Left operand can be used to prevent right operand from
causing arithmetic error such as divide by zero
– Reduces computation time by eliminating redundant calculations
A AND B
=0
![Page 60: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/60.jpg)
OperatorsOperators
Relational Operators
= , /= , < , <= , > , >=– Operands must be of the same type– Yield Boolean results
Equality, Inequality Operators
= , /=– Operands of any type
Logic Operators
AND , OR , NAND , NOR
![Page 61: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/61.jpg)
OperatorsOperators Concatenation Operator
&– Operates on one-dimensional arrays to form a new array
Arithmetic
* , /– Operate on integer, floating point and physical types
types.
![Page 62: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/62.jpg)
OperatorsOperators Modulo, Remainder
mod , rem– Operate only on integer types.
Absolute Value
abs– Operates on any numeric type
![Page 63: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/63.jpg)
OperatorsOperators Exponentiation
**– Left operand is Integer or floating point number– Integer right operand required– Negative right operand requires floating point left
operand
5.02 ** 54
![Page 64: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/64.jpg)
BIT or BOOLEAN?BIT or BOOLEAN? Logical Types Are Not Equal
– BIT for signals» ‘0’ or ‘1’
» Character type
– BOOLEAN for conditions» TRUE or FALSE
![Page 65: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/65.jpg)
Conditional Concurrent SyntaxConditional Concurrent Syntax
signal_identifier <= options
conditional_waveforms ;
options <=
[ guarded ] [ delay_mechanisms ]
conditional_waveforms <=
{ waveform when condition else }
waveform [ when condition ]
![Page 66: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/66.jpg)
Waveform SyntaxWaveform Syntax
waveform <=
( value_expression [ after time_expression ] )
{ , ... }
![Page 67: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/67.jpg)
Operator PrecedenceOperator Precedence Highest to Lowest
– Unary operator: NOT– Relational operators: =, /=, <, <=, >, >=– Boolean (bitwise): AND, OR, NAND, NOR, XOR,
XNOR Parentheses Can Be Used to
– Force particular order of evaluation– Improve readability of expressions
![Page 68: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/68.jpg)
Type Declaration/DefinitionType Declaration/Definition
type identifier is type_definition ;
type_definition <=
scalar_type_definition |
composite_type_definition |
access_type_definition |
file_type_definition
![Page 69: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/69.jpg)
Scalar TypeScalar Type
scalar_type_definition <=
enumeration_type_definition |
integer_type_definition |
floating_type_definition |
physical_type_definition
![Page 70: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/70.jpg)
Predefined Enumerated TypesPredefined Enumerated Types type severity_level is ( note, warning, error, failure );
type Boolean is ( false, true );
– Used to model abstract conditions
type bit is ( '0', '1' );
– Used to model hardware logic levels
![Page 71: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/71.jpg)
Bit-Vector TypeBit-Vector Type Useful Composite Type Since It Groups Bits
Together Which Can Represent Register Contents or Binary Numbers.
signal Out_Port_Adx: Bit_Vector
( 15 downto 0 );
![Page 72: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/72.jpg)
Specifying Values with String LiteralSpecifying Values with String Literal
Out_Port_Adx <= B ”0110_1001”;
Out_Port_Adx <= X ”69” ;
Out_Port_Adx <= O ”151” ;
![Page 73: N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.](https://reader033.fdocuments.in/reader033/viewer/2022051516/56649d5d5503460f94a3cc22/html5/thumbnails/73.jpg)
SourcesSources
Max Salinas - VI Workshop Revision
Prof. K. J. Hintz
Department of Electrical and Computer Engineering
George Mason University