Forum: FPGA, VHDL & Co. Indexed Name is not a xxxType (Hilfe)


von Frage (Gast)


Lesenswert?

Hallo zusammen,

ich verstehe nicht, warum in unterem Beispiel der Fall 2 einen Fehler 
erzeugt (Indexed Name is not a MacAddrType). Was ist der Unterschied 
zwischen den Fällen 1 & 2?

Bei relativ kleinen Arrays kann man ja noch alles mit & Operator 
zusammensetzen (Fall 2). Aber was wenn ich mit größeren Arrays arbeite 
und dem einen Array 100 Elemente aus dem anderen Array zuweisen will?



Beispiel:
1
...
2
3
type MacAddrType is array (5 downto 0) of std_logic_vector(7 downto 0);
4
type RxDatastreamType is array((8 downto 0) of std_logic_vector(7 downto 0);
5
6
signal RxData :RxDatastreamType;
7
signal RxMac :MacAddrType;
8
9
begin
10
11
Fall 1: RxMac(1 downto 0) <= RxData(1 downto 0); -- Fehler
12
Fall 2: RxMac(1 downto 0) <= RxData(1) & RxData(0); -- Kein Fehler
13
14
...

von user (Gast)


Lesenswert?

RxMac und RxData sind nicht von gleichen Typ

definiere es doch so:

type arraytype is array(natural range <>) of std_logic_vector(7 downto 
0);
type MacAddrType is arraytype (5 downto 0);
type RxDatastreamType is arraytye(8 downto 0);

dann sollten beide Varianten funktionieren

von Frage (Gast)


Lesenswert?

user schrieb:
> RxMac und RxData sind nicht von gleichen Typ
>
> definiere es doch so:
>
> type arraytype is array(natural range <>) of std_logic_vector(7 downto
> 0);
> type MacAddrType is arraytype (5 downto 0);
> type RxDatastreamType is arraytye(8 downto 0);
>
> dann sollten beide Varianten funktionieren

Super - Danke! so funktioniert es. Allerdings muss es statt
1
> type MacAddrType is arraytype (5 downto 0);
2
> type RxDatastreamType is arraytye(8 downto 0);

so heißen (Subtype, sonst gibt das einen Error)
1
> type MacAddrType is arraytype (5 downto 0);
2
> type RxDatastreamType is arraytye(8 downto 0);

gruß!

von Frage (Gast)


Lesenswert?

Sry natürlich muss es so heißen:
1
> subtype MacAddrType is arraytype (5 downto 0);
2
> subtype RxDatastreamType is arraytye(8 downto 0);

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.