display/history: unnoetiges weg, kthx
[hwmod.git] / src / display.vhd
index 17a717e7ef6243c9b21a6a9ccaaf0d16d3c3d786..ed8cac9a8e755afa053b2438b4a9e77982778b28 100644 (file)
@@ -26,7 +26,7 @@ entity display is
 end entity display;
 
 architecture beh of display is
-       type DISPLAY_STATE is (S_INIT, SIDLE, S_NEW_RESULT, S_NEW_INPUT, S_COUNTUP, S_GETCH,
+       type DISPLAY_STATE is (SIDLE, S_NEW_RESULT, S_NEW_INPUT, S_COUNTUP, S_GETCH,
        S_CR1, S_NL1, S_PUTCH1, S_PUTCH2, S_WAIT, S_NOP1);
        signal state_int, state_next : DISPLAY_STATE;
        signal d_zeile_int, d_zeile_next : hzeile;
@@ -34,6 +34,7 @@ architecture beh of display is
        signal d_get_int, d_get_next : std_logic;
        signal command_int, command_next : std_logic_vector(7 downto 0);
        signal command_data_int, command_data_next : std_logic_vector(31 downto 0);
+       signal istate_next, istate_int : signed(2 downto 0);
 begin
        d_zeile <= d_zeile_int;
        d_spalte <= d_spalte_int;
@@ -45,7 +46,8 @@ begin
        begin
                if sys_res_n = '0' then
                        -- internal
-                       state_int <= S_INIT;
+                       state_int <= SIDLE;
+                       istate_int <= (others => '0');
                        -- out
                        d_zeile_int <= (others => '0');
                        d_spalte_int <= (others => '0');
@@ -55,6 +57,7 @@ begin
                elsif rising_edge(sys_clk) then
                        -- internal
                        state_int <= state_next;
+                       istate_int <= istate_next;
                        -- out
                        d_zeile_int <= d_zeile_next;
                        d_spalte_int <= d_spalte_next;
@@ -66,14 +69,14 @@ begin
 
        -- next state
        process(state_int, d_new_result, d_new_eingabe, d_done, free, d_spalte_int,
-               d_char)
+               d_char, istate_int)
        begin
                state_next <= state_int;
+               istate_next <= istate_int;
 
                case state_int is
-                       when S_INIT =>
-                               state_next <= SIDLE;
                        when SIDLE =>
+                               istate_next <= b"111"; -- default: immer wieder ins SIDLE;
                                if d_new_eingabe = '1' then
                                        state_next <= S_NEW_INPUT;
                                end if;
@@ -86,11 +89,13 @@ begin
                                state_next <= S_COUNTUP;
                        when S_CR1 =>
                                if free = '0' then
-                                       state_next <= S_NL1;
+                                       state_next <= S_WAIT;
+                                       istate_next <= b"000"; -- => danach S_NL1
                                end if;
                        when S_NL1 =>
                                if free = '0' then
-                                       state_next <= S_COUNTUP;
+                                       state_next <= S_WAIT;
+                                       istate_next <= b"111"; -- => wieder nach SIDLE
                                end if;
                        when S_COUNTUP =>
                                state_next <= S_GETCH;
@@ -110,12 +115,10 @@ begin
                                end if;
                        when S_NOP1 =>
                                if free = '1' then
-                                       state_next <= SIDLE;
-                                       --if unsigned(d_spalte_int) = 71 then
-                                       --      state_next <= SIDLE;
-                                       --else
-                                       --      state_next <= S_COUNTUP;
-                                       --end if;
+                                       case istate_int is
+                                               when b"000" => state_next <= S_NL1;
+                                               when others => state_next <= SIDLE;
+                                       end case;
                                end if;
                end case;
        end process;
@@ -131,9 +134,6 @@ begin
                command_data_next <= command_data_int;
 
                case state_int is
-                       when S_INIT =>
-                               d_spalte_next <= (others => '0');
-                               d_zeile_next <= (others => '0');
                        when SIDLE =>
                                null;
                        when S_NEW_INPUT =>