blob: 218deb4128df6f4ca60e128041ea02166e7e1387 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef _RISCV_COPROCESSOR_H
#define _RISCV_COPROCESSOR_H
#include "processor.h"
#include <map>
#include <string>
#include <vector>
#include <functional>
class extension_t
{
public:
virtual std::vector<insn_desc_t> get_instructions() = 0;
virtual const char* name() = 0;
virtual ~extension_t();
void set_processor(processor_t* _p) { p = _p; }
protected:
processor_t* p;
void illegal_instruction();
void raise_interrupt();
void clear_interrupt();
};
std::map<std::string, std::function<extension_t*()>>& extensions();
#define REGISTER_EXTENSION(name, constructor) \
class register_##name { \
public: register_##name() { extensions()[#name] = constructor; } \
}; static register_##name dummy_##name;
#endif
|