KCC - Kayte C Compiler 1.10.0
A C compiler implementation with preprocessor, lexer, parser, and code generator
Loading...
Searching...
No Matches
psx.h
1/*
2 * psx.h - A detailed header file for the Sony PlayStation 1 (PSX) hardware.
3 *
4 * This file contains constants and structures based on the known specifications
5 * of the PlayStation's main components, reflecting the information from the
6 * LSI Logic CW33300-based R3051 CPU and its integrated coprocessors.
7 */
8
9// =============================================================================
10// 1. Header Guard
11// =============================================================================
12#ifndef PSX_H
13#define PSX_H
14
15// =============================================================================
16// 2. Main CPU (LSI CoreWare CW33300 / MIPS R3051)
17// =============================================================================
18#define PSX_CPU_MODEL "LSI CoreWare CW33300 (MIPS R3051 compatible)"
19#define PSX_CPU_CLOCK_HZ 33868800UL // 33.8688 MHz
20#define PSX_CPU_MIPS 30 // 30 Million Instructions Per Second
21#define PSX_BUS_BANDWIDTH_Bps 132000000UL // 132 MB/s
22
23// --- CPU Cache ---
24#define PSX_CPU_I_CACHE_SIZE_BYTES 4096 // 4 KB Instruction Cache
25#define PSX_CPU_D_CACHE_SIZE_BYTES 1024 // 1 KB Data Cache (Scratchpad RAM)
26
27// --- Manufacturing Details ---
28#define PSX_CPU_FAB_PROCESS_NM 500 // 500 nm (0.5 micron) process node
29#define PSX_CPU_MANUFACTURER "LSI Logic Corp. (SGI License)"
30
31// Structure to hold all CPU-related specifications
32typedef struct {
33 const char* model;
34 unsigned long clock_speed_hz;
35 unsigned int mips;
36 unsigned long bus_bandwidth_bytes_per_sec;
37 unsigned int instruction_cache_bytes;
38 unsigned int data_cache_bytes;
40
41
42// =============================================================================
43// 3. Geometry Transformation Engine (GTE) - Coprocessor 1
44// =============================================================================
45// The GTE is a coprocessor residing within the main CPU die.
46#define PSX_GTE_MIPS 66 // 66 Million Instructions Per Second
47
48// --- Polygon Rendering Performance (Polygons per second) ---
49#define PSX_GTE_POLYS_PER_SEC_FLAT 360000
50#define PSX_GTE_POLYS_PER_SEC_TEXTURED 180000
51#define PSX_GTE_POLYS_PER_SEC_TEX_LIT_GOURAUD 90000
52
53// Structure for GTE specifications
54typedef struct {
55 unsigned int mips;
56 unsigned int pps_flat_shaded;
57 unsigned int pps_textured;
58 unsigned int pps_full_effect;
60
61
62// =============================================================================
63// 4. Motion Decoder (MDEC) - Coprocessor
64// =============================================================================
65// The MDEC also resides within the main CPU and handles video decompression.
66#define PSX_MDEC_MIPS 80 // 80 Million Instructions Per Second
67
68// Structure for MDEC specifications
69typedef struct {
70 unsigned int mips;
71 const char* function;
73
74
75// =============================================================================
76// 5. System Memory Map
77// =============================================================================
78#define PSX_RAM_MAIN_SIZE_BYTES (2 * 1024 * 1024) // 2 MiB EDO DRAM
79#define PSX_VRAM_SIZE_BYTES (1 * 1024 * 1024) // 1 MiB Framebuffer (GPU RAM)
80#define PSX_SPU_RAM_SIZE_BYTES (512 * 1024) // 512 KiB Sound RAM
81#define PSX_BIOS_ROM_SIZE_BYTES (512 * 1024) // 512 KiB BIOS ROM
82#define PSX_CDROM_BUFFER_BYTES (32 * 1024) // 32 KiB CD-ROM Buffer
83
84// Structure for the memory layout
85typedef struct {
86 unsigned int main_ram_bytes;
87 unsigned int vram_bytes;
88 unsigned int spu_ram_bytes;
89 unsigned int bios_rom_bytes;
90 unsigned int cdrom_buffer_bytes;
92
93
94#endif // End of header guard PSX_H
95