OpenCores
URL https://opencores.org/ocsvn/rtf8088/rtf8088/trunk

Subversion Repositories rtf8088

[/] [rtf8088/] [trunk/] [rtl/] [verilog/] [DIVIDE.v] - Diff between revs 6 and 7

Show entire file | Details | Blame | View Log

Rev 6 Rev 7
Line 47... Line 47...
                                ld_div16 <= 1'b1;
                                ld_div16 <= 1'b1;
                end
                end
        end
        end
DIVIDE2:
DIVIDE2:
        begin
        begin
 
                $display("DIVIDE2");
                ld_div32 <= 1'b0;
                ld_div32 <= 1'b0;
                ld_div16 <= 1'b0;
                ld_div16 <= 1'b0;
                state <= DIVIDE2a;
                state <= DIVIDE2a;
        end
        end
DIVIDE2a:
DIVIDE2a:
        begin
        begin
 
                $display("DIVIDE2a");
                if (w & div32_done)
                if (w & div32_done)
                        state <= DIVIDE3;
                        state <= DIVIDE3;
                else if (!w & div16_done)
                else if (!w & div16_done)
                        state <= DIVIDE3;
                        state <= DIVIDE3;
        end
        end
 
 
// Assign results to registers
// Assign results to registers
// Trap on divider overflow
// Trap on divider overflow
DIVIDE3:
DIVIDE3:
        begin
        begin
 
                $display("DIVIDE3 state <= IFETCH");
                state <= IFETCH;
                state <= IFETCH;
                if (w) begin
                if (w) begin
                        ax <= q32[15:0];
                        ax <= q32[15:0];
                        dx <= r32[15:0];
                        dx <= r32[15:0];
                        if (TTT[0]) begin
                        if (TTT[0]) begin
                                if (q32[31:16]!={16{q32[15]}}) begin
                                if (q32[31:16]!={16{q32[15]}}) begin
 
                                        $display("DIVIDE Overflow");
                                        int_num <= 8'h00;
                                        int_num <= 8'h00;
                                        state <= INT2;
                                        state <= INT2;
                                end
                                end
                        end
                        end
                        else begin
                        else begin
                                if (q32[31:16]!=16'h0000) begin
                                if (q32[31:16]!=16'h0000) begin
 
                                        $display("DIVIDE Overflow");
                                        int_num <= 8'h00;
                                        int_num <= 8'h00;
                                        state <= INT2;
                                        state <= INT2;
                                end
                                end
                        end
                        end
                end
                end
                else begin
                else begin
                        ax[ 7:0] <= q16[7:0];
                        ax[ 7:0] <= q16[7:0];
                        ax[15:8] <= r16;
                        ax[15:8] <= r16;
                        if (TTT[0]) begin
                        if (TTT[0]) begin
                                if (q16[15:8]!={8{q16[7]}}) begin
                                if (q16[15:8]!={8{q16[7]}}) begin
 
                                        $display("DIVIDE Overflow");
                                        int_num <= 8'h00;
                                        int_num <= 8'h00;
                                        state <= INT2;
                                        state <= INT2;
                                end
                                end
                        end
                        end
                        else begin
                        else begin
                                if (q16[15:8]!=8'h00) begin
                                if (q16[15:8]!=8'h00) begin
 
                                        $display("DIVIDE Overflow");
                                        int_num <= 8'h00;
                                        int_num <= 8'h00;
                                        state <= INT2;
                                        state <= INT2;
                                end
                                end
                        end
                        end
                end
                end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.