-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.txt
More file actions
90 lines (71 loc) · 2.08 KB
/
notes.txt
File metadata and controls
90 lines (71 loc) · 2.08 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
81
82
83
84
85
86
87
88
89
Simulator
==========
Method of Representation
-------------------------
Memory
- Represented by a 2-D char array
- Sizes [256][]
Bus
- Global variable
int value, current value of bus
**PC MAR OR AR RG will all be objects of the same class**
Program Counter
- Class
-- Members
int value, current address
-- Functions
epc(), copies value to bus.value
lpc(), copies bus.value to values
OR Register
- Class
-- Members
int value, current value
-- Functions
eor(), copies value to bus.value
lor(), copies bus.value to values
ror(), resets value to zero
AR Register
- Class
-- Members
int value, current value
-- Functions
ear(), copies value to bus.value
lar(), copies bus.value to values
rar(), resets value to zero
ALU
-Function
- First opr value of bus
- Second opr value of OR
All individual arithmetic operations of ALU
- After arithmetic functions are called, flagupdate() is called, which updates the flag register.
FL (Flag Register)
- Class
-- Members
int u,z,nz,p,m,op,ep
-- No functions
MAR
- Class
- Same def as PC, only different in usage
Stack Pointer
- Globally declared stack
- Members of stack
int value, value
int address, address of the pointer, starting from 255 down to 0
IR/MS
- Both clubbed together into one class
-- Members
int ir, base addr of current micro instruction
int ms, set of micro instructions of current clock cycle
ROM
- Not necessary
Functioning
------------
Upon starting sim, reads .sim which is a settings file
First runs a compiler on the program, checking for syntax errors and missing values.
-Compares each instruction in the program with the list of instruction given.
-Checks for missing flags,movi being followed by a number etc.
Second copies the file into a 2-D char array (RAM).
Also copies memfile into RAM in correct format.
Third takes each instruction, which is called as a function. Each function will call their micro instructions.
Depending upon mode, it will print the results after each microins, ins, or after the whole program.
Depending upon setting, it will print in hex or decimal.