Hallo zusammen,
ich habe mal wieder eine Tool-Frage, diesmal bekomme ich meinen Code mit
dem Active HDL 3.5 nicht kompiliert. Nachfolgend habe ich den Code mal
abstrahiert, um den Fehler zu reproduzieren.
Wenn ich die nachfolgenden Componente mit dem generic
gComponentIndex = 0 kompiliere, erhalte ich die Fehlermeldung
1 | # ELAB2: Fatal Error: ELAB2_0013 MyComponent.vhd (22): Index -16 is out of range (15 downto 0) of "oVector".
|
gComponentIndex = 1 führt entsprechend zu
1 | # ELAB2: Fatal Error: ELAB2_0013 MyComponent.vhd (22): Index -15 is out of range (15 downto 0) of "oVector"..
|
und gComponentIndex = 16 zu
1 | # ELAB2: Fatal Error: ELAB2_0013 MyComponent.vhd (22): Index 16 is out of range (15 downto 0) of "oVector".
|
etc.
Schuld sind also die beiden Zuweisungen auf oVector.
Seltsamer Weise machen die Zuweisungen auf oBit keine Probleme, obwohl
das Prinzip gleich ist, nur dass die der Index rechts von der Zuweisung
berechnet wird.
Die Synthese kommt mit dem Code gut zurechet.
1 | library IEEE;
|
2 | use IEEE.std_logic_1164.all;
|
3 | use ieee.numeric_std.all;
|
4 |
|
5 | entity myComponent is
|
6 | generic (
|
7 | gComponentIndex : integer range 0 to 31
|
8 | );
|
9 | port
|
10 | (
|
11 | iSysRst : in std_logic;
|
12 | iSysClk : in std_logic;
|
13 | iBit : in std_logic;
|
14 | iVector : in std_logic_vector( 15 downto 0);
|
15 | oBit : out std_logic;
|
16 | oVector : out std_logic_vector( 15 downto 0)
|
17 | );
|
18 | end myComponent;
|
19 |
|
20 | architecture RTL of myComponent is
|
21 | begin
|
22 | plMyProcess : process (iSysRst, iSysClk)
|
23 | begin
|
24 | if rising_edge(iSysClk) then
|
25 |
|
26 | if gComponentIndex < 16 then
|
27 | oVector(gComponentIndex) <= iBit;
|
28 | end if;
|
29 |
|
30 | if (gComponentIndex > 16) and (gComponentIndex < 32) then
|
31 | oVector(gComponentIndex - 16) <= iBit;
|
32 | end if;
|
33 |
|
34 | if gComponentIndex < 16 then
|
35 | oBit <= iVector(gComponentIndex);
|
36 | end if;
|
37 |
|
38 | if gComponentIndex >= 16 and gComponentIndex < 32 then
|
39 | oBit <= iVector(gComponentIndex - 16);
|
40 | end if;
|
41 | ...
|
Zum technischen Hintergrund:
Ich habe mehrere Componenten mit jeweils einem interne Adressdecoder.
Dieser ist für alle gleich, soll aber abhängig vom Componenten Index nur
auf bestimmte Adressen reagieren. Teilweise soll auch nur ein Bit des
einen oder anderen Datenregisters gelesen oder gesetzt werden. Alle
Ausgänge der Adressdecoder werden abschließend miteinander verodert.
Habt Ihr eine Idee, wie ich das Problem lösen kann, dass die Simulation
es schluckt? Wie kann ich einzelne Zuweisungen in einem getakteten
Prozess abhängig von einem Generic "ausklammern"?