Академический Документы
Профессиональный Документы
Культура Документы
VHDL is a high level modeling language for digital circuits VHDL stands for Very high speed integrated circuit Hardware Description Language
Uses of VHDL
Design documentation -- describing structures of digital circuits Design simulation -- modeling the behavior of digital circuits Design synthesis converting code to hardware implementation
Design conception
Synthesis
Functional simulation
No
Physical design
Timing simulation
No
Chip configuration
Concurrency
VHDL is concurrent by nature.
different from conventional programming languages
These assignment statements are concurrent. They can be written in any order
Exercise
Deduce the circuit implemented by the following code:
ARCHITECTURE
defines operation
ENTITY description
Syntax
entity <entity_name> is port ( <port_names> : <mode> <type>; <port_names> : <mode> <type>; -- last port has no semicolon <port_names> : <mode> <type> ); end <entity_name>;
Example
Syntax
entity <entity_name> is port ( <port_names> : <mode> <type>; <port_names> : <mode> <type>; -- last port has no semicolon <port_names> : <mode> <type> ); end <entity_name>;
Example
Example
entity <entity_name> is port ( <port_names> : <mode> <type>; <port_names> : <mode> <type>; -- last port has no semicolon <port_names> : <mode> <type> ); end <entity_name>;
Vector types
BIT_VECTOR: represents array of BIT objects STD_LOGIC_VECTOR: represents array of STD_LOGIC objects Example:
c <= 1010 will result in c(1)=1, c(2)=0, c(3)=1, c(4)=0 b <= 10011000 will result in b(7)=1, b(6)=0, and so on to b(0)=0
ARCHITECTURE description
A given architecture represents one possible implementation for its associated entity
architecture declaration: defines internal signals, components, types etc to be used in architecture body architecture body: defines implementation details of input/output relationship
Syntax
architecture <arch_name> of <entity_name> is -- architecture declarations begin -- architecture body end <arch_name>;
Example
Example
ARCHITECTURE declaration
SIGNAL declarations
These are for internal signals inside the entity
General Form
architecture <arch_name> of <entity_name> is -- architecture declarations [SIGNAL declarations] [COMPONENT declarations] [CONSTANT declarations] [TYPE declarations] [ATTRIBUTE specifications] begin -- architecture body [CONCURRENT ASSIGNMENT statements;] [COMPONENT instantiation statements;] [PROCESS statements;] [GENERATE statements;] end <arch_name>;
Syntax:
SIGNAL <signal_names> : <type>
Example
ARCHITECTURE body
Concurrent Assignments Syntax:
<target> <= <expression>
General Form
architecture <arch_name> of <entity_name> is -- architecture declarations [SIGNAL declarations] [COMPONENT declarations] [CONSTANT declarations] [TYPE declarations] [ATTRIBUTE specifications] begin -- architecture body [CONCURRENT ASSIGNMENT statements;] [COMPONENT instantiation statements;] [PROCESS statements;] [GENERATE statements;] end <arch_name>;
<target> can be an internal signal or an output port <expression> operates on internal signal and/or input ports
Example
Arithmetic operators +, -, *, / Logical operators NOT, AND, OR, NAND, NOR, XOR,XNOR
Highest precedence
Miscellaneous
Multiply, divide Add, subtract, concatenate
NOT
*, / +, -, &
Shift
Relational Lowest precedence logical
Note that logical operators all have the same precedence. So need to use parenthesis For example, an SOP function should be:
f <= (x1 and x2) or (x3 and x4)
Operators of the same class are evaluated from left to right in an expression