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 |
|
|
module JumpTest(input logic [7:0] opcode,
|
19 |
|
|
// verilator lint_off UNUSED
|
20 |
|
|
input logic [15:0] flags,
|
21 |
|
|
// verilator lint_on UNUSED
|
22 |
|
|
output logic taken);
|
23 |
|
|
|
24 |
|
|
always_comb begin
|
25 |
|
|
taken = 1'b0;
|
26 |
|
|
|
27 |
|
|
unique casez(opcode)
|
28 |
|
|
8'b01100010: taken = flags[CF_IDX]; // BOUND
|
29 |
|
|
8'b01110000: taken = flags[OF_IDX]; // JO
|
30 |
|
|
8'b01110001: taken = ~flags[OF_IDX]; // JNO
|
31 |
|
|
8'b01110010: taken = flags[CF_IDX]; // JB
|
32 |
|
|
8'b01110011: taken = ~flags[CF_IDX]; // JNB
|
33 |
|
|
8'b01110100: taken = flags[ZF_IDX]; // JE
|
34 |
|
|
8'b01110101: taken = ~flags[ZF_IDX]; // JNE
|
35 |
|
|
8'b01110110: taken = flags[CF_IDX] | flags[ZF_IDX]; // JBE
|
36 |
|
|
8'b01110111: taken = ~(flags[CF_IDX] | flags[ZF_IDX]); // JNBE
|
37 |
|
|
8'b01111000: taken = flags[SF_IDX]; // JS
|
38 |
|
|
8'b01111001: taken = ~flags[SF_IDX]; // JNS
|
39 |
|
|
8'b01111010: taken = flags[PF_IDX]; // JP
|
40 |
|
|
8'b01111011: taken = ~flags[PF_IDX]; // JNP
|
41 |
|
|
8'b01111100: taken = flags[OF_IDX] ^ flags[SF_IDX]; // JL
|
42 |
|
|
8'b01111101: taken = ~(flags[SF_IDX] ^ flags[OF_IDX]); // JNL
|
43 |
|
|
8'b01111110: taken = (flags[OF_IDX] ^ flags[SF_IDX]) | flags[ZF_IDX]; // JLE
|
44 |
|
|
8'b01111111: taken = ~((flags[SF_IDX] ^ flags[OF_IDX]) | flags[ZF_IDX]); // JNLE
|
45 |
|
|
8'b11001110: taken = flags[OF_IDX]; // INTO
|
46 |
|
|
default: taken = 1'b0;
|
47 |
|
|
endcase
|
48 |
|
|
end
|
49 |
|
|
|
50 |
|
|
endmodule
|