Hallo, vielleicht ist es zu spät und ich bin Matsche im Kopf, aber das
finde ich seltsam, also ein Minimalbeispiel:
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | use ieee.numeric_std.all;
|
4 |
|
5 | entity tb_while is
|
6 | end tb_while;
|
7 |
|
8 | architecture tb of tb_while is
|
9 |
|
10 | signal counter : integer := 0;
|
11 |
|
12 | begin
|
13 |
|
14 | process
|
15 | begin
|
16 | while counter < 15 loop
|
17 | wait for 10 ns;
|
18 | counter <= counter + 1;
|
19 | end loop;
|
20 |
|
21 | wait;
|
22 | end process;
|
23 |
|
24 | end;
|
Welchen Wert nimmt counter maximal an?
Ja, richtig, 16.
Warum ist das so?
Weil
while counter < 15 loop
dann schon wieder ausgewertet wird wenn die Addition/Zuweisung
counter <= counter + 1;
noch nicht fertig ist.
Schreibt man noch einen kurzen wait dazu
counter <= counter + 1;
wait for 1 ps;
funktioniert es wie gewünscht.
Meine Frage ist, ob das jetzt schlicht normales Verhalten ist, also
alles OK, oder ob das in aktuelleren Modelsim Versionen anders ist. Ich
verwende die letzte freie von Intel, 2020.1.
Vielen Dank!