Blame view

cpu.h 1.28 KB
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
//
// Created by imanol on 12/25/16.
//

#ifndef SYNACORVM_CPU_H
#define SYNACORVM_CPU_H

#include <stdio.h>
9
10
11
#include "mem.h"
#include "stack.h"
#include "registers.h"
12
#include "instructions.h"
13
#include "input.h"
14
15
16

#define MAX_INT 32767
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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();
38
39
uint8_t execute_instruction(uint16_t opcode, uint16_t arg1, uint16_t arg2, uint16_t arg3);
40
41
void start_execution();
void core_dump();
42
43
44
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);
Imanol-Mikel Barba Sabariego authored
45
46

#endif //SYNACORVM_CPU_H