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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [jmp.us] - Rev 2

Compare with Previous | Blame | View Log

// Copyright Jamie Iles, 2017
//
// This file is part of s80x86.
//
// s80x86 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// s80x86 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with s80x86.  If not, see <http://www.gnu.org/licenses/>.

.at 0xe9;
    read_immed, jmp jmpe9;
.auto_address;
jmpe9:
    a_sel IP, b_sel IMMEDIATE, alu_op ADD, load_ip,
        next_instruction;

.at 0xea;
    read_immed, jmp jmpea;
.auto_address;
jmpea:
    b_sel IMMEDIATE, alu_op SELB, load_ip;
    // read_immed can't be combined in the previous microinstruction as
    // otherwise it will clobber the immediate during stalling whilst load_ip
    // is asserted and we'll load an invalid IP.
    read_immed;
    b_sel IMMEDIATE, alu_op SELB, segment_wr_en,
        segment_force, segment CS, next_instruction;

.at 0xeb;
    width W8, read_immed, jmp jmpeb;
.auto_address;
jmpeb:
    a_sel IP, b_sel IMMEDIATE, alu_op ADD, load_ip,
        next_instruction;

jmpff_indirect_intra_reg:
    a_sel RA, alu_op SELA, load_ip,
        next_instruction;
jmpff_indirect_intra_mem:
    segment DS, mem_read;
    a_sel MDR, alu_op SELA, load_ip,
        next_instruction;

jmpff_indirect_inter_reg:
    next_instruction;
jmpff_indirect_inter_mem:
    segment DS, mem_read;
    a_sel MDR, alu_op SELA, load_ip;
    immediate 0x2, a_sel MAR, b_sel IMMEDIATE, alu_op ADD,
        mar_wr_sel Q, mar_write, segment DS;
    segment DS, mem_read;
    a_sel MDR, alu_op SELA, segment_wr_en,
        segment_force, segment CS, next_instruction;

// JCXZ
.at 0xe3;
    width W8, read_immed, jmp jcxz;

.auto_address;
jcxz:
    rb_cl;
    jmp_rb_zero jcxz_taken;
    next_instruction;
jcxz_taken:
    a_sel IP, b_sel IMMEDIATE, alu_op ADD, load_ip, next_instruction;

#define JUMP(opcode) \
.at opcode; \
    width W8, read_immed, jmp test_jump

JUMP(0x70);
JUMP(0x71);
JUMP(0x72);
JUMP(0x73);
JUMP(0x74);
JUMP(0x75);
JUMP(0x76);
JUMP(0x77);
JUMP(0x78);
JUMP(0x79);
JUMP(0x7a);
JUMP(0x7b);
JUMP(0x7c);
JUMP(0x7d);
JUMP(0x7e);
JUMP(0x7f);

.auto_address;
test_jump:
    jmp_if_taken jmp_taken;
    next_instruction;
jmp_taken:
    a_sel IP, b_sel IMMEDIATE, alu_op ADD, load_ip, next_instruction;

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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