-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISA_NOTES
More file actions
146 lines (121 loc) · 4.15 KB
/
ISA_NOTES
File metadata and controls
146 lines (121 loc) · 4.15 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
These are initial notes laying out the C4C1 CPU's instruction set architecture, which
consists of 16 instructions and several components accessible over an 8-bit bus.
Instruction Bitfield:
[11111][xxxx][xxxxxxxx][xxxxxxxx][00000]
[IDENT][INST][OPERANDA][OPERANDB][EMPTY]
Data Bitfield:
[0000000000000000000000][xxxxxxxx]
[ UNUSED ][ DATA ]
Register Operand Bitfield (Numbered in order they are listed from 1 to the highest):
Ordinary Register: [0000][xxxx]
- AX, BX, CX, DX, EX, FX, GX, HX, IX, JX, KX, LX, MX, NX, OX, PX
Special Register: [10000][xxx]
- IO, IP[NOT USABLE BY USER]
The Bus:
- Data Bus:
- Size: 8 bits
- Contents:
[xxxxxxxx]
[ DATA ]
- Command Bus:
- Size: 12 bits
- Contents:
[xxxx][xxxxxxxx]
[UNIT][ CMND ]
Computer Component List (Addressable by Bus):
- 0000: CPU
- 0001: ROM
- CMND = [xxxxxxxx]
[ ADDR ]
- 0010: RAM
- CMND = [xxxxxxxx][x]
[ ADDR ][W]
- W = Write Latch - special direct line
- 0011: General Purpose Registers Unit
- CMND = [xxxx][xxxx]
[ADDR][INST]
- Instructions:
0000 = Read addr to CPU on data bus
0001 = Write to addr with data on data bus
- 0100: Instruction Pointer
- 0101: Conditionals Unit
- 0110: ALU 1 (First param, operation)
- 0111: ALU 2 (Second param)
- 1000: Input/Output Register
- CMND = [0000][xxxx]
[INST]
- Instructions:
0000 = Read to CPU on data bus
0001 = Write with data on data bus
Instruction set:
- Control:
0000 = HLT [NONE]
- Stop CPU
- CPU Execution Info:
- 1 cycle
- Directly wired to CPU components
- Memory:
0001 - MOV a, b [R], [R]
- Copy value of register b to register a
- CPU Execution Info:
- If regular register: 2 cycles
- Cycle 1: [0011][xxxx][0000] = Read address b [xxxx] back to CPU
- Cycle 2: [0011][xxxx][0001] = Write data out of CPU onto register a [xxxx]
0010 - STORE a, b [RAMADDR], [R]
- Store contents of register b in memory location a
- CPU Execution Info:
- 2 cycles:
- Cycle 1: [0011][xxxx][0000] = Read address b [xxxx] back to CPU
- Cycle 2: [1][0010][xxxxxxxx] = Write data out of CPU onto address a [xxxxxxxx]
0011 - LOADRAM a, b, [R], [RAMADDR]
- Load contents of memory location b (RAM) into register a
- CPU Execution Info:
- 2 cycles:
- Cycle 1: [0][0010][xxxxxxxx] = Read address b [xxxxxxxx] back to CPU
- Cycle 2: [0011][xxxx][0001] = Write data out of CPU onto register a [xxxx]
0100 - LOADROM a, b, [R], [ROMADDR]
- Load contents of memory location (ROM) b into register a
- CPU Execution Info:
- 2 cycles:
- Cycle 1: [0001][xxxxxxxx] = Read address b [xxxxxxxx] back to CPU
- Cycle 2: [0011][xxxx][0001] = Write data out of CPU onto register a [xxxx]
NONE - DB a
- Don't decode operand - leaves data as it is
- Conditional:
0101 = JMP a [ROMADDR]
- Jump to address a
0110 = JZ a, b [ROMADDR]
- Jump to address a if register b is zero
0111 = JNZ a, b [ROMADDR]
- Jump to address a if register b is not zero
- Arithmetic/Logic:
1000 = NOT a [R]
- Perform logical not on value a and store in a
1001 = OR a, b [R]
- Perform logical or on a and b, store in a
1010 = AND a, b [R]
- Perform logical and on a and b, store in a
1011 = ADD a, b [R]
- Add b to a and store in a
1100 - SHL a [R]
- Overflow shift left register a
1101 - SHR a [R]
- Overflow shift right register a
- Input/Output:
1110 - RECV a [R]
- Receive a value into register a
1111 - SEND a [R]
- Send a value from register a
- Notes:
- NOP can be emulated with something like add ax, 0
- IO register: replaces send and recv:
- send:
mov io, 35
- recv:
cmp io, 0
jpos myFunc
nop
jmp send
- Find twos complement (negate) of value of register a and store in register a (not a, inc a, delete overflow)
- You must do everything PERFECTLY when programming this computer. There are two section in memory: program, and data. If the PC is ever
on a data segment's address, the computer will die. If the data requested with LOADRAM is an instruction, the computer will die.