Forum: FPGA, VHDL & Co. LUT mit for loop: Synthesefehler


von T.M. (Gast)


Lesenswert?

Hallo,

ich bin grad dabei, einen Umsetzer zu bauen. Der soll einen 20 bit
breiten Vector, der 5 Integerzahlen enthält, in einen 40 bit breiten
Vector, der diese Zahlen als Ascii Code enthält, umsetzen. Dieser soll
dann als Datenlieferant für ein Textdisplay dienen.

Ich habe folgenden Code unten geschrieben, der syntaktisch dorch
richtig sein sollte, oder? Trotzdem kommt bei der Synthese mit dem
Webpack immer:

ERROR:HDLParsers:839 - ".../LCD_TREIBER/lcd_dec_int_to_ascii.vhd"
Line 20. Selector (Slice name of type std_logic_vector) is an
unconstrained array.

Liegt das daran, dass bei der select-Anweisung kein statischer Wert
drin steht? Oder dass er nicht weiss, ob ich überhaupt die Länge von
data_in einhalte? Eigentlich müsste es ja funzen... Vielleicht hat ja
jemand eine Idee. Habe keine Lust, die case Anweisung 5 mal zu
schreiben, das würde zwar das Probelm wohl lösen, aber das kanns ja
wohl nicht sein.
1
entity lcd_dec_int_to_ascii is
2
Port (data_in:   in  std_logic_vector(19 downto 0);
3
      data_out:   out std_logic_vector(39 downto 0));
4
end lcd_dec_int_to_ascii;
5
6
architecture Verhalten of lcd_dec_int_to_ascii is
7
begin
8
9
LUT: process(data_in)
10
begin
11
for index in 1 to 5 loop
12
  case data_in(4*index-1 downto 4*index-4) is
13
    when  x"1" => data_out(8*index-1  downto 8*index-8) <= x"31";
14
    when  x"2" => data_out(8*index-1  downto 8*index-8) <= x"32";
15
    when  x"3" => data_out(8*index-1  downto 8*index-8) <= x"33";
16
    when  x"4" => data_out(8*index-1  downto 8*index-8) <= x"34";
17
    when  x"5" => data_out(8*index-1  downto 8*index-8) <= x"35";
18
    when  x"6" => data_out(8*index-1  downto 8*index-8) <= x"36";
19
    when  x"7" => data_out(8*index-1  downto 8*index-8) <= x"37";
20
    when  x"8" => data_out(8*index-1  downto 8*index-8) <= x"38";
21
    when  x"9" => data_out(8*index-1  downto 8*index-8) <= x"39";
22
    when  others => data_out(8*index-1  downto 8*index-8) <= x"30";
23
  end case;
24
end loop;
25
end process;
26
27
end Verhalten;

Danke schonmal.

T.M.

von T.M. (Gast)


Lesenswert?

Hab das ganze jetzt mit if/elsif/else gelöst, da geht es. Bei case muss
wohl der Kontrollausdruck statisch sein... Nun müssten zwar die
Gatterlaufzeiten unterschiedlich lang sein für jeden Zweig, weil ja ein
Prioritätsencoder synthetisiert wird laut Literatur, aber das stört in
meinem Design nicht...
1
LUT: process(data_in)
2
begin
3
for index in 1 to 5 loop
4
  if data_in(4*index-1 downto 4*index-4) = x"1" then
5
    data_out(8*index-1  downto 8*index-8) <= x"31";
6
  elsif data_in(4*index-1 downto 4*index-4) = x"2" then
7
   data_out(8*index-1  downto 8*index-8) <= x"32";
8
  elsif data_in(4*index-1 downto 4*index-4) = x"3" then
9
   data_out(8*index-1  downto 8*index-8) <= x"33";
10
  elsif data_in(4*index-1 downto 4*index-4) = x"4" then
11
   data_out(8*index-1  downto 8*index-8) <= x"34";
12
  elsif data_in(4*index-1 downto 4*index-4) = x"5" then
13
   data_out(8*index-1  downto 8*index-8) <= x"35";
14
  elsif data_in(4*index-1 downto 4*index-4) = x"6" then
15
   data_out(8*index-1  downto 8*index-8) <= x"36";
16
  elsif data_in(4*index-1 downto 4*index-4) = x"7" then
17
   data_out(8*index-1  downto 8*index-8) <= x"37";
18
  elsif data_in(4*index-1 downto 4*index-4) = x"8" then
19
   data_out(8*index-1  downto 8*index-8) <= x"38";
20
  elsif data_in(4*index-1 downto 4*index-4) = x"9" then
21
   data_out(8*index-1  downto 8*index-8) <= x"39";
22
  else
23
   data_out(8*index-1  downto 8*index-8) <= x"30";
24
  end if;
25
end loop;
26
end process;

von Thomas Pototschnig (Gast)


Lesenswert?

Wieso machst du nicht sowas?

for index in 1 to 5 loop
  data_out(8*index-1 downto 8*index-4) <= x"3";
  data_out(8*index-5 downto 8*index-8) <= data_in(4*index-1 downto
4*index-4);
end loop;

(fehlt noch die Überprüfung, falls andere werte reinkommen)

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.