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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [comparison.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/>.

#ifndef COMPARISON_US
#define COMPARISON_US

#define COMP_REGMEM_REG(opcode1, opcode2, alufunc, flags)                       \
.at opcode1;                                                                    \
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO, segment DS,             \
        ra_modrm_rm_reg, jmp_rm_reg_mem comp ## alufunc ## opcode1 ##_reg;      \
.at opcode2;                                                                    \
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO, segment DS,             \
        ra_modrm_rm_reg, jmp_rm_reg_mem comp ## alufunc ## opcode1 ##_reg;      \
.auto_address;                                                                  \
comp ## alufunc ## opcode1 ## _reg:                                             \
    a_sel RA, b_sel RB, alu_op alufunc,                                         \
        update_flags flags, width WAUTO, next_instruction;                      \
comp ## alufunc ## opcode1 ## _mem:                                             \
    segment DS, mem_read, width WAUTO;                                          \
    a_sel MDR, b_sel RB, alu_op alufunc, update_flags flags,                    \
        width WAUTO, next_instruction;

#define COMP_REG_REGMEM(opcode1, opcode2, alufunc, flags)                       \
.at opcode1;                                                                    \
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO, segment DS,             \
        ra_modrm_rm_reg, jmp_rm_reg_mem comp ## alufunc ## opcode1 ## _reg;     \
.at opcode2;                                                                    \
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO, segment DS,             \
        ra_modrm_rm_reg, jmp_rm_reg_mem comp ## alufunc ## opcode1 ## _reg;     \
.auto_address;                                                                  \
comp ## alufunc ## opcode1 ## _reg:                                             \
    a_sel RA, b_sel RB, alu_op alufunc, update_flags flags, width WAUTO,        \
        next_instruction;                                                       \
comp ## alufunc ## opcode1 ## _mem:                                             \
    segment DS, mem_read, width WAUTO;                                          \
    a_sel MDR, b_sel RB, alu_op alufunc, update_flags flags,                    \
        width WAUTO, next_instruction;

#define COMP_REGMEM_A(opcode1, opcode2, alufunc, flags)                         \
.at opcode1;                                                                    \
    read_immed, width WAUTO, ra_sel AL, jmp comp ## alufunc ## opcode1;         \
.at opcode2;                                                                    \
    read_immed, width WAUTO, ra_sel AL, jmp comp ## alufunc ## opcode1;         \
.auto_address;                                                                  \
comp ## alufunc ## opcode1:                                                     \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        update_flags flags, width WAUTO, next_instruction;

#define COMP_80_81(alufunc, flags)                                              \
comp ## alufunc ## 80_81_reg:                                                   \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        update_flags flags, width WAUTO, next_instruction;                      \
comp ## alufunc ## 80_81_mem:                                                   \
    segment DS, mem_read, width WAUTO;                                          \
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
        update_flags flags, width WAUTO, next_instruction;

#define COMP_82(alufunc, flags)                                                 \
comp ## alufunc ## 82_reg:                                                      \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        width W8, update_flags flags, next_instruction;                         \
comp ## alufunc ## 82_mem:                                                      \
    width W8, segment DS, mem_read;                                             \
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
        width W8, update_flags flags, next_instruction;

#define COMP_83(alufunc, flags)                                                 \
comp ## alufunc ## 83_reg:                                                      \
    ra_modrm_rm_reg, jmp comp ## alufunc ## 83_regwrite;                        \
comp ## alufunc ## 83_mem:                                                      \
    ra_modrm_rm_reg, segment DS, jmp comp ## alufunc ## 83_memwrite;            \
comp ## alufunc ## 83_regwrite:                                                 \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        update_flags flags, next_instruction;                                   \
comp ## alufunc ## 83_memwrite:                                                 \
    segment DS, mem_read;                                                       \
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
        update_flags flags, next_instruction;

#define COMP_F6(alufunc, flags)                                                 \
comp ## alufunc ## f6_reg:                                                      \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        update_flags flags, width W8, next_instruction;                         \
comp ## alufunc ## f6_mem:                                                      \
    segment DS, mem_read, width W8;                                             \
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
        update_flags flags, width W8, next_instruction;

#define COMP_F7(alufunc, flags)                                                 \
comp ## alufunc ## f7_reg:                                                      \
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
        update_flags flags, next_instruction;                                   \
comp ## alufunc ## f7_mem:                                                      \
    segment DS, mem_read;                                                       \
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
        update_flags flags, next_instruction;

#endif // COMPARISON_US

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.