cpu.h
1.28 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by imanol on 12/25/16.
//
#ifndef SYNACORVM_CPU_H
#define SYNACORVM_CPU_H
#include <stdio.h>
#include "mem.h"
#include "stack.h"
#include "registers.h"
#include "instructions.h"
#include "input.h"
#define MAX_INT 32767
void mov(uint16_t dst, uint16_t src);
void push(uint16_t src);
void pop(uint16_t dst);
void teq(uint16_t dst, uint16_t a, uint16_t b);
void tgt(uint16_t dst, uint16_t a, uint16_t b);
void jmp(uint16_t dst);
void jnz(uint16_t cond, uint16_t dst);
void jz(uint16_t cond, uint16_t dst);
void add(uint16_t dst, uint16_t a, uint16_t b);
void mul(uint16_t dst, uint16_t a, uint16_t b);
void mod(uint16_t dst, uint16_t a, uint16_t b);
void and(uint16_t dst, uint16_t a, uint16_t b);
void or(uint16_t dst, uint16_t a, uint16_t b);
void not(uint16_t dst, uint16_t src);
void load(uint16_t dst, uint16_t src);
void stor(uint16_t dst, uint16_t src);
void call(uint16_t dst);
uint8_t ret();
void out(uint16_t src);
void in(uint16_t dst);
void nop();
uint8_t execute_instruction(uint16_t opcode, uint16_t arg1, uint16_t arg2, uint16_t arg3);
void start_execution();
void core_dump();
void print_instruction(uint16_t opcode, uint16_t arg1, uint16_t arg2, uint16_t arg3);
void decode_instruction(uint16_t opcode, uint16_t *arg1, uint16_t *arg2, uint16_t *arg3);
#endif //SYNACORVM_CPU_H