

Mykeyboard
- Size
- 236.9 × 122.6 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 88
- Nets
- 75
- Pads
- 359
- Tracks, vias
- 589, 42
- Pours
- 1
- Routed
- Yes
- KiCad
- KiCad 9.0 (file 20241229)
- Created
- 26 Jun 2026
- Updated
- 26 Jun 2026
Overview
Mykeyboard is an open-source printed circuit board by KosugiSubaru, from the KosugiSubaru/kosugi_CPU0626 repository on GitHub. It is a 2-layer board of 236.9 × 122.6 mm with 88 parts on 75 nets, routed with 589 tracks and 42 vias.
Its parts include 44 switches, 22 diodes, 12 resistors and 3 connectors.
README
README.mdkosugi_CPU0626
自作16bit ISA・CPUコアと、対応するCコンパイラ・アセンブラ、周辺HWドライバ一式。
システム接続関係

Cプログラム(オセロ)をコンパイラでバイナリに変換し、命令メモリ経由でCPUに供給する。CPUはデータメモリを介してVRAM・キーボードドライバとやり取りし、HDMIドライバでディスプレイに出力する。赤枠が本リポジトリで自作した部分(コンパイラ、Cプログラム、CPU、キーボードドライバ、キーボード)。
## CPUスペック
| 項目 | 値 |
|---|---|
| 実体 | TangNano9K (FPGA) に書き込み |
| 動作周波数 | 可変 |
| 命令数 | 16 |
| 命令セット | 手動定義 |
| Verilog回路 | Gemini 3 Flash で自動生成 |
| データ幅 | 16bit |
| レジスタ数 | 16 |
| 命令語長 | 16bit |
| ゼロレジスタ | R0 |
構成
ISA_definition.yaml— 命令セット定義(命令一覧・ビットフィールド・フラグ仕様)CPU/— CPUコア(Verilog RTL)、Verilatorシミュレーション・論理合成スクリプトCOMPILER/— Cコンパイラ(compiler/)とアセンブラ(assembler/)、テストプログラム(programs/)HW_DRIVER/— HDMI出力・マトリクスキーボード等のFPGA周辺ドライバ(Verilog)KiCad/— 基板(キーボード)のKiCadプロジェクト
ISA

16bit固定長、ALU系・即値系・メモリアクセス系・分岐/ジャンプ系の命令を定義(詳細は ISA_definition.yaml)。
データメモリマップ
| アドレス(Decimal) | 内容 |
|---|---|
| 0〜2399 | VRAM |
| 2400〜3429 | Global(グローバル変数) |
| 3430〜4453 | Stack |
| 4454 | Embedded LEDs |
| 4455 | External LEDs |
| 4456~4457 | Keyboard |
データメモリ(0〜)はVRAM・グローバル変数領域・スタックの後ろに、LEDやキーボード入出力用のメモリマップドI/Oを配置している。
実装メモ
- Cコンパイラ: 9cc を参考に自作。フロントエンドはLL(1)構文解析、バックエンドはスタックマシン向けコード生成。
- アセンブラ: Claude Codeで作成。長距離ジャンプは
auipc+asi+addiに変換してアドレス16bitを充填する。
規模感
- Cコンパイラ本体: 約560行(C言語)
stdio.hなどの標準ライブラリはinclude不可。入出力関数は自作(printf/scanf等は使用不可)- 宣言できる型は
intのみ(すべて16bit確保)。構造体・2次元配列は未対応
- 生成アセンブリ: 約16200行(スタックマシン向け・最適化なしのコンパイラのため冗長だが、ちゃんと動作する)
- 生成バイナリ: 16bit × 16245命令 = 32490byte ≈ 32KB
シミュレーション
Cプログラムをコンパイル→アセンブルし、CPUの命令メモリに書き込む
cd COMPILER
./test.shprograms/myothello.c をコンパイル・アセンブルし、CPU/rtl/memory/imem/machine_code_bin.dat に機械語を書き込みます。
CPUをシミュレーション
cd CPU/script
./build_verilator.shVerilatorでビルドし、tb_top_gen.cpp によるテストベンチを実行します(波形: tb_top_gen.vcd)。
論理合成・回路図生成
cd CPU/script
./synthesize.shrtl/cpu/ 配下の各モジュールをyosysで論理合成し、netlistsvgで回路図(SVG)を生成します。
Parts
88| Qty | Value | Footprint | References |
|---|---|---|---|
| 44 | SW_Push | Button_Switch_Keyboard:SW_Cherry_MX_1.00u_PCB | SW1, SW2, SW10, SW11, SW12, SW13, SW14, SW15, SW16, SW17, SW18, SW19, SW20, SW21, SW22, SW23 +28 |
| 12 | LED | LED_THT:LED_D3.0mm | D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22 |
| 12 | R | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12 |
| 10 | 1N4148 | Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal | D1, D2, D3, D4, D5, D6, D7, D8, D9, D10 |
| 6 | MountingHole | MountingHole:MountingHole_3.2mm_M3 | H1, H2, H3, H4, H5, H6 |
| 2 | Conn_01x24_Socket | Connector_PinSocket_2.54mm:PinSocket_1x24_P2.54mm_Vertical | J1, J2 |
| 1 | Conn_02x07_Odd_Even | Connector_PinSocket_2.54mm:PinSocket_2x07_P2.54mm_Vertical | J5 |
| 1 | R_Potentiometer | Library_kosugi:3362P | RV1 |
Similar boards
- 2 layers142.5 × 106.3 mm

- 2 layers43.8 × 60.3 mm

Smallreplacement
c0pperdragon/C64-Video-Enhancement
Component video modification for the C64 8-bit computer
88 parts286MIT - 2 layers95.3 × 95.3 mm

- 2 layers69.9 × 108 mm

- 2 layers127 × 36.2 mm

- 2 layers44.6 × 53.7 mm

- 2 layers43 × 43 mm

TurboCAN
henrikssn/TurboCAN
This is the official repository for the TurboCAN controller board, designed specifically for the Voron AfterBurner toolhead but can also be used on similar toolheads using NEMA17 steppers.
88 parts82 - 2 layers251.3 × 103.7 mm

Questions
How big is the Mykeyboard PCB?
It measures 236.9 × 122.6 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Mykeyboard use?
88 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Mykeyboard KiCad files?
From the KosugiSubaru/kosugi_CPU0626 repository on GitHub, at the commit this page was made from: the board is KiCad/mykeyboard/mykeyboard.kicad_pcb and its schematic KiCad/mykeyboard/mykeyboard.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Mykeyboard design in my own project?
Its repository states no licence, so its author keeps all rights: ask KosugiSubaru before reusing the design.