Skip to the content
2 layers236.9 × 122.6 mmMykeyboard, the printed circuit board in 3D
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.md

kosugi_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〜2399VRAM
2400〜3429Global(グローバル変数)
3430〜4453Stack
4454Embedded LEDs
4455External LEDs
4456~4457Keyboard

データメモリ(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の命令メモリに書き込む

sh
cd COMPILER
./test.sh

programs/myothello.c をコンパイル・アセンブルし、CPU/rtl/memory/imem/machine_code_bin.dat に機械語を書き込みます。

CPUをシミュレーション

sh
cd CPU/script
./build_verilator.sh

Verilatorでビルドし、tb_top_gen.cpp によるテストベンチを実行します(波形: tb_top_gen.vcd)。

論理合成・回路図生成

sh
cd CPU/script
./synthesize.sh

rtl/cpu/ 配下の各モジュールをyosysで論理合成し、netlistsvgで回路図(SVG)を生成します。

Parts

88
QtyValueFootprintReferences
44SW_PushButton_Switch_Keyboard:SW_Cherry_MX_1.00u_PCBSW1, SW2, SW10, SW11, SW12, SW13, SW14, SW15, SW16, SW17, SW18, SW19, SW20, SW21, SW22, SW23 +28
12LEDLED_THT:LED_D3.0mmD11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22
12RResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_HorizontalR1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12
101N4148Diode_THT:D_DO-35_SOD27_P7.62mm_HorizontalD1, D2, D3, D4, D5, D6, D7, D8, D9, D10
6MountingHoleMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4, H5, H6
2Conn_01x24_SocketConnector_PinSocket_2.54mm:PinSocket_1x24_P2.54mm_VerticalJ1, J2
1Conn_02x07_Odd_EvenConnector_PinSocket_2.54mm:PinSocket_2x07_P2.54mm_VerticalJ5
1R_PotentiometerLibrary_kosugi:3362PRV1

Similar boards

  • 2 layers142.5 × 106.3 mmLily58, the printed circuit board in 3D

    Lily58

    kata0510/Lily58

    6×4+4keys column-staggered split keyboard.

    88 parts2.3k
  • 2 layers43.8 × 60.3 mmSmallreplacement, the printed circuit board in 3D

    Smallreplacement

    c0pperdragon/C64-Video-Enhancement

    Component video modification for the C64 8-bit computer

    88 parts286MIT
  • 2 layers95.3 × 95.3 mmRhymestone, the printed circuit board in 3D

    Rhymestone

    marksard/Keyboards

    This repository is warehouse of my keyboard architecture.

    88 parts193MIT
  • 2 layers69.9 × 108 mmAbakus Main, the printed circuit board in 3D

    Abakus Main

    mzuelch/CATs-Eurosynth

    Analog Synth Eurorack Modules

    88 parts166MIT
  • 2 layers127 × 36.2 mmIo board, the printed circuit board in 3D

    Io board

    vedderb/rise_sdvp

    The RISE Self-Driving Model Vehicle Platform

    88 parts144GPL-3.0
  • 2 layers44.6 × 53.7 mmNO2C, the printed circuit board in 3D

    NO2C

    turboedge/SpeedyBoards

    EMS boards powered by Speeduino

    88 parts110GPL-2.0
  • 2 layers43 × 43 mmTurboCAN, the printed circuit board in 3D

    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 mmR41l2, the printed circuit board in 3D

    R41l2

    cyril279/keyboards

    88 parts74MIT

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.