OpenCores
URL https://opencores.org/ocsvn/6809_6309_compatible_core/6809_6309_compatible_core/trunk

Subversion Repositories 6809_6309_compatible_core

[/] [6809_6309_compatible_core/] [trunk/] [rtl/] [verilog/] [decoders.v] - Diff between revs 12 and 14

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

Rev 12 Rev 14
Line 157... Line 157...
        input wire [7:0] postbyte0,
        input wire [7:0] postbyte0,
        input wire page2_valid, // is 1 when the postbyte0 is a valid opcode (after it was loaded)
        input wire page2_valid, // is 1 when the postbyte0 is a valid opcode (after it was loaded)
        input wire page3_valid, // is 1 when the postbyte0 is a valid opcode (after it was loaded)
        input wire page3_valid, // is 1 when the postbyte0 is a valid opcode (after it was loaded)
        output reg [2:0] mode,
        output reg [2:0] mode,
        output reg [2:0] optype,
        output reg [2:0] optype,
 
        output reg op_SYNC,
 
        output reg op_EXG,
 
        output reg op_TFR,
 
        output reg op_RTS,
 
        output reg op_RTI,
 
        output reg op_CWAI,
 
        output reg op_MUL,
 
        output reg op_SWI,
 
        output reg op_PUSH,
 
        output reg op_PULL,
 
        output reg op_LEA,
 
        output reg op_JMP,
 
        output reg op_JSR,
        output reg use_s
        output reg use_s
        );
        );
 
 
wire [3:0] oplo;
wire [3:0] oplo;
reg size;
reg size;
Line 168... Line 181...
 
 
always @(opcode, postbyte0, page2_valid, page3_valid, oplo)
always @(opcode, postbyte0, page2_valid, page3_valid, oplo)
        begin
        begin
                //dsize = `DSZ_8; // data operand size
                //dsize = `DSZ_8; // data operand size
                //msize = `MSZ_8; // memory operand size
                //msize = `MSZ_8; // memory operand size
                optype = `OP_NONE;
 
                use_s = 1;
                use_s = 1;
                mode = `NONE;
                mode = `NONE;
                size = 0;
                size = 0;
 
                op_SYNC = 0;
 
                op_EXG = 0;
 
                op_TFR = 0;
 
                op_RTS = 0;
 
                op_RTI = 0;
 
                op_CWAI = 0;
 
                op_MUL = 0;
 
                op_SWI = 0;
 
                op_PUSH = 0;
 
                op_PULL = 0;
 
                op_LEA = 0;
 
                op_JMP = 0;
 
                op_JSR = 0;
                // Addressing mode
                // Addressing mode
                casex(opcode)
                casex(opcode)
                        8'h0x: begin mode = `DIRECT; end
                        8'h0x: begin mode = `DIRECT; end
                        //8'h0e: begin optype = `OP_JMP; end
                        //8'h0e: begin optype = `OP_JMP; end
                        8'h12, 8'h13, 8'h19: mode = `INHERENT;
                        8'h12, 8'h13, 8'h19: mode = `INHERENT;
                        8'h14, 8'h15, 8'h18, 8'h1b: mode = `NONE; // undefined opcodes
                        8'h14, 8'h15, 8'h18, 8'h1b: mode = `NONE; // undefined opcodes
                        8'h16: mode = `REL16;
                        8'h16: mode = `REL16;
                        8'h17: begin mode = `REL16; optype = `OP_JSR; end
                        8'h17: begin mode = `REL16; op_JSR = 1; end
                        8'h1a, 8'h1c, 8'h1d, 8'h1e, 8'h1f: mode = `IMMEDIATE; // handled in ALU ORCC, ANDCC, SEX
                        8'h1a, 8'h1c, 8'h1d: mode = `IMMEDIATE; // handled in ALU ORCC, ANDCC, SEX
 
                        8'h1e: op_EXG = 1;
 
                        8'h1f: op_TFR = 1;
                        8'h2x: mode = `REL8;
                        8'h2x: mode = `REL8;
                        8'h30, 8'h31, 8'h32, 8'h33: begin mode = `INDEXED;  optype = `OP_LEA; end
                        8'h30, 8'h31, 8'h32, 8'h33: begin mode = `INDEXED; op_LEA = 1; end
                        8'h34: begin optype = `OP_PUSH; mode = `NONE; end
                        8'h34: op_PUSH = 1;
                        8'h35: begin optype = `OP_PULL; mode = `NONE; end
                        8'h35: op_PULL = 1;
                        8'h36: begin optype = `OP_PUSH; mode = `NONE; use_s = 0; end
                        8'h36: begin op_PUSH = 1; use_s = 0; end
                        8'h37: begin optype = `OP_PULL; mode = `NONE; use_s = 0; end
                        8'h37: begin op_PULL = 1; use_s = 0; end
                        8'h38, 8'h3e: mode = `NONE;
                        8'h38, 8'h3e: mode = `NONE;
                        // don't change to inh because SEQ_MEM_READ_x would not use register S as address
                        // don't change to inh because SEQ_MEM_READ_x would not use register S as address
                        8'h39, 8'h3b: begin  mode = `NONE; optype = `OP_RTS; end
                        8'h39: begin op_RTS = 1; mode = `INHERENT; end
                        8'h3a, 8'h3c, 8'h3d, 8'h3f: mode = `INHERENT;
                        8'h3b: begin op_RTI = 1; mode = `INHERENT; end
 
                        8'h3a, 8'h3c: mode = `INHERENT;
 
                        8'h3d: begin op_MUL = 1; mode = `INHERENT; end
 
                        8'h3f: begin op_SWI = 1; mode = `INHERENT; end
                        8'h4x: begin mode = `INHERENT; end
                        8'h4x: begin mode = `INHERENT; end
                        8'h5x: begin mode = `INHERENT; end
                        8'h5x: begin mode = `INHERENT; end
                        8'h6x: begin mode = `INDEXED; end
                        8'h6x: begin mode = `INDEXED; end
                        //8'h6e: begin optype = `OP_JMP; end
                        //8'h6e: begin optype = `OP_JMP; end
                        8'h7x: begin mode = `EXTENDED; end
                        8'h7x: begin mode = `EXTENDED; end
Line 220... Line 248...
                        8'hax, 8'hex: begin mode = `INDEXED; end
                        8'hax, 8'hex: begin mode = `INDEXED; end
                        8'hbx, 8'hfx: begin mode = `EXTENDED; end
                        8'hbx, 8'hfx: begin mode = `EXTENDED; end
                endcase
                endcase
                // Opcode type
                // Opcode type
                casex(opcode)
                casex(opcode)
                        8'b1xxx0110: optype = `OP_LD;
                        8'h0e, 8'h6e, 8'h7e: op_JMP = 1;
                        8'h0e, 8'h6e, 8'h7e: optype = `OP_JMP;
                        8'b10xx1101: op_JSR = 1; // bsr & jsr
                        8'b11xx1100: optype = `OP_LD; // LDD
 
                        8'b10xx1101: begin optype = `OP_JSR; end// bsr & jsr
 
                        8'b1xxx1110: optype = `OP_LD; // LDX, LDU
 
                        //8'b1xxx1111, 8'b11xx1101: optype = `OP_ST;
 
                endcase
                endcase
                if (page2_valid == 1'b1)
                if (page2_valid == 1'b1)
                        begin
                        begin
                                casex(postbyte0)
                                casex(postbyte0)
                                        8'h2x: mode = `REL16;
                                        8'h2x: mode = `REL16;
                                        8'h3f: mode = `INHERENT;
                                        8'h3f: op_SWI = 1;
                                        8'h83: begin  mode = `IMMEDIATE; size = 1; end
                                        8'h83: begin  mode = `IMMEDIATE; size = 1; end
                                        //8'h93, 8'ha3, 8'hb3: begin mem16 = 1; size = 1; end
                                        //8'h93, 8'ha3, 8'hb3: begin mem16 = 1; size = 1; end
                                        8'h8c: begin  mode = `IMMEDIATE; size = 1; end
                                        8'h8c: begin  mode = `IMMEDIATE; size = 1; end
                                        //8'h9c, 8'hac, 8'hbc: begin mem16 = 1; size = 1; end
                                        //8'h9c, 8'hac, 8'hbc: begin mem16 = 1; size = 1; end
                                        8'h8e: begin mode = `IMMEDIATE; size = 1; end
                                        8'h8e: begin mode = `IMMEDIATE; size = 1; end
Line 248... Line 272...
                                casex( postbyte0)
                                casex( postbyte0)
                                        8'h9x, 8'hdx: mode = `DIRECT;
                                        8'h9x, 8'hdx: mode = `DIRECT;
                                        8'hax, 8'hex: mode = `INDEXED;
                                        8'hax, 8'hex: mode = `INDEXED;
                                        8'hbx, 8'hfx: mode = `EXTENDED;
                                        8'hbx, 8'hfx: mode = `EXTENDED;
                                endcase
                                endcase
                                casex( postbyte0)
 
                                        8'b1xxx1110: optype = `OP_LD; // LDY, LDS
 
                                        //8'b1xxx1111, 8'b1xxx1101: optype = `OP_ST; // STY, STS
 
                                endcase
 
                        end
                        end
                if (page3_valid == 1'b1)
                if (page3_valid == 1'b1)
                        begin
                        begin
                                casex(postbyte0)
                                casex(postbyte0)
                                        8'h3f: mode = `INHERENT;
                                        8'h3f: op_SWI = 1;
                                        8'h83: begin mode = `IMMEDIATE; size = 1; end // CMPD
                                        8'h83: begin mode = `IMMEDIATE; size = 1; end // CMPD
                                        //8'h93, 8'ha3, 8'hb3: begin mem16 = 1; size = 1; end // CMPD
                                        //8'h93, 8'ha3, 8'hb3: begin mem16 = 1; size = 1; end // CMPD
                                        8'h8c: begin mode = `IMMEDIATE; size = 1; end
                                        8'h8c: begin mode = `IMMEDIATE; size = 1; end
                                        //8'h9c, 8'hac, 8'hbc: begin mem16 = 1; size = 1; end
                                        //8'h9c, 8'hac, 8'hbc: begin mem16 = 1; size = 1; end
                                        8'h8e: begin mode = `IMMEDIATE; size = 1; end
                                        8'h8e: begin mode = `IMMEDIATE; size = 1; end

powered by: WebSVN 2.1.0

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