Hardware Abstraction: Device
Hardware Abstraction: Device
Hardware Abstraction: Device
VHDL describe a model for a digital hardware device. This model specifies the
external view of the device and one or more internal views.
The internal view of the device specifies the functionality or structure, while
external view specifies the interface of the device through which it communicates
with the other models.
A hardware device may have many device model.
In VHDL ,each device model is treated as a distinct representation of a unique
device, called an entity.
DEVICE Device
model
External View
Digital Model
System
Internal View
Advantages of HDL
Compact description.
Synchronizing mechanism between concurrent flow
Event scheduling
Easy to edit.
Highly portable.
Various level of abstraction.
Functional simulation early in the design flow.
Rapid prototyping of design.
Design Reuse - Provides Technology independence
Availability of extensive vendor libraries.
Support for hardware concurrency and time frame are two
main features that distinguishes HDLs from other
programming languages.
Limitations of HDL
Data Objects:-
1:- Signal
2:- Variable
3:- Constant
4:- File
Basic Concepts or Language Elements
Data Objects:-
Signal:-
Data Object
Variable:-
An object belonging to the file class contain a sequence of value. Value can be
read or written to the file using read procedures and write procedures,
respectively.
Basic Concepts or Language Elements
Data Type:-
1:- Scalar types
(i) Integer
(ii) Enumeration
(iii) Physical*
(i) Array
(ii) Record
The value set is defined in a model using a type declaration along with
the object kind.
Basic Concepts or Language Elements
Scalar Types:-
The value belonging to these types are ordered, that is, relational
operators can be used on these values.
Example:- Bit is a scalar type, and the expression 0 < 1 is valid and has the
value
True.
Integer and Enumeration types are called discrete types because these type have
discrete value associated with them.
Every value belonging to an enumeration type, integer type, or a physical type has
a position number associated with it.
Basic Concepts or Language Elements
Unconstrained type
Array types whose range is not specified when declared
1. Logical operators
- AND
- OR operate on bit but
- NAND can be overloaded
- NOR for operations
- XOR on bit_vector
.
Basic Concepts or Language Elements
2. Relational operators
Compare the two values of the same base and return a Boolean value
- = (Equal)
- =/ (Not equal)
- > (Greater than)
- >= (Greater than equal to)
- < ( Less than)
- <= (Less than equal to)
Basic Concepts or Language Elements
3. Adding operators
- +
- -
- &
Operators + and -are predefined for integer operands can be
overloaded for operation on data of the type bit_vector.
4. Multiplying operators
- * (Multiply)
- / (Divide)
- Rem
- Mod
5. Miscellaneous operators
- ** (Exponent)
- Abs (absolute)
- Not
Basic Concepts or Language Elements
1. Entity declaration
3. Architecture Body
5. Configuration Declaration
7. Package Declaration
9. Package Body
Entity Declaration
entity entity_name is
[generic (list-of-generics-and-their-types);]
[port (list-of-interface-port-names-and-their-types);]
end [entity] entity-name;
Architecture Body
Architecture body: describes the function of a design.
Architecture body gives the functional behavior of the entity i.e. how its
inputs and outputs are related.
Architecture is the textual representation of the graphical schematic.
end architecture_name;
Architecture Body
Library library_name;
Configuration Configuration_name of entity_name is
For architecture_name
Use entity library_name. entity_name(architecture_name);
End for;
End Configuration_name
Package Declaration
Package package_name is
End package_name;
Package Body
A package body is used to store the definitions of functions and procedures
that were declared in the corresponding package declarations.
entity eqcomp4 is
Port Declaration
port (a, b : in bit_vector(3 downto 0);
equals: out bit );
end eqcomp4;
architecture dataflow of eqcomp4 is
begin
equals <=1 when (a=b) else 0;
end dataflow;
Entities and Architecture in VHDL
Entities and Architecture in VHDL
Declarations in entity
The declarations allowed in entity declaration region include
Type declaration
subtype declaration
signal declaration
constant declaration
alias declaration
use clause
subprogram declaration
subprogram body
Entities and Architecture in VHDL
OR
((A) AND (NOT (B)) AND (NOT (C_IN)))
OR
((A) AND (B) AND (C_IN));
CARRY <= ((NOT (A)) AND (B) AND (C_IN))
OR
((A) AND (NOT (B)) AND (C_IN))
OR
((A) AND (B) AND (NOT (C_IN)))
OR
((A) AND (B) AND (C_IN));
END FLOW_ONE;
Examples
2. Full adder
-entity full_adder is
Port ( x : in istd_logc; --input x
y : in std_logic; --input y
cin: in std_logic;-- input carry
s : out std_logic; --output sum
cout : out std_logic); --output carry
end full_adder;
begin
s<= (x xor y) xor cin; --summing of two bit in carry also included
cout<=(x and y)or(x and cin)or(y and cin); --output carry
end dataflow;
3. MUX_4_1 >
entity mux41 is
Port ( i0,i1,i2,i3,s0,s1 : in std_logic;
y : out std_logic);-- output
end mux41;
architecture dataflow of mux41 is
begin
Y <= (i0 and (not s0)and(not s1)) or (i1 and (not s0)and s1)or
(i2 and s0 and(not s1))or(i3 and s0 and s1);
end dataflow;