add cpu decode cases
[rv32.git] / cpudefs.py
1 """
2 /*
3 * Copyright 2018 Jacob Lifshay
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 */
24 """
25
26 from migen import Constant
27 fetch_action = 3
28
29 fetch_action_default = Constant(0x0, fetch_action)
30 fetch_action_fence = Constant(0x1, fetch_action)
31 fetch_action_jump = Constant(0x2, fetch_action)
32 fetch_action_wait = Constant(0x3, fetch_action)
33 fetch_action_error_trap = Constant(0x4, fetch_action)
34 fetch_action_noerror_trap = Constant(0x5, fetch_action)
35 fetch_action_ack_trap = Constant(0x6, fetch_action)
36
37 fetch_output_state = 2
38
39 fetch_output_state_empty = Constant(0x0, fetch_output_state)
40 fetch_output_state_valid = Constant(0x1, fetch_output_state)
41 fetch_output_state_trap = Constant(0x2, fetch_output_state)
42
43 decode_action = 12
44
45 decode_action_trap_illegal_instruction = Constant(0x1, decode_action)
46 decode_action_load = Constant(0x2, decode_action)
47 decode_action_fence = Constant(0x4, decode_action)
48 decode_action_fence_i = Constant(0x8, decode_action)
49 decode_action_op_op_imm = Constant(0x10, decode_action)
50 decode_action_lui_auipc = Constant(0x20, decode_action)
51 decode_action_store = Constant(0x40, decode_action)
52 decode_action_branch = Constant(0x80, decode_action)
53 decode_action_jalr = Constant(0x100, decode_action)
54 decode_action_jal = Constant(0x200, decode_action)
55 decode_action_trap_ecall_ebreak = Constant(0x400, decode_action)
56 decode_action_csr = Constant(0x800, decode_action)
57