implemented busy state
[hwmod.git] / src / pc_communication.vhd
index b40444682580dddb605740bbba66703fa8517077..89dff252be4bc9cd13891311d76123ad7465a19a 100644 (file)
@@ -24,6 +24,7 @@ entity pc_communication is
                pc_zeile : out hzeile;
                pc_spalte : out hspalte;
                pc_get :  out std_logic;
+               pc_busy : in std_logic; --signals if the history module actually grants our request.
                pc_done : in std_logic;
                pc_char : in hbyte
        );
@@ -104,17 +105,21 @@ begin
                end case;
        end process output_pc;
 
-       next_state_pc : process (btn_a, pc_done, rx_new, rx_data, spalte, state,
-               tx_data_i ,tx_done_i, zeile)
+       next_state_pc : process (btn_a, pc_busy, pc_done, rx_new, rx_data, spalte, 
+               state, tx_data_i ,tx_done_i, zeile)
        begin
                state_next <= state;
                case state is
                        when IDLE =>
-                               if (rx_new = '1' and rx_data = x"0a" ) or btn_a = '1' then
+                               if (rx_new = '1' and rx_data = x"0a" ) or btn_a = '0' then
                                        state_next <= FETCH;
                                end if;
                        when FETCH =>
-                               state_next <= WAIT_HIST;
+                               if pc_busy = '1' then
+                                       state_next <= WAIT_HIST;
+                               else
+                                       state_next <= FETCH;
+                               end if;
                        when WAIT_HIST =>
                                if (pc_done = '1') then
                                        state_next <= FORWARD;