parser: kleinere anpassungen. eine aenderung verursacht zwar mehr logic
[hwmod.git] / src / parser.vhd
index 2bf4e9540b74ecdd61b1fa5f8a8354af9a7753f1..39b9a96adac28ca3d9fde605046113962e677361 100644 (file)
@@ -245,42 +245,27 @@ begin
                                        state_next <= SREAD_SPACE_PROC_SIGN;
                                end if;
                        when SREAD_SPACE_PROC | SREAD_SPACE_PROC_SIGN =>
-                               case p_read is
-                                       when x"20" => null;
-                                       when x"2D" =>
-                                               case state_int is
-                                                       when SREAD_SPACE_PROC =>
-                                                               case state_int is
-                                                                       when SREAD_SPACE_PROC => state_next <= SREAD_SIGN;
-                                                                       when others => assert(false) report "wtf @ state3";
-                                                               end case;
-
-                                                       when SREAD_SPACE_PROC_SIGN =>
-                                                               p_rget_next <= '1';
-                                                               case state_int is
-                                                                       when SREAD_SPACE_PROC => state_next <= SREAD_NEXTBYTE;
-                                                                       when SREAD_SPACE_PROC_SIGN => state_next <= SREAD_OP1;
-                                                                       when others => assert(false) report "wtf @ state2";
-                                                               end case;
-
-                                                       when others => assert(false) report "SREAD_SPACE_PROC/3: shouldn't happen";
-                                               end case;
-                                       when others =>
-                                               p_rget_next <= '1';
-                                               case state_int is
-                                                       when SREAD_SPACE_PROC => state_next <= SREAD_NEXTBYTE;
-                                                       when SREAD_SPACE_PROC_SIGN => state_next <= SREAD_OP1;
-                                                       when others => assert(false) report "wtf @ state2";
-                                               end case;
-                               end case;
-
                                if p_rdone = '0' then
                                        case state_int is
                                                when SREAD_SPACE_PROC => state_next <= SREAD_SPACE_GET;
                                                when SREAD_SPACE_PROC_SIGN => state_next <= SREAD_SPACE_GET_SIGN;
                                                when others => assert(false) report "wtf @ state1";
                                        end case;
+                               else
+                                       if p_read = x"2d" and state_int = SREAD_SPACE_PROC then
+                                               -- vorzeichen?
+                                               state_next <= SREAD_SIGN;
+                                       elsif p_read /= x"20" then
+                                               -- leerzeichen sollen ignoriert werden
+                                               p_rget_next <= '1';
+                                               case state_int is
+                                                       when SREAD_SPACE_PROC => state_next <= SREAD_NEXTBYTE;
+                                                       when SREAD_SPACE_PROC_SIGN => state_next <= SREAD_OP1;
+                                                       when others => assert(false) report "SREAD_SPACE_PROC{,_SIGN}: shouldn't happen";
+                                               end case;
+                                       end if;
                                end if;
+
                        when SREAD_SIGN =>
                                z_sign_next <= '1';
                                if p_rdone = '0' then
@@ -336,9 +321,7 @@ begin
                                state_next <= SREAD_OP2;
                        when SREAD_OP2 =>
                                if p_rdone = '0' then
-                                       if aktop_int /= ALU_NOP then
-                                               state_next <= SCALC_1;
-                                       end if;
+                                       state_next <= SCALC_1;
                                end if;
 
                        when SCALC_1 =>
@@ -507,6 +490,9 @@ begin
                                end if;
 
                        when SERROR1 =>
+                               p_wtake_next <= '1';
+                               p_write_next <= hbyte(to_unsigned (character'pos(error_str(err_int)(errc_int)),8));
+                               errc_tmp_next <= errc_int - 1;
                                if p_wdone = '1' then
                                        if errc_int <= 2 then
                                                state_next <= SDONE;
@@ -515,6 +501,7 @@ begin
                                        end if;
                                end if;
                        when SERROR2 =>
+                               errc_next <= errc_tmp_int;
                                if p_wdone = '0' then
                                        state_next <= SERROR1;
                                end if;
@@ -532,13 +519,8 @@ begin
 
                -- fehlerbehandlung
                case state_int is
-                       when SERROR1 =>
-                               p_wtake_next <= '1';
-                               p_write_next <= hbyte(to_unsigned (character'pos(error_str(err_int)(errc_int)),8));
-                               errc_tmp_next <= errc_int - 1;
-                       when SERROR2 =>
-                               errc_next <= errc_tmp_int;
-                       when SDONE => null;
+                       -- diese states sind ausgenommen vom "pokemon-exception-handling"
+                       when SERROR1 | SERROR2 | SDONE => null;
                        when others =>
                                if calc_error = '1' then
                                        if op2_int = 0 then