-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
48 lines (33 loc) · 922 Bytes
/
utils.c
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
#include "utils.h"
#include <stdio.h>
#include <stdlib.h>
//sign extends a bitfield with given size
/* You may find implementing this function helpful */
int bitSigner(unsigned int field, unsigned int size) {
/* YOUR CODE HERE */
return 0;
}
/* Remember that the offsets should return the offset in BYTES */
int get_branch_offset(Instruction instruction) {
/* YOUR CODE HERE */
return 0;
}
int get_jump_offset(Instruction instruction) {
/* YOUR CODE HERE */
return 0;
}
int get_store_offset(Instruction instruction) {
/* YOUR CODE HERE */
return 0;
}
void handle_invalid_instruction(Instruction instruction) {
printf("Invalid Instruction: 0x%08x\n", instruction.bits);
}
void handle_invalid_read(Address address) {
printf("Bad Read. Address: 0x%08x\n", address);
exit(-1);
}
void handle_invalid_write(Address address) {
printf("Bad Write. Address: 0x%08x\n", address);
exit(-1);
}