[an error occurred while processing this directive]
Правильно (+)
(«Телесистемы»: Конференция «Языки описания аппаратуры (VHDL и др.))

миниатюрный аудио-видеорекордер mAVR

Отправлено NiOS 15 июня 2006 г. 16:41
В ответ на: Выход из циклов while for repeat отправлено MadMan 15 июня 2006 г. 15:59

Disabling named blocks
The keyword disable provides a way to terminate the execution of a block.
disable can be used to get out of loops, handle error conditions, or control
execution of pieces of code, based on a control signal. Disabling a block causes the
execution control to be passed to the statement immediately succeeding the block.
For C programmers, this is very similar to the break statement used to exit a
loop. The difference is that a break statement can break the current loop only,
whereas the keyword disable allows disabling of any named block in the design.
Consider the illustration in Example 7-17 on page 136, which looks for the first
true bit in the flag. The while loop can be recoded, using the disable statement as
shown in Example 7-25. The disable statement terminates the while loop as soon
as a true bit is seen.
Example 7-25 Disabling Named Blocks
//~llustration:~intdh e first bit with a valuelin flag (vector
//variable)
reg [15:0] flag;
integer i; //integer to keep count
144 Verilog HDL: A Guide to Digital Design and Synthesis
Example 7-25 Disabling Named Blocks
l
initial
begin
flag = 16'b 0010~0000~0000~0000;
i = 0;
begin: blockl //The main block inside while is named blockl
while (i < 16)
begin
if (flag[il )
begin
$display("Encountered a TRUE bit at element number %d", i);
disable blockl; //disable blockl because you found true bit.
end
i = i + l ;
end
end
end

Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 
NoIX ключ Запомнить

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание

E-mail: info@telesys.ru