-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple interface of Interpreter (#7)
Co-authored-by: c71n93 <korostinskii.r@phystech.edu> Co-authored-by: levBagryansky <28lev11@gmail.com>
- Loading branch information
1 parent
b01fa47
commit 2dc4e93
Showing
8 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CHAIVM_DECODER_HPP | ||
#define CHAIVM_DECODER_HPP | ||
|
||
#include "instruction.hpp" | ||
|
||
using namespace chai::interpreter; | ||
|
||
class Decoder { | ||
|
||
public: | ||
Instruction parse(uint32_t word) ; | ||
}; | ||
|
||
#endif //CHAIVM_DECODER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef CHAIVM_EXECUTOR_HPP | ||
#define CHAIVM_EXECUTOR_HPP | ||
|
||
class Executor { | ||
|
||
}; | ||
|
||
#endif //CHAIVM_EXECUTOR_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef CHAIVM_INSTRUCTION_HPP | ||
#define CHAIVM_INSTRUCTION_HPP | ||
|
||
#include <cstdint> | ||
|
||
namespace chai::interpreter { | ||
|
||
|
||
using Opcode = uint8_t; | ||
using Register = uint8_t; | ||
using Immediate = uint32_t; | ||
|
||
enum Operation { | ||
Inv, | ||
}; | ||
|
||
struct Instruction { | ||
Operation operation; | ||
Immediate immediate; | ||
Register src; | ||
Register dst; | ||
}; | ||
|
||
|
||
} | ||
|
||
#endif //CHAIVM_INSTRUCTION_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef CHAIVM_REG_FILE_HPP | ||
#define CHAIVM_REG_FILE_HPP | ||
|
||
class RegisterFIle { | ||
|
||
}; | ||
|
||
#endif //CHAIVM_REG_FILE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef CHAIVM_TYPES_HPP | ||
#define CHAIVM_TYPES_HPP | ||
|
||
#include <cstdint> | ||
|
||
#endif //CHAIVM_TYPES_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef CHAIVM_NON_COPYABLE_HPP | ||
#define CHAIVM_NON_COPYABLE_HPP | ||
|
||
class INonCopyable { | ||
public: | ||
INonCopyable(const INonCopyable &rhs) = delete; | ||
INonCopyable& operator=(const INonCopyable &rhs) = delete; | ||
virtual ~INonCopyable() = 0; | ||
}; | ||
|
||
#endif //CHAIVM_NON_COPYABLE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <iostream> | ||
#include "ChaiVM/interpreter/decoder.hpp" | ||
|
||
int main() { std::cout << "Hello world" << std::endl; } |