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

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [t6507lp_fsm.v] - Diff between revs 120 and 128

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 120 Rev 128
Line 216... Line 216...
                        state <= next_state;
                        state <= next_state;
 
 
                        case (state)
                        case (state)
                                RESET: begin    // The processor was reset
                                RESET: begin    // The processor was reset
                                        sp <= 9'b100000000; // this prevents flipflops with different drivers
                                        sp <= 9'b100000000; // this prevents flipflops with different drivers
                                        $write("under reset");
                                        //$write("under reset"); 
                                end
                                end
                                /*
                                /*
                                FETCH_OP: executed when the processor was reset or the last instruction could not fetch.
                                FETCH_OP: executed when the processor was reset or the last instruction could not fetch.
                                FETCH_OP_CALC_PARAM: enables the alu with an argument (alu_a) and fetchs the next instruction opcode. (pipelining)
                                FETCH_OP_CALC_PARAM: enables the alu with an argument (alu_a) and fetchs the next instruction opcode. (pipelining)
                                */
                                */
Line 562... Line 562...
                                DUMMY: begin
                                DUMMY: begin
                                        address <= sp;
                                        address <= sp;
                                        mem_rw <= MEM_WRITE;
                                        mem_rw <= MEM_WRITE;
                                end
                                end
                                default: begin
                                default: begin
                                        $write("unknown state"); // TODO: check if synth really ignores this 2 lines. Otherwise wrap it with a `ifdef 
                                        //$write("unknown state"); // TODO: check if synth really ignores this 2 lines. Otherwise wrap it with a `ifdef 
                                        $finish(0);
                                        //$finish(0); 
                                end
                                end
 
 
                        endcase
                        endcase
                end
                end
        end
        end
Line 609... Line 609...
                                                alu_opcode = ir;
                                                alu_opcode = ir;
                                                alu_enable = 1'b1;
                                                alu_enable = 1'b1;
                                                alu_a = 8'h00;
                                                alu_a = 8'h00;
                                        end
                                        end
                                        else begin
                                        else begin
                                                $write("unknown behavior");
                                                //$write("unknown behavior"); 
                                                $finish(0);
                                                //$finish(0);
                                        end
                                        end
                                end
                                end
                                else if (zero_page_indexed) begin
                                else if (zero_page_indexed) begin
                                        next_state = READ_MEM_CALC_INDEX;
                                        next_state = READ_MEM_CALC_INDEX;
                                end
                                end
Line 723... Line 723...
                                        next_state = WRITE_MEM;
                                        next_state = WRITE_MEM;
                                        alu_enable = 1'b1;
                                        alu_enable = 1'b1;
                                        alu_opcode = ir;
                                        alu_opcode = ir;
                                end
                                end
                                else begin
                                else begin
                                        $write("unknown behavior");
                                        //$write("unknown behavior"); 
                                        $finish(0);
                                        //$finish(0);
                                end
                                end
                        end
                        end
                        FETCH_HIGH: begin
                        FETCH_HIGH: begin
                                if (jump_indirect) begin
                                if (jump_indirect) begin
                                        next_state = READ_FROM_POINTER;
                                        next_state = READ_FROM_POINTER;
Line 741... Line 741...
                                end
                                end
                                else if (write) begin
                                else if (write) begin
                                        next_state = WRITE_MEM;
                                        next_state = WRITE_MEM;
                                end
                                end
                                else begin
                                else begin
                                        $write("unknown behavior");
                                        //$write("unknown behavior"); 
                                        $finish(0);
                                        //$finish(0);
                                end
                                end
                        end
                        end
                        READ_MEM_CALC_INDEX: begin
                        READ_MEM_CALC_INDEX: begin
                                if (read || read_modify_write) begin
                                if (read || read_modify_write) begin
                                        next_state = READ_MEM;
                                        next_state = READ_MEM;
Line 755... Line 755...
                                        alu_opcode = ir;
                                        alu_opcode = ir;
                                        alu_enable = 1'b1;
                                        alu_enable = 1'b1;
                                        next_state = WRITE_MEM;
                                        next_state = WRITE_MEM;
                                end
                                end
                                else begin
                                else begin
                                        $write("unknown behavior");
                                        //$write("unknown behavior"); 
                                        $finish(0);
                                        //$finish(0);
                                end
                                end
                        end
                        end
                        READ_MEM: begin
                        READ_MEM: begin
                                if (read) begin
                                if (read) begin
                                        next_state = FETCH_OP_CALC_PARAM;
                                        next_state = FETCH_OP_CALC_PARAM;
Line 1038... Line 1038...
                        end
                        end
                        JSR_ABS: begin
                        JSR_ABS: begin
                                jsr = 1'b1;
                                jsr = 1'b1;
                        end
                        end
                        default: begin
                        default: begin
                                $write("state : %b", state);
                                //$write("state : %b", state);
                                if (reset_n == 1'b1 && state != FETCH_OP_FIX_PC) begin // the processor is NOT being reset neither it is fixing the pc
                                if (reset_n == 1'b1 && state != FETCH_OP_FIX_PC) begin // the processor is NOT being reset neither it is fixing the pc
                                        $write("\nunknown OPCODE!!!!! 0x%h\n", ir);
                                        //$write("\nunknown OPCODE!!!!! 0x%h\n", ir);
                                        $finish();
                                        //$finish();
                                end
                                end
                        end
                        end
                endcase
                endcase
 
 
                case (ir)
                case (ir)

powered by: WebSVN 2.1.0

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