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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [xchg.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
.at 0x86;
19
    width WAUTO, modrm_start, mar_write, mar_wr_sel EA,
20
        ra_modrm_rm_reg, jmp_rm_reg_mem xchg86_reg, segment DS;
21
.at 0x87;
22
    modrm_start, mar_write, mar_wr_sel EA,
23
        ra_modrm_rm_reg, jmp_rm_reg_mem xchg86_reg, segment DS;
24
.auto_address;
25
xchg86_reg:
26
    width WAUTO, a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q,
27
        jmp xchg86_reg_store;
28
xchg86_mem:
29
    segment DS, width WAUTO, mem_read;
30
    width WAUTO, b_sel RB, alu_op SELB, mar_write, mar_wr_sel Q;
31
    // memory value is in MDR, register value is in MAR
32
    width WAUTO, a_sel MDR, alu_op SELA, rd_sel_source MODRM_REG;
33
    width WAUTO, a_sel MAR, alu_op SELA, mdr_write, mar_wr_sel EA,
34
        mar_write, segment DS, jmp write_complete;
35
 
36
xchg86_reg_store:
37
    width WAUTO, b_sel RB, alu_op SELB, rd_sel_source MODRM_RM_REG;
38
    width WAUTO, a_sel MAR, alu_op SELA, rd_sel_source MODRM_REG,
39
        next_instruction;
40
 
41
#define XCHG_REG(opcode, reg)                                           \
42
.at opcode;                                                             \
43
    ra_sel reg, jmp xchg_ ## reg;                                       \
44
.auto_address;                                                          \
45
xchg_ ## reg:                                                           \
46
    a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q,          \
47
        ra_sel AX;                                                      \
48
    a_sel RA, alu_op SELA, rd_sel_source MICROCODE_RD_SEL,   \
49
        rd_sel reg;                                          \
50
    a_sel MAR, alu_op SELA, rd_sel_source MICROCODE_RD_SEL,  \
51
        rd_sel AX, next_instruction;
52
 
53
// xchg ax, ax
54
.at 0x90;
55
    next_instruction;
56
 
57
XCHG_REG(0x91, CX)
58
XCHG_REG(0x92, DX)
59
XCHG_REG(0x93, BX)
60
XCHG_REG(0x94, SP)
61
XCHG_REG(0x95, BP)
62
XCHG_REG(0x96, SI)
63
XCHG_REG(0x97, DI)

powered by: WebSVN 2.1.0

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