Upload
abraham-watts
View
216
Download
0
Tags:
Embed Size (px)
Citation preview
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 1
Language Attributes and Package StandardA very useful aspect of the language.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 2
Attributes What are attributes? VHDL Attributes
Types Signal Variables Examples Signal Specific Other
Package Standard
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 3
What are attributes? John is just plain nasty!!!!
Being nasty is an attribute of John.
Language attributes Lovely, pretty and handsome are adjectives which
describe and a attribute of the language element they apply to. Lovely Rita ….. (Do you remember the Beatles!)
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 4
What are attributes? VHDL attributes provide additional
information on the language element to which they are associated.
For example They can tell you the size of an array and whether
the index is X to Y or Y downto X. They can tell you a signal’s last value Etc.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 5
Attributes that relate to TYPES ATTRIBUTE: T’BASE
Kind: Type Prefix: Any Type or Subtype T Result Type: The base type of T Result: Same – a type Restrictions: This attribute is allowed only as a prefix of
the name of another attribute; T’BASE’LEFT Example: BIT’BASE’LEFT is ‘0’
Base Type: The base type of a type is the type itself
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 6
Attributes that relate to TYPES ATTRIBUTE: T’LEFT
Kind: Value Prefix: Any scalar type or subtype T Result Type: Same type a T Result: The left bound of T Example: BIT’LEFT has value ‘0’
Scalar type consist of enumeration, integer, physical, and floating point types.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 7
Attributes that relate to TYPES ATTRIBUTE: T’RIGHT
Kind: Value Prefix: Any scalar type or subtype T Result Type: Same type a T Result: The right bound of T Example: BIT’RIGHT has value ‘1’
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 8
Attributes that relate to TYPES ATTRIBUTE: T’HIGH
Kind: Value Prefix: Any scalar type or subtype T Result Type: Same type a T Result: The upper bound of T Example: BIT’ HIGH has value ‘1’
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 9
Attributes that relate to TYPES ATTRIBUTE: T’LOW
Kind: Value Prefix: Any scalar type or subtype T Result Type: Same type a T Result: The lower bound of T Example: BIT’LOW has value ‘0’
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 10
Attributes that relate to TYPES ATTRIBUTE: T’POS(X)
Kind: Function Prefix: Any discrete or physical type or subtype T
A discrete type is an enumeration or intger type. Parameter: Any expression whose type is the base type of T Result Type: Universal Integer
Universal integer is an integer of an anonymous predefined integer type. An integer.
Result: The position number of the value of the parameter. Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’POS(OPSUB) has value 2 operations’POS(OPOR) has value 4
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 11
Attributes that relate to TYPES ATTRIBUTE: T’VAL(X)
Kind: Function Prefix: Any discrete or physical type or subtype T Parameter: Any expression of any integer type Result Type: The base type of T Result: The value from the type whose position number is
the universal integer value corresponding to X Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’VAL(2) has value OPSUB operations’VAL(4) has value OPOR
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 12
Attributes that relate to TYPES ATTRIBUTE: T’SUCC(X)
Kind: Function Prefix: Any discrete or physical type or subtype T Parameter: Any expression whose type is the base type of T Result Type: The base type of T Result: The value whose position number is one greater than that of
the parameter. Restricitons: An error occurs if X equals T’BASE’HIGH Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’SUCC(OPSUB) has value OPAND operations’SUCC(OPAND) has value OPOR
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 13
Attributes that relate to TYPES ATTRIBUTE: T’PRED(X)
Kind: Function Prefix: Any discrete or physical type or subtype T Parameter: Any expression whose type is the base type of T Result Type: The base type of T Result: The value whose position number is one less than that of the
parameter. Restricitons: An error occurs if X equals T’BASE’LOW Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’PRED(OPSUB) has value OPADD operations’PRED(OPAND) has value OPSUB
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 14
Attributes that relate to TYPES ATTRIBUTE: T’LEFTOF(X)
Kind: Function Prefix: Any discrete or physical type or subtype T Parameter: Any expression whose type is the base type of T Result Type: The base type of T Result: The value which is to the left of the parameter in the range of
T. Restricitons: An error occurs if X equals T’BASE’LEFT Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’LEFTOF(OPSUB) has value OPADD
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 15
Attributes that relate to TYPES ATTRIBUTE: T’RIGHTOF(X)
Kind: Function Prefix: Any discrete or physical type or subtype T Parameter: Any expression whose type is the base type of T Result Type: The base type of T Result: The value which is to the right of the parameter in the range
of T. Restricitons: An error occurs if X equals T’BASE’RIGHT Example:
type operations is (OPADD, OPSUB, OPAND, OPOR); signal oper : operations; Then operations’RIGHTOF(OPSUB) has value OPAND
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 16
Attributes that relate to ARRAYS ATTRIBUTE: A’LEFT[(N)]
Kind: Function Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result: Left bound of the Nth index range of A.
ATTRIBUTE: A’RIGHT[(N)] Kind: Function Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result: Right bound of the Nth index range of A.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 17
Attributes that relate to ARRAYS ATTRIBUTE: A’HIGH[(N)]
Kind: Function Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result: Upper bound of the Nth index range of A.
ATTRIBUTE: A’LOW[(N)] Kind: Function Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result: Lower bound of the Nth index range of A.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 18
Attributes that relate to ARRAYS ATTRIBUTE: A’RANGE[(N)]
Kind: Range Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result: The range A’LEFT(N) to A’RIGHT(N) or
A’LEFT(N) downto A’RIGHT(N) ATTRIBUTE: A’REVERSE_RANGE[(N)]
Kind: Range Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer. Defaults to 1. Result Type: Type of the Nth index range of A Result:. The range A’ RIGHT(N) to A’ LEFT(N) or A’
RIGHT(N) downto A’ LEFT(N)
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 19
Attributes that relate to ARRAYS ATTRIBUTE: A’LENGHT[(N)]
Kind: Range Prefix: Any prefix A that is an array object Parameter: Locally static expression of type integer.
Defaults to 1. Result Type: Universal Integer Result: Number of values in the Nth index range, i.e.,
A’HIGH(N) – A’LOW(N) +1
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 20
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | | | ‘RIGHT | | | ‘HIGH | | | ‘LOW | | | ‘RANGE | | | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 21
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | | | ‘HIGH | | | ‘LOW | | | ‘RANGE | | | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 22
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | | | ‘LOW | | | ‘RANGE | | | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 23
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | 31 | 15 | ‘LOW | | | ‘RANGE | | | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 24
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | 31 | 15 | ‘LOW | 0 | 0 | ‘RANGE | | | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 25
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | 31 | 15 | ‘LOW | 0 | 0 | ‘RANGE | 31 downto 0 | 0 to 15 | ‘REVERSE_RANGE | | | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 26
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | 31 | 15 | ‘LOW | 0 | 0 | ‘RANGE | 31 downto 0 | 0 to 15 | ‘REVERSE_RANGE | 0 to 31 | 15 downto 0 | ‘LENGTH | | |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 27
Attributes that relate to ARRAYS EXAMPLE:
signal mydt : bit_vector (31 downto 0); signal myto : bit_vector ( 0 to 15);
Then the mydt myto ‘LEFT | 31 | 0 | ‘RIGHT | 0 | 15 | ‘HIGH | 31 | 15 | ‘LOW | 0 | 0 | ‘RANGE | 31 downto 0 | 0 to 15 | ‘REVERSE_RANGE | 0 to 31 | 15 downto 0 | ‘LENGTH | 32 | 16 |
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 28
Attributes that relate to SIGNALS ATTRIBUTE: S’DELAYED[(T)]
Kind: Signal Prefix: Any signal Parameter: Any static expression of type TIME
that evaluates to a non-negative value. Result Type: Base type of S Result: A signal equivalent to S delayed T units
of time. The value of S’DELAYED(t) is always equal to the value of S t units of time previous.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 29
Attributes that relate to SIGNALS ATTRIBUTE: S’STABLE[(T)]
Kind: Signal Prefix: Any signal Parameter: Any static expression of type TIME that
evaluates to a non-negative value. Defaults to 0 if omitted.
Result Type: Boolean Result: A signal that has value TRUE when an event has
not occurred on signal S for T units of time, and the value FALSE otherwise.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 30
Attributes that relate to SIGNALS ATTRIBUTE: S’QUIET[(T)]
Kind: Signal Prefix: Any signal Parameter: Any static expression of type TIME that
evaluates to a non-negative value. Defaults to 0 if omitted.
Result Type: Boolean Result: A signal that has value TRUE when the signal has
been quiet (not had a change in value) for T units of time.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 31
Attributes that relate to SIGNALS ATTRIBUTE: S’TRANSACTION
Kind: Signal Prefix: Any signal Result Type: Type BIT Result: A signal that toggles to the inverse of its previous value in
each simulation cycle in which the signal S becomes active. ATTRIBUTE: S’EVENT
Kind: Signal Prefix: Any signal Result Type: Type BOOLEAN Result: A value that indicates whether an event has just occurred on
signal S.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 32
Attributes that relate to SIGNALS ATTRIBUTE: S’ACTIVE
Kind: Function Prefix: Any signal Result Type: Type BOOLEAN Result: A value that indicated whether S is active, i.e., has a new
value generated for it this simulation cycle. ATTRIBUTE: S’LAST_EVENT
Kind: Function Prefix: Any signal Result Type: Type TIME Result: The amount of time that has elapsed since the last event on
signal S.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 33
Attributes that relate to SIGNALS ATTRIBUTE: S’LAST_ACTIVE
Kind: Function Prefix: Any signal Result Type: Type TIME Result: The amount of time that has elapsed since the last
time the signal S was active. ATTRIBUTE: S’LAST_VALUE
Kind: Function Prefix: Any signal Result Type: Base type of S Result: The previous value of S.
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 34
Attributes that relate to Design Units ATTRIBUTE: B’BEHAVIOR
Kind: Value Prefix: Any block denoted by a label or entity denoted by
its architecture name. Result Type: BOOLEAN Result: The value if TRUE if the block defined by the
block statement or entity does not contain a component instantiation statement.
ATTRIBUTE: B’STRUCTURE The same except that TRUE when the block/entity
contains only component instantiations
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 35
Package STANDARD
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 36
Package Standard (cont.)
1/8/2007 - L10 Attributes Copyright 2006 - Joanne DeGroat, ECE, OSU 37
Package Standard (completed)