parser: vereinfachungen und kleinere verbesserungen
authorBernhard Urban <lewurm@gmail.com>
Mon, 10 May 2010 23:32:18 +0000 (01:32 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 10 May 2010 23:32:18 +0000 (01:32 +0200)
src/parser.vhd

index c2e6ed3f4e41b81cd772307cbec7b9420105f259..22c733b1a972b1f11af484ac7aca0a94bb0ff14d 100644 (file)
@@ -126,14 +126,18 @@ begin
                        when SREAD_CALCNUMBER1 =>
                                state_next <= SREAD_CALCNUMBER2;
                        when SREAD_CALCNUMBER2 =>
-                               if aktop_int /= ALU_NOP then
-                                       state_next <= SCALC_1;
-                               else
-                                       state_next <= SREAD_NEXTBYTE;
+                               if p_rdone = '0' then
+                                       if aktop_int /= ALU_NOP then
+                                               state_next <= SCALC_1;
+                                       else
+                                               state_next <= SREAD_NEXTBYTE;
+                                       end if;
                                end if;
                        when SCALC_1 =>
                                if calc_done = '1' then
                                        case opp_int is
+                                               -- spezialfall: eine zwischenberechnung wird fuer diese
+                                               -- kombination benoetigt
                                                when ALU_MUL | ALU_DIV =>
                                                        case aktop_int is
                                                                when ALU_ADD | ALU_SUB | ALU_DONE => state_next <= SCALC_14;
@@ -306,14 +310,10 @@ begin
 
                                        when ALU_MUL | ALU_DIV =>
                                                case aktop_int is
-                                                       when ALU_ADD | ALU_SUB | ALU_DONE =>
-                                                               op2_next <= z_int;
-                                                               opcode_next <= opp_int;
+                                                       when ALU_ADD | ALU_SUB | ALU_DONE | ALU_MUL | ALU_DIV =>
                                                                op1_next <= punkt_int;
-                                                       when ALU_MUL | ALU_DIV =>
-                                                               op2_next <= z_int;
                                                                opcode_next <= opp_int;
-                                                               op1_next <= punkt_int;
+                                                               op2_next <= z_int;
                                                        when others => assert(false) report "SCALC_1/2: shouldn't happen!";
                                                end case;
                                        when others => assert(false) report "SCALC_1/3: shouldn't happen!";
@@ -321,34 +321,22 @@ begin
                                do_calc_next <= '1';
 
                        when SCALC_14 =>
-                               case opp_int is
-                                       when ALU_MUL | ALU_DIV =>
-                                               case aktop_int is
-                                                       when ALU_ADD | ALU_SUB | ALU_DONE =>
-                                                               op1_next <= op3;
-                                                               do_calc_next <= '0';
-                                                       when others => assert(false) report("SCALC_14/1: bla!");
-                                               end case;
-                                       when others => assert(false) report("SCALC_14/2: bla!");
-                               end case;
+                               -- ueberpruefung kann man sich sparen, da diese ohnehin in
+                               -- nextstate gemacht wird.
+                               op1_next <= op3;
+                               do_calc_next <= '0';
 
                        when SCALC_15 =>
-                               case opp_int is
-                                       when ALU_MUL | ALU_DIV =>
-                                               case aktop_int is
-                                                       when ALU_ADD | ALU_SUB | ALU_DONE =>
-                                                               opcode_next <= ALU_ADD;
-                                                               op2_next <= strich_int;
-                                                               punkt_next <= (0 => '1', others => '0');
-                                                               do_calc_next <= '1';
-                                                       when others => assert(false) report("SCALC_15/1: bla!");
-                                               end case;
-                                       when others => assert(false) report("SCALC_15/2: bla!");
-                               end case;
+                               -- ueberpruefung kann man sich sparen, da diese ohnehin in
+                               -- nextstate gemacht wird.
+                               opcode_next <= ALU_ADD;
+                               op2_next <= strich_int;
+                               punkt_next <= (0 => '1', others => '0');
+                               do_calc_next <= '1';
 
                        when SCALC_2 =>
                                case opp_int is
-                                       when ALU_NOP | ALU_ADD | ALU_SUB =>
+                                       when ALU_NOP | ALU_ADD | ALU_SUB | ALU_MUL | ALU_DIV =>
                                                case aktop_int is
                                                        when ALU_ADD | ALU_SUB | ALU_DONE =>
                                                                strich_next <= op3;
@@ -356,17 +344,9 @@ begin
                                                                punkt_next <= op3;
                                                        when others => assert (false) report "SCALC_2/1: shouldn't happen!";
                                                end case;
-                                       when ALU_MUL | ALU_DIV =>
-                                               case aktop_int is
-                                                       when ALU_ADD | ALU_SUB | ALU_DONE =>
-                                                               strich_next <= op3;
-                                                       when ALU_MUL | ALU_DIV =>
-                                                               punkt_next <= op3;
-                                                       when others => assert(false) report "SCALC_2/2: shouldn't happen!";
-                                               end case;
-                                       when others => assert (false) report "SCALC_2/3: shouldn't happen!";
+                                       when others => assert (false) report "SCALC_2/2: shouldn't happen!";
                                end case;
-
+                               -- aktuelle rechenoperation fuer naechste 'runde' uebernehmen
                                opp_next <= aktop_int;
 
                        when SWRITE_CHAR1 =>