~maddie/custom-processor-specification

ref: a8550a37b44317717ecf40d44dad949c60b9a8fb custom-processor-specification/drafts/processor_spec_first_draft.txt -rw-r--r-- 3.8 KiB
a8550a37Madeline Cronin Moved the drafts into a folder and added a small readme for them. 2 months ago
                                                                                
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
conditional exec on all
14 registers(ID 0-13) + stack pointer(ID 14) + program counter(ID 15) --- NO ELEGANT WAY TO ACCESS DISK, MORE SPECIALISED REGISTERS WOULD BE HELPFUL, THOUGH SIMD IS NOT A GOAL IN THIS PROJECT
8 bit instructions, 16 bit values --- TOO CRAMPED, VARIATION BETWEEN INSTUCTION AND DATA WIDTH IS IFFY
4 byte constant instruction width --- UNSURE WHETHER THE PACKING BONUS OF VARIABLE LENGTH IS WORTH THE COMPLEXITY FOR NOW
16 bit address space -> 64Kib memory, disk is 256 blocks of 64Kib for 16Mib --- 16BIT IS GOOD FOR A SIMPLE PROJECT BUT PROBABLY TOO CRAMPED FOR LARGER TASKS, KEEP AS IS
black and white display, 64x64 pixel display, last 4Kib of memory is mapped to display --- CANABBALISING RAM IS IFFY, DEDICATED INSTRUCTIONS FEEL IFFY AS WELL BUT WITH LARGER INSTRUCTION SPACE WOULD BE PREFERABLE



bits 1-2 determine the conditions upon which the command is executed --- NO GOOD WAY TO DO UNCONDITIONAL EXECUTION AND NEGATIVE CHECKS SIMULTANEOUSLY, EXTRA FLAG BIT WOULD BE IDEAL
00 = false boolean check
11 = true boolean check or equal equivalence check
10 = greater than equivalence check
01 = less than equivalence check

bits 3-5 determine category of instructions --- DECIDE INSTRUCTION GROUPS FIRST, AND GROUP UP IN SENSIBLE WAYS, RATHER THAN FIRST COME FIRST SERVE
000 = immediate value --- INSTRUCTION PARAMATER IMMEDIACY CAN BE USEFUL, BUT A DEDICATED IMMEDIATE INSTRUCTION CAN BE MORE EFFICIENT THAN A NO-OP SUCH AS OR WITH 0 ON IMMEDIATES, MAYBE USE BOTH
001 = arithmetic
010 = logical
011 = condition check
100 = memory access
101 = control flow
111 = halt

--- SOME KIND OF PRIVELEDGES SYSTEM WOULD BE USEFUL BUT LIKELY OUT OF SCOPE FOR WHAT AMOUNTS TO A TEST PROJECT, SIMILARLY FOR MANAGED MEMORY BLOCKS

bits 6-8 determine specific instructions

immediate: 
not used

arithmetic:
x00 = addition
x01 = subtraction
x10 = multiplication
x11 = negative --- WHAT DID THEY MEAN BY THIS
1xx = invert output

logical:
x00 = or
x01 = and
x10 = xor
1xx = invert output

condition check: 
x00 = compare
x01 = add with overflow check
x10 = subtract with underflow check
x11 = multiply with overflow check --- PROBABLY BEST GROUPED INTO ARITHMETIC AS A FLAG THERE
1xx = invert flags

memory access: --- BETTER SYSTEM FOR ADDRESSING MEMORY WOULD BE USEFUL, PROBABLY IN THE FORM OF A DEDICATED, WRITE LOCKED REGISTER ALTERED THROUGH MEMORY ACCESS COMMANDS
000 = push
001 = pop
010 = store
011 = load
100 = store to disk
101 = load from disk
110 = output to serial port
111 = input from serial port

control flow: --- INTERRUPTS AS PART OF CONTROL FLOW WOULD BE USEFUL BUT ONLY REALLY IMPACTFUL AS PART OF THE PRIVELEDGE SYSTEM, OTHERWISE THEY AREN'T MEANINGFULLY DIFFERENT FROM A STATIC JUMP
000 = static jump
001 = additive jump
010 = push pc and static jump
011 = push pc and additive jump
100 = enable interrupts
101 = disable interrupts




bytes 2 and 3 (usually) determine inputs --- INCREASE TO 16 BITS TO MATCH INSTRUCTION LENGTH INCREASE

immediate: bytes 2 and 3 are combined into a 16 bit value --- THIS SUCKS

arithmetic, logical, and condition check: bytes 2 and 3 are register indices, wrapping mod 16 --- PROBABLY GOING TO BE MOD 32 DUE TO REGISTER COUNT INCREASE

memory access: bytes 2 and 3 get merged into one 16 bit load/store address, discarded on push/pop --- THIS ALSO SUCKS

control flow: discarded --- WHAT DO YOU MEAN DISCARDED YOU FUC-



byte 4 is (usually) the output, and always refers to a register 

immediate: index of register to store immediate value in, wrapping mod 16

arithmetic and logical: index of register to store result in, wrapping mod 16 --- REGISTER COUNT INCREASE APPLIES HERE AS WELL

condition check: index of register to store result of checked arithmetic operations in, wrapping mod 16

memory access: index of register to interact with, wrapping mod 16 --- THIS WOULD BE BETTER OMITTED BY VARIABLE LENGTH INSTRUCTIONS