-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalu.h
More file actions
82 lines (59 loc) · 1.92 KB
/
alu.h
File metadata and controls
82 lines (59 loc) · 1.92 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <ioModule.h>
#include <stdlib.h>
#include <stdint.h>
#include "memoryManager.h"
typedef struct three_regs {
uint32_t* a;
uint32_t* b;
uint32_t* c;
} three_regs;
// typedef struct instruction_struct {
// uint32_t opcode;
// uint32_t a;
// uint32_t b;
// uint32_t c;
// } instruction_struct;
/*
* performOperation will call interpretInstruction to
* obtain an instruction that has been unpacked into
* a struct containing an opcode and 3 registers.
* performOperation then calls the function corresponding
* to the given opcode.
*/
int performOperation(uint32_t instruction, uint32_t *registers, int *pc);
/*
* interpretInstruction will unpack the given uint32_t
* instruction and split it into an opcode, and three
* registers (a, b, and c.)
* interpretInstruction then puts these into a struct and
* returns it.
*/
// instruction_struct interpretInstruction(uint32_t instruction);
// /* Conditional Move */
// static inline int cmov(three_regs regs);
// /* Segmented Load */
// static inline int sload(three_regs regs);
// /* Segmented Store */
// static inline int sstore(three_regs regs);
// /* Addition */
// static inline int add(three_regs regs);
// /* Multiplication */
// static inline int mult(three_regs regs);
// /* Division */
// static inline int divide(three_regs regs);
// /* Bitwise NAND */
// static inline int nand(three_regs regs);
// /* Halt */
// static inline int halt(three_regs regs);
// /* Map Segment */
// static inline int map(three_regs regs);
// /* Unmap Segment */
// static inline int unmap(three_regs regs);
// /* Output */
// static inline int ALUoutput(three_regs regs);
// /* Input */
// static inline int ALUinput(three_regs regs);
// /* Load Program */
// static inline int loadp(three_regs regs);
// /* Load Value */
// static inline int loadv(uint32_t* regA, uint32_t value);