From: Bernhard Urban Date: Fri, 21 May 2010 01:11:15 +0000 (+0200) Subject: parser/alu: extrem mega super sonderfall bugfix X-Git-Tag: abgabe~75 X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=hwmod.git;a=commitdiff_plain;h=67bd159bb1c72ba8eaf46e072932a6f19c8347b6 parser/alu: extrem mega super sonderfall bugfix --- diff --git a/src/alu.vhd b/src/alu.vhd index 014fc76..3a8f54c 100644 --- a/src/alu.vhd +++ b/src/alu.vhd @@ -215,7 +215,15 @@ begin 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; diff --git a/src/beh_alu_tb.do b/src/beh_alu_tb.do index a0e954d..a3a70ed 100644 --- a/src/beh_alu_tb.do +++ b/src/beh_alu_tb.do @@ -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 +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 +add wave -radix decimal inst/op2 delete wave /beh_alu_tb/inst/op3_int delete wave /beh_alu_tb/inst/op3 diff --git a/src/beh_alu_tb.vhd b/src/beh_alu_tb.vhd index aba54cb..de347a1 100644 --- a/src/beh_alu_tb.vhd +++ b/src/beh_alu_tb.vhd @@ -116,6 +116,9 @@ begin 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; diff --git a/src/beh_parser_tb.do b/src/beh_parser_tb.do index 4f70701..f5dac6e 100644 --- a/src/beh_parser_tb.do +++ b/src/beh_parser_tb.do @@ -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 +delete wave /beh_parser_tb/inst/*_next + #rauszoomen wave zoomout 500.0 diff --git a/src/parser.test b/src/parser.test index afd7d9a..a507576 100644 --- a/src/parser.test +++ b/src/parser.test @@ -114,3 +114,9 @@ # t38 5--2147483648 > Fehler: Over- bzw. Underflow +# t39 +-2147483647-1 +-2147483648 +# t40 +-1073741824+-1073741824 +-2147483648 diff --git a/src/parser.vhd b/src/parser.vhd index c74b4cb..8fa3a2b 100644 --- a/src/parser.vhd +++ b/src/parser.vhd @@ -248,7 +248,9 @@ begin 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 @@ -534,7 +536,13 @@ begin 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';