display: ein paar fixes... aber es passt trotzdem noch nicht
authorBernhard Urban <lewurm@gmail.com>
Sun, 16 May 2010 21:46:38 +0000 (23:46 +0200)
committerBernhard Urban <lewurm@gmail.com>
Sun, 16 May 2010 21:46:38 +0000 (23:46 +0200)
... nach jedem tastendruck wird der *komplette* eingabe string nochmal
ausgegeben und ich checks einfach nicht warum :/

ausserdem werden die zeichen doppelt uebernommen (ausgenommen das erste
zeichen).

schluss fuer heute.

src/display.vhd
src/history.vhd

index 3a3aac17a79e31ab05a2d9ebdb4de9a42829a652..d01b1150a45716f6fc9d8785531f9a65975f4f7d 100644 (file)
@@ -27,7 +27,7 @@ end entity display;
 
 architecture beh of display is
        type DISPLAY_STATE is (SIDLE, S_NEW_RESULT, S_NEW_INPUT, S_COUNTUP, S_GETCH,
-       S_PUTCH, S_WAIT, S_NOP1);
+       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;
        signal d_spalte_int, d_spalte_next : hspalte;
@@ -78,15 +78,27 @@ begin
                                if d_new_result = '1' then
                                        state_next <= S_NEW_RESULT;
                                end if;
-                       when S_NEW_RESULT | S_NEW_INPUT =>
+                       when S_NEW_RESULT =>
+                               state_next <= S_CR1;
+                       when S_NEW_INPUT =>
                                state_next <= S_COUNTUP;
+                       when S_CR1 =>
+                               if free = '0' then
+                                       state_next <= S_NL1;
+                               end if;
+                       when S_NL1 =>
+                               if free = '0' then
+                                       state_next <= S_COUNTUP;
+                               end if;
                        when S_COUNTUP =>
                                state_next <= S_GETCH;
                        when S_GETCH =>
                                if free = '1' and d_done = '1' then
-                                       state_next <= S_PUTCH;
+                                       state_next <= S_PUTCH1;
                                end if;
-                       when S_PUTCH =>
+                       when S_PUTCH1 =>
+                               state_next <= S_PUTCH2;
+                       when S_PUTCH2 =>
                                if free = '0' or (free = '1' and d_char = x"00") then
                                        state_next <= S_WAIT;
                                end if;
@@ -126,16 +138,23 @@ begin
                                        when "11111" => d_zeile_next <= "00000";
                                        when others => d_zeile_next <= std_logic_vector(unsigned(d_zeile_int) + 1);
                                end case;
+                       when S_CR1 =>
+                               command_next <= COMMAND_SET_CHAR;
+                               command_data_next <= x"ffffff" & x"0d"; -- carrige return
+                       when S_NL1 =>
+                               command_next <= COMMAND_SET_CHAR;
+                               command_data_next <= x"ffffff" & x"0a"; -- newline
                        when S_COUNTUP =>
                                d_get_next <= '1';
                                d_spalte_next <= std_logic_vector(unsigned(d_spalte_int) + 1);
                        when S_GETCH =>
                                d_get_next <= '1';
-                       when S_PUTCH =>
+                       when S_PUTCH1 =>
                                if d_char /= x"00" then
                                        command_next <= COMMAND_SET_CHAR;
                                        command_data_next <= x"ffffff" & std_logic_vector(d_char);
                                end if;
+                       when S_PUTCH2 => null;
                        when S_WAIT | S_NOP1 =>
                                command_next <= COMMAND_NOP;
                                command_data_next <= x"00000000";
index 2f3c2dd0334bd8986e53fa2464c846b673d77859..cd6dbcda6e6f2fc7e3a7a79b26256c56ed999e2f 100644 (file)
@@ -166,7 +166,9 @@ begin
                                wr_next <= '1';
                                address_next <= '0' & std_logic_vector(unsigned(s_cnt_int) - 1);
                                data_in_next <= (others => '0');
-                               s_cnt_next <= std_logic_vector(unsigned(s_cnt_int) - 1);
+                               if unsigned(s_cnt_int) /= 0 then
+                                       s_cnt_next <= std_logic_vector(unsigned(s_cnt_int) - 1);
+                               end if;
                        when S_S_FIN =>
                                finished_next <= '1';
                                s_cnt_next <= (0 => '1', others => '0');