Ich versuche verzweifelt einen substring aus einem string zu extrahieren. ... variable str : string(1 to 16); variable str_2digits : string(1 to 2); begin str_2digits := str(1 to 2); -- kein Erfolg str_2digits(1) := str(1); -- kein Erfolg str_2digits(2) := str(2); str_2digits := str(1) & str(2); -- ebenfalls kein Erfolg Kann mir jemand dazu einen Tipp geben. Danke.
atrx schrieb: > Kann mir jemand dazu einen Tipp geben. Keine Variablen zu verwenden, wenn man nicht weiß wo und warum. Hier geht alles:
1 | entity substring is |
2 | end entity substring; |
3 | |
4 | architecture test of substring is |
5 | |
6 | begin
|
7 | |
8 | process
|
9 | variable str : string(1 to 16); |
10 | variable str_2digits : string(1 to 2); |
11 | begin
|
12 | str_2digits := str(1 to 2); -- kein Erfolg |
13 | |
14 | str_2digits(1) := str(1); -- kein Erfolg |
15 | str_2digits(2) := str(2); |
16 | |
17 | str_2digits := str(1) & str(2); -- ebenfalls kein Erfolg |
18 | wait; |
19 | end process; |
20 | |
21 | end architecture test; |
1 | $ vcom substring.vhd |
2 | Start time: 16:17:42 on Nov 03,2016 |
3 | vcom substring.vhd |
4 | Model Technology ModelSim SE-64 vcom 10.3d Compiler 2014.10 Oct 7 2014 |
5 | -- Loading package STANDARD |
6 | -- Compiling entity substring |
7 | -- Compiling architecture test of substring |
8 | End time: 16:17:42 on Nov 03,2016, Elapsed time: 0:00:00 |
9 | Errors: 0, Warnings: 0 |
Duke
atrx schrieb: > Kann mir jemand dazu einen Tipp geben. Sieht doch eigentlich gut aus. Wie kommst Du darauf, dass es nicht funktioniert?