この記事は、大阪工業大学 Advent Calendar 2020の16日目の記事です。 はじめにマインクラフトで4bitCPUを作りました。 実行できる命令はLDIとADDの2種類、レジスタは2個、命令メモリは8個、動作周波数は約0.5Hzです。扱える値は符号なし整数です。レジスタ幅が4bitでLDIのオペランドが2bitの即値を取ることが出来るので0~15(\(2^4\))の範囲で0~3(\(2^2\))の加算を行うことが出来ます。 4bitCPU 4bitCPUCPU原始的なCPUは以下の部品で作ることが出来ます。 命令メモリプログラムカウンタ全加算器レジスタファイルALU(AND、SUB、OR、ADDとかの演算が出来る)セレクタ符号拡張機CPUは命令が格納された命令メモリから順番に命令を読み込み、命令を解釈して様々な処理をを行います。一般にCPUでの演算は汎用レジスタ同士で行われま