Theme Graphic
Theme Graphic

VHDL Basics

"Basics of VHDL" blog provide information about VHDL language and syntax for design and Verification to the beginners. Note:- This series...
Posted on Monday, September 20, 2010 at 3:06 AM

Chapter 5:Statements


5.1:Introduction:-

VHDL is broadly classified into two types based on the execution of statements. They are

a) Concurrent statement

b) Sequential statement

This chapter will give an explanation about two types of statements and their categories. These statements are commonly used in synthesis.

5.2:Concurrent statement:-

Concurrent statements are executed parallely. Inside the architecture of VHDL program, all the statements are executed simultaneously i.e., all the statements are executed at the same time. They are concurrent. The order of the statements is not important. Few concurrent statements are

a) Boolean equation

b) when else

c) with select when 5.2.1:Boolean Equation:-

Boolean equation forms combinational logic and produce desired output for design. LHS variable is assigned with one or more variables connected with or without operators such as AND,OR,NOT,XOR,NOR,+,*,/,- etc to form Boolean equation.

Example 5.1:-

Refer example 4.7 and example 4.8

Note:- Boolean equation has to be outside process.

5.2.2:when else:-

when else statement gives the output based on the condition which it satisfies first. Priority goes on the order of appearance. It forms a priority encoder.

Example 5.2:-

-- xor operation in when else

c_o <= '0' when (a_i = b_i) else '1';

5.2.3:with select when:-

Target signal will be assigned as soon as the control signal is ready in "with select when" statement. It forms encoder logic after synthesis. Control signal will be placed between "WITH" and "SELECT" keyword. Target signal is followed by "SELECT" keyword. Example 5.3:-

-- concatenation is done here else

-- simulation warning select signal has to be "static"

-- sel_s has to be declared between architecture and begin with two

-- bit vector.

sel_s <= (a_i & b_i);

-- sel_s is control signal

WITH (sel_s) SELECT

-- c_o target signal

c_o <= '0' WHEN "11", '0' WHEN "00", '1' WHEN OTHERS;

Apart from the above classification "PROCESS" is a concurrent statement. Statements inside PROCESS will execute when there is activity in the sensitivity list or by wait statements inside PROCESS.

5.3:Sequential statement:-

Sequential statements are executed one by one. Inside "PROCESS" of the VHDL program all the statements are executed one by one. If a signal is assigned twice in a same PROCESS the statement which is assigned in last statement will be considered to assign value for the signal. The order of the statement is very important. Below sequential statements commonly used in synthesis

a) Case

b) if else

5.3.1:case:-

In case statements only one branch is executed at a time. Case statements form a multiplexer after synthesis. It is similar to "WITH SELECT WHEN" concurrent statement.

Example 5.4:-

-- concatenation is done here else

-- simulation warning select signal has to be "static"

-- sel_s has to be declared between architecture and begin with two bit vector.

-- process deceleration with sensitivity

PROCESS (a_i,b_i,sel_s)

BEGIN

-- concatenation of two bits

sel_s <= (a_i & b_i);

--sel_s is control signal

CASE (sel_s) IS

-- "|" is not or operator

-- it indicates that if sel_s is either "00" or "11" then executes

WHEN "00" | "11" =>

c_o <= '0';

-- all the other cases like "01", "10" condition

WHEN OTHERS =>

c_o <= '1';

END CASE;

END PROCESS;

5.3.2:if else:-

Only "if" statement is possible but it forms latch. Nested If else statement is also possible in which one or more conditions are satisfied then it executes the first satisfied condition only. It forms priority encoder. It is similar to "when else" concurrent statement.

Example 5.5:-

-- whenever there is a change in a_i or b_i

-- then the statements will be executed

PROCESS (a_i,b_i)

BEGIN

-- both inputs are equal then target signal is assigned to 0

IF (a_i = b_i) THEN

c_o <= '0';

-- both inputs are not equal then target signal is assigned to 1

ELSE

c_o <= '1';

END IF;

END PROCESS;

NOTE:- Other sequential constructs which are synthesizable is FOR LOOP and some tools support LOOP, WHILE also for synthesis. But these LOOP constructs are not advisable for synthesis. FOR LOOP completes the execution in one time unit i.e. within one clock cycle.
Bookmark: Submit To Digg Submit To reddit Submit To del.icio.us Bookmark With StumbleUpon Bookmark With FaceBook Bookmark With Google Bookmarks   Share: Share By Email By Email

0 comments on "Chapter 5:Statements"
No comments posted yet.

Leave A Comment
Subject:


Comment:
   Bold Italic Underline          Code Link Image Horizontal Rule


Because you do not have or are not logged in to your Programmer's Heaven account, please enter your name.

Name:


To help prevent comment SPAM, please enter the magic code '991' in the box:




Posting Rules
Please follow these rules when posting comments on blog posts.
  • Do not post anything that is racist, hate speech or of a sexual or adult nature.
  • Do not post or link to anything that infringes copyrighted laws.
  • Posting about security or legal topics is fine so long as you are not glorifying or encouraging people to perform illegal activities.
  • Both the author of this blog and the Programmer's Heaven administrators may delete any inappropriate comments without notice at their own discretion.
 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.