muhh schrieb:
> the following signal(s) form a combinatorial loop: Q.
Der Synthesizer sieht, dass Q und Qi gleich sind und meckert am Q herum,
obwohl er eigentlich Qi meint: du machst eine nicht getaktete Zuweisung
von Qi an Qi.
http://www.lothar-miller.de/s9y/archives/42-Kombinatorische-Schleifen.html
Klar kannst du jetzt sagen: aber das müsste doch gehen, weil ja noch ein
weiteres Signal mit reinkommt. Aber: der Synthesizer sieht das nicht.
Und deshalb ist genau dieser Prozess hier ...
1 | process(Yi, Qi)
|
2 | begin
|
3 | for K in 0 to NBit-1 loop
|
4 | if K=0 then
|
5 | Qi <= Yi(0);
|
6 | elsif K>0 then
|
7 | Qi <= Qi and Yi(K);
|
8 | end if;
|
9 | end loop;
|
10 | end process;
|
... das Paradebeispiel, wo eine Variable nötig und sinnvoll ist.
Probiers mal so:
1 | process(Yi, Qi)
|
2 | variable tmp : std_logic;
|
3 | begin
|
4 | for K in 0 to NBit-1 loop
|
5 | if K=0 then
|
6 | tmp := Yi(0);
|
7 | elsif K>0 then
|
8 | tmp := tmp and Yi(K);
|
9 | end if;
|
10 | end loop;
|
11 | Qi <= tmp;
|
12 | end process;
|
Oder kürzer so:
1 | process(Yi, Qi)
|
2 | variable tmp : std_logic;
|
3 | begin
|
4 | for K in 0 to NBit-1 loop
|
5 | if K=0 then
|
6 | tmp := Yi(0);
|
7 | else
|
8 | tmp := tmp and Yi(K);
|
9 | end if;
|
10 | end loop;
|
11 | Qi <= tmp;
|
12 | end process;
|
Oder mit einem passenden Startwert noch kürzer so:
1 | process(Yi, Qi)
|
2 | variable tmp : std_logic;
|
3 | begin
|
4 | tmp := '1';
|
5 | for K in 0 to NBit-1 loop
|
6 | tmp := tmp and Yi(K);
|
7 | end loop;
|
8 | Qi <= tmp;
|
9 | end process;
|
Warum schreibst du das hier:
1 | component x_nor
|
2 | port ( A : in std_logic;
|
3 | B : in std_logic;
|
4 | Y : out std_logic );
|
5 | end component;
|
6 |
|
7 | begin
|
8 |
|
9 | COMP: for K in 0 to NBit-1 generate
|
10 | XN: x_nor port map ( A => D0i(K),
|
11 | B => D1i(K),
|
12 | Y => Yi(K) );
|
13 |
|
14 | end generate COMP;
|
nicht einfach so:
Und warum ist hier ein elsif?
1 | if K=0 then
|
2 | Qi <= Yi(0);
|
3 | elsif K>0 then
|
4 | Qi <= Qi and Yi(K);
|
5 | end if;
|
Was könnte K ausser 0 sonst noch sein??
Oder das Ganze einfach so:
1 | Q <= '1' when A=B else '0';
|
> die Simulation
Welche denn?
> D0i <= D0;
> D1i <= D1;
Diese Zuweisung von Eingängen an interne Signale ist unnötig.