parser/alu: extrem mega super sonderfall bugfix
authorBernhard Urban <lewurm@gmail.com>
Fri, 21 May 2010 01:11:15 +0000 (03:11 +0200)
committerBernhard Urban <lewurm@gmail.com>
Fri, 21 May 2010 01:25:06 +0000 (03:25 +0200)
src/alu.vhd
src/beh_alu_tb.do
src/beh_alu_tb.vhd
src/beh_parser_tb.do
src/parser.test
src/parser.vhd

index 014fc766c6f0210f219d1cddd57373cebc9c9304..3a8f54c67ff4d20a9cdc55c74f32ca0da61b878a 100644 (file)
@@ -215,7 +215,15 @@ begin
 
                                        aktdiv_int_next <= op1_var srl (dividend_msb_var - laengediv_var + 1);
 
 
                                        aktdiv_int_next <= op1_var srl (dividend_msb_var - laengediv_var + 1);
 
-                                       if op1_var < op2_var then
+                                       -- anmerkung: xst (xilinx) kann folgende zeile nicht uebersetzen
+                                       -- > if op1 = to_signed(-2147483648, CBITS) then
+                                       -- darum folgende schreibweise ->
+                                       if op1 = x"80000000" then
+                                               -- so ziemlich das boeseste was passieren kann
+                                               div_calc_done2_int <= '1';
+                                               quo_next <= to_signed(-214748364,CBITS);
+                                               aktdiv_int_next <= to_signed(8,CBITS);
+                                       elsif (op1_var < op2_var) then
                                                div_calc_done2_int <= '1';
                                                quo_next <= to_signed(0,CBITS);
                                                aktdiv_int_next <= op1_var;
                                                div_calc_done2_int <= '1';
                                                quo_next <= to_signed(0,CBITS);
                                                aktdiv_int_next <= op1_var;
index a0e954d9aaf0ab7f0062b5a6b7d982e1f2102769..a3a70ed4e78aec4e0ba6b270242def7f3619d359 100644 (file)
@@ -8,11 +8,13 @@ delete wave /beh_alu_tb/inst/op1_int
 delete wave /beh_alu_tb/inst/op1
 delete wave /beh_alu_tb/inst/op1_next
 add wave -radix decimal inst/op1_int
 delete wave /beh_alu_tb/inst/op1
 delete wave /beh_alu_tb/inst/op1_next
 add wave -radix decimal inst/op1_int
+add wave -radix decimal inst/op1
 
 delete wave /beh_alu_tb/inst/op2_int
 delete wave /beh_alu_tb/inst/op2
 delete wave /beh_alu_tb/inst/op2_next
 add wave -radix decimal inst/op2_int
 
 delete wave /beh_alu_tb/inst/op2_int
 delete wave /beh_alu_tb/inst/op2
 delete wave /beh_alu_tb/inst/op2_next
 add wave -radix decimal inst/op2_int
+add wave -radix decimal inst/op2
 
 delete wave /beh_alu_tb/inst/op3_int
 delete wave /beh_alu_tb/inst/op3
 
 delete wave /beh_alu_tb/inst/op3_int
 delete wave /beh_alu_tb/inst/op3
index aba54cb514cb1fdde1edd792e4c49ed0e6206323..de347a1917dbe05521dedb8862b4905a621e6a46 100644 (file)
@@ -116,6 +116,9 @@ begin
                          56 => (5134123, ALU_DIV, 358015, 121913, 14, false),
                          -- extra
                          60 => (5, ALU_SUB, -2147483648, 0, 0, true),
                          56 => (5134123, ALU_DIV, 358015, 121913, 14, false),
                          -- extra
                          60 => (5, ALU_SUB, -2147483648, 0, 0, true),
+                         61 => (-2147483647, ALU_SUB, 1, 0, -2147483648, false),
+                         62 => (-2147483647, ALU_ADD, -1, 0, -2147483648, false),
+                         63 => (-2147483648, ALU_DIV, 10, 8, -214748364, false),
                          others => (0, ALU_ADD, 0, 0, 0, false)
                        );
                variable checkall : boolean := true;
                          others => (0, ALU_ADD, 0, 0, 0, false)
                        );
                variable checkall : boolean := true;
index 4f70701dbb57fb6fe59cb13a9b15ca2c38690423..f5dac6e63ee971a5791f9743f3eb4feb1bedbc4c 100644 (file)
@@ -45,6 +45,8 @@ delete wave /beh_parser_tb/inst/p_write
 add wave -hex inst/p_write_int
 add wave -hex inst/p_write_next
 
 add wave -hex inst/p_write_int
 add wave -hex inst/p_write_next
 
+delete wave /beh_parser_tb/inst/*_next
+
 
 #rauszoomen
 wave zoomout 500.0
 
 #rauszoomen
 wave zoomout 500.0
index afd7d9ac9126e9b2b9740421e95b63f9f84c09b2..a507576fc0204ab452bdae5f3af27f435cbdb312 100644 (file)
 # t38
 5--2147483648
  > Fehler:                             Over- bzw. Underflow            
 # t38
 5--2147483648
  > Fehler:                             Over- bzw. Underflow            
+# t39
+-2147483647-1
+-2147483648
+# t40
+-1073741824+-1073741824
+-2147483648
index c74b4cb1e801dacda11a7121a545b145bc64cd7c..8fa3a2b3c38a8679d275ff5bfd3d8956802d7354 100644 (file)
@@ -248,7 +248,9 @@ begin
                                end if;
                        when SWRITE_CHAR1 =>
                                if p_wdone = '1' then
                                end if;
                        when SWRITE_CHAR1 =>
                                if p_wdone = '1' then
-                                       if strich_int < 10 then
+                                       -- ueberpruefung auf -2147483648 fuer testfall 39 und 40
+                                       -- x"80000000": xst (xilinx) workaround
+                                       if strich_int < 10 and strich_int /= x"80000000" then
                                                if z_sign_int = '1' then
                                                        state_next <= SWRITE_SIGN1;
                                                else
                                                if z_sign_int = '1' then
                                                        state_next <= SWRITE_SIGN1;
                                                else
@@ -534,7 +536,13 @@ begin
                                opp_next <= aktop_int;
 
                        when SWRITE_CHAR0 =>
                                opp_next <= aktop_int;
 
                        when SWRITE_CHAR0 =>
-                               op1_next <= strich_int;
+                               -- fuer testfall 39 und 40
+                               if strich_int = to_signed(-214748364,CBITS) then
+                                       op1_next <= to_signed(214748364,CBITS);
+                                       strich_next <= to_signed(214748364,CBITS);
+                               else
+                                       op1_next <= strich_int;
+                               end if;
                                opcode_next <= ALU_DIV;
                                op2_next <= to_signed(10,CBITS);
                                do_calc_next <= '1';
                                opcode_next <= ALU_DIV;
                                op2_next <= to_signed(10,CBITS);
                                do_calc_next <= '1';