answersLogoWhite

0


Best Answer

A loop statement is used to iterate through a set of sequential statements. The syntax of a loop statement is

[ loop-label : ] iteration-scheme loop

sequential-statements

end loop [ loop-label ] ;

There are three types of iteration schemes. The first is the for iteration scheme that has the form

for identifier in range

An example of this iteration scheme is

FACTORIAL := 1;

for NUMBER in 2 to N loop

FACTORIAL := FACTORIAL * NUMBER;

end loop;

The body of the for loop is executed (N-1) times, with the loop identifier, NUMBER, being incremented by I at the

end of each iteration. The object NUMBER is implicitly declared within the for loop to belong to the integer type

whose values are in the range 2 to N. No explicit declaration for the loop identifier is, therefore, necessary. The

loop identifier, also, cannot be assigned any value inside the for loop. If another variable with the same name exists

outside the for loop, these two variables are treated separately and the variable used inside the for loop refers to the

34loop identifier.

The range in a for loop can also be a range of an enumeration type such as

type HEXA is ('0', '1', '2', '3', '4', ' 5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'):

. . .

for NUM in HEXA'('9') downto HEXA'('0') loop

-- NUM will take values in type HEXA from '9' through '0'.

. . .

end loop;

for CHAR in HEXA loop

-- CHAR will take all values in type HEXA from '0' through 'F'.

. . .

end loop;

Notice that it is necessary to qualify the values being used for NUM [e.g., HEXA'('9')] since the literals '0' through

'9' are overloaded, once being defined in type HEXA and the second time being defined in the predefined type

CHARACTER

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to use for loop in vhdl code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the vhdl code for binary to hex convertion?

vhdl code for binary to Hexadecimal ?


Vhdl code for assending order of numbers?

vhdl code for ascending order of numbers


VHDL code of home security?

VHDL code for home security need to be written in structural modeling of VHDL. It will be a bunch of programs related to each and every home appliance we use and need to be combined. It is not a single program. It is a combination of several programs.


What is the vhdl code for 8253 microprocessor?

VHDL code for 8253 need to be written in structural modeling of VHDL. It will be a bunch of programs related to each and every component or functionality we use in 8253 and need to be combined. It is not a single program. It is a combination of several programs.


Code for square wave generation in VHDL?

implement vhdl code for counter.output of counter pulse is a square wave


Why should you use vhdl?

VHDL is a hardware description language. Its very purpose is to describe hardware in the form of a program. This program can be understood by the user and the system as well. By implementing the hardware as a code, it is easier to verify its functionality. Hence, to test hardware before it could actually be designed, we should use VHDL.


How vhdl is used?

VHDL is a hardware description language. The purpose of any HDL is to represent hardware as a program. We can write a program (code) for any digital circuit using VHDL. With the help of this code, the output of the circuit can be observed before actually designing it physically.


How can you repeatedly execute a code in java script?

1) use for loop 2) do while loop


What is vhdl code for 2 bit sliced processor?

library ieee;


How do you do loop to hundred for code?

Use a counted for loop: int x;for (x=1; x<=100; ++x) { /* ... */ }


What is simulation in vhdl?

After writing the VHDL code, we wish to verify the code and its functionality. Verifying the code for syntax errors is called compilation. Later, applying the inputs and obtaining the outputs is called simulation. If we are not getting the desired output, we may check our code and re-compile and simulate.


You want vhdl code for finding square root of binary number?

yes