Operators and Attributes in VHDL: A Comprehensive Guide, Slides of Computer Science

An in-depth exploration of various operators and attributes used in vhdl (vhsic hardware description language). Operators include assignment, logical, relational, shift, adding, multiplying, and miscellaneous operators. Attributes are values, functions, types, ranges, signals, or constants that can be associated with names within a vhdl description. User-defined and predefined attributes, as well as their classes and examples.

Typology: Slides

2012/2013

Uploaded on 03/23/2013

dhruv
dhruv 🇮🇳

4.3

(12)

194 documents

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Operators
Assignment Operators
Logical Operators
Relational Operators
Shift Operators
Adding Operators
Multiplying Operators
Miscellaneous Operators
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Operators and Attributes in VHDL: A Comprehensive Guide and more Slides Computer Science in PDF only on Docsity!

Operators

  • Assignment Operators
  • Logical Operators
  • Relational Operators
  • Shift Operators
  • Adding Operators
  • Multiplying Operators
  • Miscellaneous Operators

Assignment Operators

  • Used to assign values to signals, variables

and constants.

<= Used to assign a value to a Signal := Used to assign a value to a variable, constant, or Generic Must be the same size and type => Used to assign values to individual vector elements or with OTHERS.

Relational Operator

  • = Equality
  • /= inequality
  • <
  • <=
  • =

  • Must be one-dimensional discrete array of the same type.

Shift Operators

  • Sll Shift left logical
  • Srl Shift right logical
  • Sla Shift left arithmetic
  • Sra Shift right arithmetic
  • Rol Rotate left
  • Ror Rotate Right

Adding Operators

    • addition
    • subtraction
  • & Concatenation
  • Example:
  • A = 1010
  • B = 1000
  • C <= a & b; c = 10101000
  • C <= b & a; c := 10001010

Multiplying Operators

    • Multiplication
  • / Division
  • Mod modulus
  • Rem Remainder

Attributes

  • An attributes is a value, function, type,

range, signal or a constant that may be

associated with one or more names within a

VHDL description.

  • Two types of attributes
    • User defined attributes
    • Predefined attributes

Classes of attributes

  1. Value attributes : Return a constant value
  2. Function attributes : Call a function that return a value
  3. Signal Attributes : Creates a new implicit signal
  4. Type Attributes : Return a type
  5. Range attributes : Returns a range

To use a attribute the “’” (apostrophe) construct must be employed

  • T’right Returns right value specified in

type declaration

Example: Integer’right is 2147483647 bit’right is ‘1’

  • T’high Returns largest value specified in

declaration

Example: Type bit8 is 255 downto 0 bit8’high is 255

  • T’low Returns smallest value specified in

declaration

Example: Type bit8 is 255 downto 0; bit8’low is 0;

  • T’pos(x) Returns position number of

argument in type (first position is 0)

Example: Type color is (red,green, blue, orange); color’pos(green) is 1;

  • T’pred(x) Returns the predecessor to

the value passed in

Example: Type color is (red,green, blue, orange); color’pred(blue) is green;

  • T’leftof(x) Returns the value to the left

of the value passed in

Example: Type color is (red,green, blue, orange); color’leftof(blue) is green

  • T’rightof(x) Returns the value to the right

of the value passed in

Example: Type color is (red,green,blue,orange); color’rightof(blue) is orange;

Type s is (1,0,0,1,0,1) S’rightof(1)

Type a_type is array(0 to 3, 7 downto 0) of bit;

  • A’high(n) Returns largest array bound value of selected index range Example: a_type’high(1) is 3 a_type’high(2) is 7
  • A’low(n) Returns smallest array bound value of selected index range Example: a_type’low(1) is 0 a_type’low(2) is 0

Type a_type is array(0 to 3, 7 downto 0) of bit;

  • A’range Returns selected index range Example: a_type’range(1) is 0 to 3 a_type’range(2) is 7 downto 0
  • A’reverse_range(n) Returns selected index

range reversed

Example: a_type’reverse_range(1) 3 downto 0 a_type’reverse_range(2) 0 to 7;