start adding csrs
[rv32.git] / cpu.vh
1 /*
2 * Copyright 2018 Jacob Lifshay
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 *
22 */
23 `ifndef cpu_vh_
24 `define cpu_vh_
25
26 `define fetch_action [2:0]
27
28 `define fetch_action_default 3'h0
29 `define fetch_action_fence 3'h1
30 `define fetch_action_jump 3'h2
31 `define fetch_action_wait 3'h3
32 `define fetch_action_error_trap 3'h4
33 `define fetch_action_noerror_trap 3'h5
34 `define fetch_action_ack_trap 3'h6
35
36 `define fetch_output_state [1:0]
37
38 `define fetch_output_state_empty 2'h0
39 `define fetch_output_state_valid 2'h1
40 `define fetch_output_state_trap 2'h2
41
42 `define decode_action [11:0]
43
44 `define decode_action_trap_illegal_instruction 'h1
45 `define decode_action_load 'h2
46 `define decode_action_fence 'h4
47 `define decode_action_fence_i 'h8
48 `define decode_action_op_op_imm 'h10
49 `define decode_action_lui_auipc 'h20
50 `define decode_action_store 'h40
51 `define decode_action_branch 'h80
52 `define decode_action_jalr 'h100
53 `define decode_action_jal 'h200
54 `define decode_action_trap_ecall_ebreak 'h400
55 `define decode_action_csr 'h800
56
57 `endif
58