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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [div.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
divf6_reg:
19
    width W8, a_sel RA, alu_op SELA, mdr_write, jmp do_div8;
20
divf6_mem:
21
    width W8, segment DS, mem_read, jmp do_div8;
22
do_div8:
23
    ra_sel AX;
24
    // Divisor in MDR, dividend in DX:TMP
25
    a_sel RA, alu_op SELA, tmp_wr_en;
26
    width W8, alu_op DIV;
27
div8_complete:
28
    width W8, reg_wr_source QUOTIENT, rd_sel_source MICROCODE_RD_SEL, rd_sel AL;
29
    width W8, reg_wr_source REMAINDER, rd_sel_source MICROCODE_RD_SEL,
30
        rd_sel AH, next_instruction;
31
 
32
divf7_reg:
33
    a_sel RA, alu_op SELA, mdr_write, ra_sel AX, jmp do_div16;
34
divf7_mem:
35
    segment DS, mem_read, ra_sel AX, jmp do_div16;
36
do_div16:
37
    // Divisor in MDR, dividend in DX:TMP
38
    a_sel RA, alu_op SELA, tmp_wr_en, ra_sel DX;
39
    ra_sel DX, alu_op DIV;
40
div16_complete:
41
    reg_wr_source QUOTIENT, rd_sel_source MICROCODE_RD_SEL, rd_sel AX;
42
    reg_wr_source REMAINDER, rd_sel_source MICROCODE_RD_SEL, rd_sel DX,
43
        next_instruction;
44
 
45
idivf6_reg:
46
    width W8, a_sel RA, alu_op SELA, mdr_write, jmp do_idiv8;
47
idivf6_mem:
48
    width W8, segment DS, mem_read, jmp do_idiv8;
49
do_idiv8:
50
    ra_sel AX;
51
    // divisor in MDR, dividend in DX:TMP
52
    a_sel RA, alu_op SELA, tmp_wr_en;
53
    width W8, alu_op IDIV, jmp div8_complete;
54
 
55
idivf7_reg:
56
    a_sel RA, alu_op SELA, mdr_write, ra_sel AX, jmp do_idiv16;
57
idivf7_mem:
58
    segment DS, mem_read, ra_sel AX, jmp do_idiv16;
59
do_idiv16:
60
    // divisor in MDR, dividend in DX:TMP
61
    a_sel RA, alu_op SELA, tmp_wr_en, ra_sel DX;
62
    ra_sel DX, alu_op IDIV, jmp div16_complete;
63
 
64
.at 0xd4;
65
    width W8, read_immed, ra_modrm_rm_reg, b_sel IMMEDIATE, alu_op SELB,
66
        mdr_write, jmp do_aam;
67
.auto_address;
68
do_aam:
69
    width W8, ra_sel AL;
70
    // divisor in MDR, dividend in DX:TMP
71
    a_sel RA, alu_op SELA, tmp_wr_en;
72
    width W8, alu_op DIV;
73
    width W8, reg_wr_source QUOTIENT, rd_sel_source MICROCODE_RD_SEL, rd_sel AH;
74
    width W8, reg_wr_source REMAINDER, rd_sel_source MICROCODE_RD_SEL,
75
        rd_sel AL;
76
    ra_sel AX;
77
    a_sel RA, b_sel IMMEDIATE, immediate 0x0, alu_op ADD,
78
        update_flags SF ZF PF, next_instruction;

powered by: WebSVN 2.1.0

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