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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [pipeline/] [decode_commands.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
//PARSED_COMMENTS: this file contains parsed script comments
28
 
29
module decode_commands(
30
 
31
    input               protected_mode,
32
 
33
    input               dec_ready_one,
34
    input               dec_ready_one_one,
35
    input               dec_ready_one_two,
36
    input               dec_ready_one_three,
37
    input               dec_ready_2byte_one,
38
    input               dec_ready_modregrm_one,
39
    input               dec_ready_2byte_modregrm,
40
    input               dec_ready_call_jmp_imm,
41
    input               dec_ready_one_imm,
42
    input               dec_ready_2byte_imm,
43
    input               dec_ready_mem_offset,
44
    input               dec_ready_modregrm_imm,
45
    input               dec_ready_2byte_modregrm_imm,
46
 
47
    input       [95:0]  decoder,
48
    input               prefix_group_1_lock,
49
    input       [1:0]   dec_prefix_group_1_rep,
50
    input               dec_prefix_2byte,
51
 
52
    output              consume_one,
53
    output              consume_one_one,
54
    output              consume_one_two,
55
    output              consume_one_three,
56
    output              consume_call_jmp_imm,
57
    output              consume_modregrm_one,
58
    output              consume_one_imm,
59
    output              consume_modregrm_imm,
60
    output              consume_mem_offset,
61
 
62
    output              dec_exception_ud,
63
 
64
    output              dec_is_8bit,
65
    output      [6:0]   dec_cmd,
66
    output      [3:0]   dec_cmdex,
67
    output              dec_is_complex
68
);
69
 
70
//------------------------------------------------------------------------------
71
 
72
`define DEC_MODREGRM_IS_MOD_11  (decoder[15:14] == 2'b11)
73
 
74
//------------------------------------------------------------------------------
75
 
76
wire exception_ud_invalid;
77
wire exception_ud;
78
 
79
//------------------------------------------------------------------------------
80
 
81
assign exception_ud_invalid =
82
    (dec_ready_modregrm_one && (
83
        (decoder[7:0] == 8'h8F && decoder[13:11] != 3'd0) ||
84
        (decoder[7:0] == 8'hFE && decoder[13:12] != 2'd0) ||
85
        (decoder[7:0] == 8'hFF && decoder[13:11] == 3'd7) ||
86
        ({ decoder[7:1], 1'b0 } == 8'hC6 && decoder[13:11] != 3'd0) )) ||
87
    (dec_ready_2byte_modregrm && (
88
        (decoder[7:0] == 8'h00 && { decoder[13:12], 1'b0 } == 3'd6) ||
89
        (decoder[7:0] == 8'h01 && decoder[13:11] == 3'd5) ||
90
        (decoder[7:0] == 8'hBA && decoder[13] == 1'd0) )) ||
91
    (dec_ready_modregrm_imm && (
92
        ({ decoder[7:1], 1'b0 } == 8'hC6 && decoder[13:11] != 3'd0) )) ||
93
    (dec_ready_2byte_one && (
94
        { decoder[7:1], 1'b0 } == 8'hA6 || decoder[7:0] == 8'hAA || decoder[7:0] == 8'hAE ||
95
        { decoder[7:1], 1'b0 } == 8'hB8 || (decoder[7:4] == 4'hC && decoder[3] == 1'b0 && decoder[2:1] != 2'b00) ||
96
        (decoder[7:4] >= 4'hD) || (decoder[7:4] >= 4'h3 && decoder[7:4] <= 4'h7) || decoder[7:4] == 4'h1 ||
97
        (decoder[7:4] == 4'h2 && decoder[3:0] >= 4'h4) || { decoder[7:1], 1'b0 } == 8'h04 || decoder[7:0] == 8'h07 ||
98
        (decoder[7:4] == 4'd0 && decoder[3:0] >= 4'hA) ));
99
 
100
 
101
//------------------------------------------------------------------------------
102
 
103
assign dec_exception_ud = exception_ud_invalid || exception_ud;
104
 
105
//------------------------------------------------------------------------------
106
 
107
//------------------------------------------------------------------------------
108
 
109
// synthesis translate_off
110
wire _unused_ok = &{ 1'b0, decoder[95:16], decoder[10:8], 1'b0 };
111
// synthesis translate_on
112
 
113
//------------------------------------------------------------------------------
114
 
115
`include "autogen/decode_commands.v"
116
 
117
 
118
endmodule

powered by: WebSVN 2.1.0

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