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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [arithmetic.us] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jamieiles
// Copyright Jamie Iles, 2017
2
//
3
// This file is part of s80x86.
4
//
5
// s80x86 is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// s80x86 is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with s80x86.  If not, see .
17
 
18
#ifndef ARITHMETIC_US
19
#define ARITHMETIC_US
20
 
21
#define ARITH_REGMEM_REG(opcode1, opcode2, alufunc, flags)                      \
22
.at opcode1;                                                                    \
23
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO,                         \
24
        ra_modrm_rm_reg, jmp_rm_reg_mem alufunc ## opcode1 ##_reg, segment DS;  \
25
.at opcode2;                                                                    \
26
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO,                         \
27
        ra_modrm_rm_reg, jmp_rm_reg_mem alufunc ## opcode1 ##_reg, segment DS;  \
28
.auto_address;                                                                  \
29
alufunc ## opcode1 ## _reg:                                                     \
30
    a_sel RA, b_sel RB, alu_op alufunc,                                         \
31
        rd_sel_source MODRM_RM_REG, update_flags flags,              \
32
        width WAUTO, next_instruction;                                          \
33
alufunc ## opcode1 ## _mem:                                                     \
34
    segment DS, mem_read, width WAUTO;                                          \
35
    a_sel MDR, b_sel RB, alu_op alufunc, mdr_write,                             \
36
        update_flags flags, width WAUTO, segment DS, jmp write_complete;
37
 
38
#define ARITH_REG_REGMEM(opcode1, opcode2, alufunc, flags)                      \
39
.at opcode1;                                                                    \
40
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO,                         \
41
        ra_modrm_rm_reg, jmp_rm_reg_mem alufunc ## opcode1 ## _reg, segment DS; \
42
.at opcode2;                                                                    \
43
    modrm_start, mar_write, mar_wr_sel EA, width WAUTO,                         \
44
        ra_modrm_rm_reg, jmp_rm_reg_mem alufunc ## opcode1 ## _reg, segment DS; \
45
.auto_address;                                                                  \
46
alufunc ## opcode1 ## _reg:                                                     \
47
    a_sel RA, b_sel RB, alu_op alufunc, rd_sel_source MODRM_REG,                \
48
        update_flags flags, width WAUTO,                             \
49
        next_instruction;                                                       \
50
alufunc ## opcode1 ## _mem:                                                     \
51
    segment DS, mem_read, width WAUTO;                                          \
52
    a_sel MDR, b_sel RB, alu_op alufunc, rd_sel_source MODRM_REG,               \
53
        update_flags flags, width WAUTO,                             \
54
        next_instruction;
55
 
56
#define ARITH_REGMEM_A(opcode1, opcode2, alufunc, flags)                        \
57
.at opcode1;                                                                    \
58
    read_immed, width WAUTO, ra_sel AL, jmp alufunc ## opcode1;                 \
59
.at opcode2;                                                                    \
60
    read_immed, width WAUTO, ra_sel AL, jmp alufunc ## opcode1;                 \
61
.auto_address;                                                                  \
62
alufunc ## opcode1:                                                             \
63
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
64
        rd_sel_source MICROCODE_RD_SEL, rd_sel AL,                              \
65
        update_flags flags, width WAUTO,                             \
66
        next_instruction;
67
 
68
#define ARITH_80_81(alufunc, flags)                                                \
69
alufunc ## 80_81_reg:                                                              \
70
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
71
        rd_sel_source MODRM_RM_REG,                                  \
72
        width WAUTO, update_flags flags, next_instruction;                      \
73
alufunc ## 80_81_mem:                                                              \
74
    segment DS, mem_read, width WAUTO;                                          \
75
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
76
        mdr_write, update_flags flags, segment DS, width WAUTO, jmp write_complete;
77
 
78
#define ARITH_83(alufunc, flags)                                                \
79
alufunc ## 83_reg:                                                              \
80
    ra_modrm_rm_reg, jmp alufunc ## 83 ## regwrite;                             \
81
alufunc ## 83_mem:                                                              \
82
    ra_modrm_rm_reg, segment DS, jmp alufunc ## 83 ## memwrite;                 \
83
alufunc ## 83 ## regwrite:                                                      \
84
    a_sel RA, b_sel IMMEDIATE, alu_op alufunc,                                  \
85
        rd_sel_source MODRM_RM_REG,                                  \
86
        update_flags flags, next_instruction;                                   \
87
alufunc ## 83 ## memwrite:                                                      \
88
    segment DS, mem_read;                                                       \
89
    a_sel MDR, b_sel IMMEDIATE, alu_op alufunc,                                 \
90
        mdr_write, update_flags flags, segment DS, jmp write_16_complete;
91
 
92
#endif // ARITHMETIC_US

powered by: WebSVN 2.1.0

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