Browse code

Add README.md file

Pawel Jablonski authored on 12/06/2024 18:13:36
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,255 @@
1
+# XiPU_v2
2
+
3
+XiPU_v2 is an 8-bit 7400 TTL CPU project. It is a second iteration of the XiPU project.
4
+
5
+## 1. About the project
6
+
7
+The XiPU_v2 is loosely based on MOS 6502 and early x86. It was my starting point of design my own CPU. For now, the XiPU_v2 has many differences and it is so much simpler than those CPUs.
8
+
9
+The second version of the XiPU has extended instruction set, new flat memory structure, advanced stack and function frame operations support.
10
+
11
+The main goal of the project is creating a fully functional 8-bit 7400 TTL CPU and a simple computer based on the one.
12
+
13
+### 1.1. Author
14
+
15
+- Pawel Jablonski (pj@xirx.net)
16
+
17
+### 1.2. License
18
+
19
+You can use this code however you like but leave information about the original author. Code is free for non-commercial and commercial use.
20
+
21
+Please see the LICENSE.txt file.
22
+
23
+### 1.3. Links
24
+
25
+- WWW: [xirx.net](https://xirx.net "xirx.net")
26
+- GIT: [git.xirx.net](https://git.xirx.net "git.xirx.net")
27
+
28
+## 2. Useful knowledge
29
+
30
+### 2.1. Dictionary
31
+
32
+- XiPU - XiRX Processor Unit. The name of the 8-bit TTL CPU.
33
+- XiPU_v2 - The second iteration of the XiPU.
34
+- XiPC - XiRX Personal Computer. The name of the simple computer based on XiPU CPU
35
+- TTL - Transistor-transistor logic.
36
+- HCT - High-Speed CMOS chips available in TTL compatible form.
37
+- RAM - Volatile random access memory.
38
+- ROM - Non-volatile read-only memory.
39
+- Register - Quickly accessible location for a small amount of data stored in a TTL chip.
40
+- uROM - uROM determines which of the internal registers is used to read from and write to at the current micro step of executing instruction.
41
+- BIOS - Basic input/output system. Provides access to basic IO API and loads the OS.
42
+- OS - Operating System. It contains a terminal interface and basic libraries.
43
+- Stack - High accessibly memory page where data is stored as FILO.
44
+- Function Frame - Part of the stack where arguments of the function and local variables are stored.
45
+- IO operation - Read or write data to pins connected to external world.
46
+- External BUS - Data highway for IO operations.
47
+- ALU - Arithmetic logic unit.
48
+
49
+### 2.2. XiPU_v2
50
+
51
+- 8-bit processor based on 7400 HCT chips compatible with TTL.
52
+- 64 kB of RAM space. Lower 2 kB are reserved for BIOS stored at EEPROM. The 4 kB at the end of the memory are used as a stack. Rest 58 kB of memory could be used by OS or applications.
53
+- 1 MHz clock speed. The processor uses a 2 MHz crystal to get two 1 MHz square waves shifted relative to the other about half.
54
+- The processor uses uROM stored in two EEPROMs.
55
+- Each instruction could be built from 2 to 16 micro steps. Each micro step took exactly 1 clock tick.
56
+- Four registers:
57
+	- A, B - 8-bit general purpose registers.
58
+	- X, Y - 8-bit auxiliary registers. Could be used mostly as general purpose registers. Together, it can be used as a 16-bit address register.
59
+- Two hidden stack registers:
60
+	- SP - Stack Pointer. It is used to address the head of the stack.
61
+	- BP - Base Pointer. It is used to address the function frame on the stack to store parameters of a function and local variables.
62
+- Three internal buses:
63
+	- BUS A - 8-bit main BUS for registers, RAM, ROM, IO operations.
64
+	- BUS B - 8-bit auxiliary BUS for registers used as second input for ALU.
65
+	- BUS C - 16-bit memory address BUS for addressing RAM.
66
+- 8-bit IN and 8-bit OUT external data BUS. It is used as a simple communication way with the external word.
67
+
68
+### 2.3. XiPC
69
+
70
+- Personal computer based on the XiPU.
71
+- 40x30 characters with 16 colors support. It uses 640x480 LCD with an 8-bit color palette to render image output.
72
+- Mono speaker with a volume knob.
73
+- RS-232 with 1200 bps support.
74
+- RTC with battery support.
75
+- Built-in QWERTY keyboard.
76
+- 4 status LEDs.
77
+- 7.5V max 1.0A power supply.
78
+
79
+## 3. Project overview
80
+
81
+### 3.1. Requirements
82
+
83
+The project supports building process on Windows and Linux.
84
+
85
+- Geany - Multi-language IDE. Used to create Makefile, assembler code etc.
86
+- QtCreator - IDE for C++/Qt. Used to create desktop applications.
87
+- Qt 5.12.4 - Multiplatform Qt 5 library. It supports UI, data structures, files etc.
88
+- GCC - C and C++ code compiler.
89
+- Keil uVision 5.37 - Compiler and debugger for the STM32F0 MCU.
90
+- Make - Build automation tool.
91
+- Doxygen 1.9.7 - Documentation generator from annotated sources.
92
+- Proteus 8.10 - Circuit simulator software. Used to simulate the XiPU.
93
+- QCAD - DXF files editor. Used to create Plexiglas case for the XiPC.
94
+- DipTrace 4.2.0.1 - Schematic and PCB design software.
95
+
96
+### 3.2. Project structure
97
+
98
+```console
99
+.
100
+├── LICENSE.txt    # License file.
101
+├── Makefile       # Main Makefile file to building binaries and documentations at once.
102
+├── README.md      # Readme file.
103
+├── bin            # Destination directory for all generated binaries during the build process.
104
+├── case
105
+│   ├── 3d         # A 3D printed case project for the XiPC.
106
+│   └── plexiglass # A simple Plexiglas case project for the XiPC.
107
+├── cpu
108
+│   ├── bios       # BIOS with a loader and IO API for the OS.
109
+│   ├── pcb        # PCB design for the XiPU.
110
+│   └── sim        # Simulation project of the XiPU.
111
+├── doc            # Destination directory for all generated documentations during the build process.
112
+├── ide
113
+│   ├── geany      # IDE configuration to support assembler for the XiPU.
114
+│   └── qtcreator  # IDE configuration for code rules.
115
+├── io
116
+│   ├── fw         # Firmware for the IO Board.
117
+│   └── pcb        # PCB design for the IO Board.
118
+├── kbd
119
+│   └── pcb        # PCB design for the Keyboard.
120
+├── sys
121
+│   ├── app        # Applications written for the XiPC.
122
+│   ├── fs         # File System generator needed by the real XiPC and the XiPC Emulator.
123
+│   └── os         # OS with a simple terminal and basic libraries for applications.
124
+└── tools
125
+    ├── asm        # Assembler Compiler.
126
+    ├── emu        # XiPC Emulator.
127
+    ├── fonts      # Fonts used in desktop GUI applications.
128
+    ├── lib        # Binary libraries needed to run compiled applications on Windows x64.
129
+    └── urom       # uROM generator.
130
+```
131
+
132
+## 4. Compiling
133
+
134
+### 4.1. Build all
135
+
136
+To build all binaries and create documentations for them, please type:
137
+
138
+```console
139
+make
140
+```
141
+
142
+### 4.2. Build a single module
143
+
144
+#### 4.2.1 uROM
145
+
146
+To build the application and create documentation, please type:
147
+
148
+```console
149
+cd tools/urom
150
+make
151
+```
152
+
153
+#### 4.2.2. ASM Compiler
154
+
155
+To build the application and create documentation, please type:
156
+
157
+```console
158
+cd tools/asm
159
+make
160
+```
161
+
162
+#### 4.2.3. BIOS
163
+
164
+To build the BIOS image file, the map file with API handlers, and create documentation, please type:
165
+
166
+```console
167
+cd cpu/bios
168
+make
169
+```
170
+
171
+#### 4.2.4. OS
172
+
173
+To build the OS, the map file with API handlers, please type:
174
+
175
+```console
176
+cd sys/os
177
+make
178
+```
179
+
180
+#### 4.2.5. IO Board firmware
181
+
182
+To build the IO Board firmware file, and create documentation, please type:
183
+
184
+```console
185
+cd io/fw
186
+make
187
+```
188
+To build successfully a firmware is needed the Keil uVision5 with a free license for STM32F0 MCU. UV4.exe must be added to the PATH env.
189
+
190
+#### 4.2.6. Applications
191
+
192
+To build the user applications, please type:
193
+
194
+```console
195
+cd sys/app
196
+make
197
+```
198
+
199
+#### 4.2.7. File System
200
+
201
+To generate a directory with the virtual file system, please type:
202
+
203
+```console
204
+cd sys/fs
205
+make
206
+```
207
+
208
+#### 4.2.8. XiPC Emulator
209
+
210
+To build the application and create documentation, please type:
211
+
212
+```console
213
+cd tools/emu
214
+make
215
+```
216
+
217
+## 5. Using
218
+
219
+### 5.1. uROM
220
+
221
+To generate uROM files, please type:
222
+
223
+```console
224
+./urom
225
+```
226
+
227
+### 5.2. ASM Compiler
228
+
229
+To compile BIOS, please type:
230
+
231
+```console
232
+./asm bios [input_file] [output_bin] [output_map]
233
+```
234
+
235
+To compile OS, please type:
236
+
237
+```console
238
+./asm os [input_file] [output_bin] [output_map]
239
+```
240
+
241
+To compile an application, please type:
242
+
243
+```console
244
+./asm app [input_file] [output_bin]
245
+```
246
+
247
+#### 5.3. XiPC Emulator
248
+
249
+To run the XiPC Emulator application, please type:
250
+
251
+```console
252
+./emu
253
+```
254
+
255
+It will show a window of the emulator ready to work. Next step is loading uROM files, BIOS file and choose the directory with the virtual file system. After that, the application is ready to run emulation.