Hallo,
ich hätte da eine Frage zur VHDL-Syntax. Vielleicht kann sie ja jemand beantworten. Wann sind die Klammer im if-Konstrukt erforderlich oder braucht man sie überhaupt?
Das Code-Beispiel, welches bei mir diese Frage hervorgerufen hat:
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity bcd_counter is port(enable: in std_logic; clock: in std_logic; direction: in std_logic; -- 1 = vorwaerts, 0 = rueckwaerts bcd_output: out std_logic_vector(3 downto 0)); end bcd_counter; architecture behaviour of bcd_counter is -- lokales Signal signal counter: std_logic_vector(bcd_output'range); begin -- nebenlaeufig sequentiellen Prozess starten counter_process: process(clock) if rising_edge(clock) then -- positive Taktflanke? if(enable = '1') then -- eingeschaltet? if(direction = '1') then -- vorwaerts? if counter = "1001" then -- bei 9 ruecksetzen counter <= "0000" -- jetzt wieder 0 else counter <= counter + 1; -- vorwaertszaehlen end if; else -- rueckwaerts if counter = "0000" then -- bei 0 ruecksetzen counter <= "1001"; -- jetzt wieder 9 else counter <= counter - 1; -- rueckwaertszaehlen end if; end if; end if; end if; end process counter_process; -- nebenlaeufig Signal uebernehmen bcd_output <= counter; end behaviour;