/* Top-level interfaces to the Sail model.
   Ideally, this would be autogenerated.
 */

typedef int unit;
#define UNIT 0
typedef uint64_t mach_bits;

struct zMisa {mach_bits zMisa_chunk_0;};
struct zMisa zmisa;

void model_init(void);
void model_fini(void);

unit zinit_model(unit);
bool zstep(sail_int);
unit ztick_clock(unit);
unit ztick_platform(unit);
unit z_set_Misa_C(struct zMisa*, mach_bits);

#ifdef RVFI_DII
unit zext_rvfi_init(unit);
unit zrvfi_set_instr_packet(mach_bits);
mach_bits zrvfi_get_cmd(unit);
bool zrvfi_step(sail_int);
unit zrvfi_zzero_exec_packet(unit);
unit zrvfi_halt_exec_packet(unit);
void zrvfi_get_exec_packet(sail_bits *rop, unit);
#endif

extern mach_bits zxlen_val;
extern bool zhtif_done;
extern mach_bits zhtif_exit_code;
extern bool have_exception;

/* machine state */

extern uint32_t zcur_privilege;

extern mach_bits zPC;

extern mach_bits
        zx1,  zx2,  zx3,  zx4,  zx5,  zx6,  zx7,
  zx8,  zx9,  zx10, zx11, zx12, zx13, zx14, zx15,
  zx16, zx17, zx18, zx19, zx20, zx21, zx22, zx23,
  zx24, zx25, zx26, zx27, zx28, zx29, zx30, zx31;

extern mach_bits zmstatus;
extern mach_bits zmepc, zmtval;
extern mach_bits zsepc, zstval;

struct zMcause {mach_bits zMcause_chunk_0;};
struct zMcause zmcause, zscause;

extern mach_bits zminstret;
