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).
30
-
31
-
### Memory Allocation
32
-
33
-
*`RAM[0:INSZ]` is mapped to I/O module input
34
-
*`RAM[INSZ:OUTSZ]` is mapped to I/O module output
35
-
*`RAM[IPC:IPC+x]` is loaded from ROM. So it essentially contains `.text`, `.data`.
36
-
37
-
### Sequencing
38
-
39
-
40
-
* At boot
41
-
* Load `ROM[0:x]` into `RAM[IPC:IPC+x]`
42
-
* TODO: How?
43
-
44
-
### Assembly
45
-
46
-
*`.bss` must be the last section.
47
-
* Registers don't really exists. `R[0-7]` are mapped to memory location in `.bss` for convenience and some instructions return response.
48
-
49
-
### Architecture
50
-
51
-
#### I/O
52
-
53
-
Hardware interact asynchronously with IOM (I/O Module) which then interact with RAM at program's will. (WE ARE NOT DOING IT)
54
-
55
-
* Input devices publish state change in IOM and Output devices read from IOM.
56
-
* 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.
57
-
* Program use `OUT <index>` instructions to read `RAM[INSZ+index]` and write to `IOM_out[index]`.
58
-
59
-
60
-
61
-
# TODO
62
-
63
-
## Processor
64
-
65
-
* Address bits: 8
66
-
* Register size: 8
67
-
* Memory size: 2**8 = 256 bytes
68
-
69
-
### Idea
70
-
71
-
To keep number of component small, we would split a single instruction execution period into 4 cycles.
72
-
73
-
* Reset
74
-
* Set `PC = 0`
75
-
* sub-cycle clock to cycle-0
76
-
* Cycle 0
77
-
* Fetch instruction from `ROM[$PC]` into `pin_INS`
78
-
* Cycle 1
79
-
* Perform first read
80
-
81
-
## Assembler
82
-
83
-
### Details
84
-
85
-
* Registers: R0, R1, R2, R3 or `R{NUM}`
86
-
87
-
* Input/Output pin: IO0, IO1, ..., IO7 or `IO{NUM}` (8-bits)
88
-
89
-
### Instructions
90
-
91
-
*`IN R{NUM}`: short-blocking input with 8-bit response.
92
-
*`OUT R{NUM}`: short-blocking 8-bit output.
93
-
94
-
## Syntax: High Level
95
-
96
-
Not yet defined.
25
+
* Memory layout: [here](planner/memory.py)
26
+
27
+
#### Boot Sequence
28
+
*`programs/boot_sequence.asm` binary (aka `BROM`) is mapped from address_line `BOOTSEQUENCE_LOAD = 0x30`
29
+
* Memory Read
30
+
* If `BOOTSEQUENCE_ORG <= address_line < DEFAULT_PROGRAM_ORG`, pulls value from `BROM`
31
+
* Otherwise, pulls the value from `RAM`
32
+
* Execution starts with `PC` at `BOOTSEQUENCE_ORG = 0x34`
33
+
*`BROM` goal is to copy `PROM` to RAM at `DEFAULT_PROGRAM_ORG = 0x80`
34
+
* Followed by `jmp DEFAULT_PROGRAM_ORG`
35
+
36
+
#### PROM
37
+
* Programs like `programs/ping_pong.asm` are translated into binary and are referred to as `PROM`.
38
+
*`PROM` is connected to <chipset> as input-output device.
39
+
* The equivalent program is loaded in RAM at `DEFAULT_PROGRAM_ORG = 0x80`, followed by execution after boot sequence.
0 commit comments