You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* IPC = 0x0100, intial value of `PC` (or Program Counter).
40
+
41
+
### Memory Allocation
42
+
43
+
*`RAM[0:INSZ]` is mapped to I/O module input
44
+
*`RAM[INSZ:OUTSZ]` is mapped to I/O module output
45
+
*`RAM[IPC:IPC+x]` is loaded from ROM. So it essentially contains `.text`, `.data`.
46
+
47
+
### Sequencing
48
+
49
+
50
+
* At boot
51
+
* Load `ROM[0:x]` into `RAM[IPC:IPC+x]`
52
+
* TODO: How?
53
+
54
+
### Assembly
55
+
56
+
*`.bss` must be the last section.
57
+
* Registers don't really exists. `R[0-7]` are mapped to memory location in `.bss` for convenience and some instructions return response.
58
+
59
+
### Architecture
60
+
61
+
#### I/O
62
+
63
+
Hardware interact asynchronously with IOM (I/O Module) which then interact with RAM at program's will. (WE ARE NOT DOING IT)
64
+
65
+
* Input devices publish state change in IOM and Output devices read from IOM.
66
+
* Program use `IN <index>` instructions to read from `IOM_in[index]` and write to `RAM[index]`. `IOM_in` won't cache input and it will be read as real-time value. If a input state needs to be cached, it's the input device responsibility.
67
+
* Program use `OUT <index>` instructions to read `RAM[INSZ+index]` and write to `IOM_out[index]`.
68
+
69
+
70
+
71
+
# TODO
72
+
73
+
## Processor
74
+
75
+
* Address bits: 8
76
+
* Register size: 8
77
+
* Memory size: 2**8 = 256 bytes
78
+
79
+
### Idea
80
+
81
+
To keep number of component small, we would split a single instruction execution period into 4 cycles.
82
+
83
+
* Reset
84
+
* Set `PC = 0`
85
+
* sub-cycle clock to cycle-0
86
+
* Cycle 0
87
+
* Fetch instruction from `ROM[$PC]` into `pin_INS`
88
+
* Cycle 1
89
+
* Perform first read
90
+
91
+
## Assembler
92
+
93
+
### Details
94
+
95
+
* Registers: R0, R1, R2, R3 or `R{NUM}`
96
+
97
+
* Input/Output pin: IO0, IO1, ..., IO7 or `IO{NUM}` (8-bits)
98
+
99
+
### Instructions
100
+
101
+
*`IN R{NUM}`: short-blocking input with 8-bit response.
0 commit comments