-
Notifications
You must be signed in to change notification settings - Fork 1
/
alu.h
67 lines (52 loc) · 1.59 KB
/
alu.h
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
/**
* LC-3 Simulator
* Final Project (Project #6)
* TCSS 372 - Computer Architecture
* Spring 2018
*
* ALU Module Header File
*
* This is a simulator of the LC-3 (Little Computer) machine using an
* object-oriented approach in C. The simulator includes all standard LC-3
* functionality based on the finite state machine approach and the corresponding
* opcode tables for the machine, with an additional push-pop stack feature utilized
* on the previously reserved (1101) opcode.
*
* Group Members:
* Michael Fulton
* Enoch Chan
* Logan Stafford
*
* Base Code Contributors:
* Sam Brendel
* Michael Josten
* Sam Anderson
* Tyler Schupack
*/
#ifndef ALU_H
#define ALU_H
#include "global.h"
typedef struct alu_t *alu_p;
/** Allocates and initializes a new ALU module */
alu_p alu_create();
/** Reinitializes the ALU without reallocation */
void alu_reset(alu_p alu);
/** Sets the ALU fields to default values */
void alu_initialize(alu_p alu);
/** Deallocates the ALU */
void alu_destroy(alu_p alu);
/** Takes a snapshot of the ALU data for debugging or display purposes */
const alu_snapshot_t alu_get_snapshot(alu_p);
/** Load ALU source register 1 */
void alu_load_sr1(alu_p, word_t data);
/** Load ALU source register 2 */
void alu_load_sr2(alu_p, word_t data);
/** Fetch the result from ALU */
word_t alu_fetch_result(alu_p);
/** Execute ADD operation on loaded SR1 and SR2 values */
void alu_add(alu_p);
/** Execute AND operation on loaded SR1 and SR2 values */
void alu_and(alu_p);
/** Execute NOT operation on loaded SR1 value */
void alu_not(alu_p);
#endif