Array aus struct
- token structure:
cmd | 4 x midi_data (note + velocity) | numb_notes - aus den Token wird ein Array gebildet
token_array() . token_line_1 . command . midi_data . note . velocity . token_number . token_line_2
- Midi-Data Struktur bilden
-- define midi_data type t_midi_data is record note : std_logic_vector(7 downto 0); velocity : std_logic_vector(7 downto 0); end record; -- initialise (if needed) variable data_1: t_midi_data;
2. Array für Midi-Data (weil es 4 x vorkommt)
-- define type t_midi_data_array is array (3 downto 0) of t_midi_data; -- initalise (if needed) signal data_array: t_midi_data_array;
3. Ganze Token Struktur zusammensetzen
-- define type t_token is record token_cmd : string(1 to 5); token_midi_data : t_midi_data_array; token_number : std_logic_vector(3 downto 0); end record; -- initialize (if needed) signal token_linie: t_token;
4. Mehrere Token zu einem Array zusammenfassen
CONSTANT NUMBR_INPUTLINES: natural := 8; -- define type t_token_array is array( NUMBR_INPUTLINES-1 downto 0) of t_token; -- initialise signal token_array_input: t_token_array;
Grundsätzlich braucht es keine Signale, da die Inputs direkt in input-array eingelesen werden und Zuweisungen direkt vom Array an das entsprechende Signal gegeben wird.
Einziges Signal das es braucht ist über das Gesamt-Array, damit es angesprochen werden kann.
————————————————————————————-
Werte zuweisen
t_token_array() . token_line_1 . command . midi_data . note . velocity . token_number . token_line_2 -- initialisation signal s_input_array: t_token_array;
s_token_line_1 <= s_input_array(0); s_token_command <= s_input_array(0).command; s_token_note_1 <= s_input_array(0).midi_data(1).note; s_tk_velocity_1 <= s_input_array(0).m_data(1).vlcty; s_token_note_2 <= s_input_array(0).midi_data(2).note; s_tk_velocity_2 <= s_input_array(0).m_data(2).vlcty; s_token_number <= s_input_array(0);
Die einzelnen Variablen werden mit dem Namen angesprochen.
…