1 // See LICENSE for license details.
2 #ifndef _RISCV_DEBUG_MODULE_H
3 #define _RISCV_DEBUG_MODULE_H
43 CMDERR_HALTRESUME
= 4,
55 unsigned autoexecprogbuf
;
56 unsigned autoexecdata
;
59 class debug_module_t
: public abstract_device_t
62 debug_module_t(sim_t
*sim
);
64 void add_device(bus_t
*bus
);
66 bool load(reg_t addr
, size_t len
, uint8_t* bytes
);
67 bool store(reg_t addr
, size_t len
, const uint8_t* bytes
);
69 // Debug Module Interface that the debugger (in our case through JTAG DTM)
70 // uses to access the DM.
71 // Return true for success, false for failure.
72 bool dmi_read(unsigned address
, uint32_t *value
);
73 bool dmi_write(unsigned address
, uint32_t value
);
76 static const unsigned progsize
= 8;
80 uint8_t debug_rom_entry
[DEBUG_ROM_ENTRY_SIZE
];
81 uint8_t debug_rom_code
[DEBUG_ROM_CODE_SIZE
];
82 uint8_t debug_rom_exception
[DEBUG_ROM_EXCEPTION_SIZE
];
83 uint8_t program_buffer
[progsize
* 4];
84 uint8_t dmdata
[DEBUG_DATA_SIZE
];
89 // Instruction that will be placed at the current hart's ROM entry address
90 // after the current action has completed.
94 void write32(uint8_t *rom
, unsigned int index
, uint32_t value
);
95 uint32_t read32(uint8_t *rom
, unsigned int index
);
97 dmcontrol_t dmcontrol
;
99 abstractcs_t abstractcs
;
100 abstractauto_t abstractauto
;
103 processor_t
*current_proc() const;
105 bool perform_abstract_command();