class-ify fetch_action
[rv32.git] / cpudefs.py
index 9a58cffa6feead8f7657502f94b6ccd9e78c1d2c..f4598df6b81511fdd58ddea2e35c91b83250eb0c 100644 (file)
 from migen import Constant
 fetch_action = 3
 
-fetch_action_default = Constant(0x0, fetch_action)
-fetch_action_fence = Constant(0x1, fetch_action)
-fetch_action_jump = Constant(0x2, fetch_action)
-fetch_action_wait = Constant(0x3, fetch_action)
-fetch_action_error_trap = Constant(0x4, fetch_action)
-fetch_action_noerror_trap = Constant(0x5, fetch_action)
-fetch_action_ack_trap = Constant(0x6, fetch_action)
+class FA:
+    """ Fetch action constants
+    """
+    default = Constant(0x0, fetch_action)
+    fence = Constant(0x1, fetch_action)
+    jump = Constant(0x2, fetch_action)
+    wait = Constant(0x3, fetch_action)
+    error_trap = Constant(0x4, fetch_action)
+    noerror_trap = Constant(0x5, fetch_action)
+    ack_trap = Constant(0x6, fetch_action)
 
 fetch_output_state = 2
 
@@ -42,16 +45,18 @@ fetch_output_state_trap = Constant(0x2, fetch_output_state)
 
 decode_action = 12
 
-decode_action_trap_illegal_instruction = Constant(0x1, decode_action)
-decode_action_load = Constant(0x2, decode_action)
-decode_action_fence = Constant(0x4, decode_action)
-decode_action_fence_i = Constant(0x8, decode_action)
-decode_action_op_op_imm = Constant(0x10, decode_action)
-decode_action_lui_auipc = Constant(0x20, decode_action)
-decode_action_store = Constant(0x40, decode_action)
-decode_action_branch = Constant(0x80, decode_action)
-decode_action_jalr = Constant(0x100, decode_action)
-decode_action_jal = Constant(0x200, decode_action)
-decode_action_trap_ecall_ebreak = Constant(0x400, decode_action)
-decode_action_csr = Constant(0x800, decode_action)
-
+class DA:
+    """ Decode action constants
+    """
+    trap_illegal_instruction = Constant(0x1, decode_action)
+    load = Constant(0x2, decode_action)
+    fence = Constant(0x4, decode_action)
+    fence_i = Constant(0x8, decode_action)
+    op_op_imm = Constant(0x10, decode_action)
+    lui_auipc = Constant(0x20, decode_action)
+    store = Constant(0x40, decode_action)
+    branch = Constant(0x80, decode_action)
+    jalr = Constant(0x100, decode_action)
+    jal = Constant(0x200, decode_action)
+    trap_ecall_ebreak = Constant(0x400, decode_action)
+    csr = Constant(0x800, decode_action)