3 * Copyright 2018 Jacob Lifshay
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:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
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
26 from migen
import Constant
30 """ Fetch action constants
32 default
= Constant(0x0, fetch_action
)
33 fence
= Constant(0x1, fetch_action
)
34 jump
= Constant(0x2, fetch_action
)
35 wait
= Constant(0x3, fetch_action
)
36 error_trap
= Constant(0x4, fetch_action
)
37 noerror_trap
= Constant(0x5, fetch_action
)
38 ack_trap
= Constant(0x6, fetch_action
)
40 fetch_output_state
= 2
43 """ Fetch output state constants
45 empty
= Constant(0x0, fetch_output_state
)
46 valid
= Constant(0x1, fetch_output_state
)
47 trap
= Constant(0x2, fetch_output_state
)
52 """ Decode action constants
54 trap_illegal_instruction
= Constant(0x1, decode_action
)
55 load
= Constant(0x2, decode_action
)
56 fence
= Constant(0x4, decode_action
)
57 fence_i
= Constant(0x8, decode_action
)
58 op_op_imm
= Constant(0x10, decode_action
)
59 lui_auipc
= Constant(0x20, decode_action
)
60 store
= Constant(0x40, decode_action
)
61 branch
= Constant(0x80, decode_action
)
62 jalr
= Constant(0x100, decode_action
)
63 jal
= Constant(0x200, decode_action
)
64 trap_ecall_ebreak
= Constant(0x400, decode_action
)
65 csr
= Constant(0x800, decode_action
)