target/nios2: Use hw/registerfields.h for CR_STATUS fields

Add all fields; retain the helper macros for single bit fields.
So far there are no uses of the multi-bit status fields.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220421151735.31996-25-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-21 08:16:55 -07:00
parent 5dfb910d91
commit e96568a461

View File

@ -23,6 +23,7 @@
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "hw/registerfields.h"
#include "qom/object.h" #include "qom/object.h"
typedef struct CPUArchState CPUNios2State; typedef struct CPUArchState CPUNios2State;
@ -79,15 +80,24 @@ struct Nios2CPUClass {
/* Control register aliases */ /* Control register aliases */
#define CR_STATUS 0 #define CR_STATUS 0
#define CR_STATUS_PIE (1 << 0)
#define CR_STATUS_U (1 << 1) FIELD(CR_STATUS, PIE, 0, 1)
#define CR_STATUS_EH (1 << 2) FIELD(CR_STATUS, U, 1, 1)
#define CR_STATUS_IH (1 << 3) FIELD(CR_STATUS, EH, 2, 1)
#define CR_STATUS_IL (63 << 4) FIELD(CR_STATUS, IH, 3, 1)
#define CR_STATUS_CRS (63 << 10) FIELD(CR_STATUS, IL, 4, 6)
#define CR_STATUS_PRS (63 << 16) FIELD(CR_STATUS, CRS, 10, 6)
#define CR_STATUS_NMI (1 << 22) FIELD(CR_STATUS, PRS, 16, 6)
#define CR_STATUS_RSIE (1 << 23) FIELD(CR_STATUS, NMI, 22, 1)
FIELD(CR_STATUS, RSIE, 23, 1)
#define CR_STATUS_PIE R_CR_STATUS_PIE_MASK
#define CR_STATUS_U R_CR_STATUS_U_MASK
#define CR_STATUS_EH R_CR_STATUS_EH_MASK
#define CR_STATUS_IH R_CR_STATUS_IH_MASK
#define CR_STATUS_NMI R_CR_STATUS_NMI_MASK
#define CR_STATUS_RSIE R_CR_STATUS_RSIE_MASK
#define CR_ESTATUS 1 #define CR_ESTATUS 1
#define CR_BSTATUS 2 #define CR_BSTATUS 2
#define CR_IENABLE 3 #define CR_IENABLE 3