diff --git a/hw/Makefile b/hw/Makefile
index 1f02f3c0af8db6e269bab603135fe392f1838f79..d7d8211e02e884ac446595e632c4916cfde4e58b 100644
--- a/hw/Makefile
+++ b/hw/Makefile
@@ -7,7 +7,7 @@ TARGETS = main
 
 all: $(TARGETS)
 
-TESTS = reg-file-tb reg-file-ice40-tb alu-unit-tb
+TESTS = reg-file-tb reg-file-ice40-tb
 
 check: all $(TESTS)
 	../run-tests $(TESTS)
@@ -23,7 +23,7 @@ clean:
 -include $(TARGETS:=.d) $(TESTS:=.d)
 
 top-ice40-sim: top-ice40.vl cpu-all.vl reg-file-ice40.vl mem-mux.vl \
-	alu-unit.vl unary-unit.vl shift-unit.vl \
+	unary-unit.vl shift-unit.vl \
 	mul-unit.vl reciprocal-unit.vl load-store-unit.vl \
 	instr-fetch.vl instr-decode.vl \
 	cpu.vl top-ice40-sim.vl \
@@ -40,7 +40,7 @@ random-bram.hex:
 	icebram -g -s 4711 64 1024 > $@T && mv $@T $@
 
 top-ice40.json: top-ice40.vl cpu-all.vl reg-file-ice40.vl mem-mux.vl \
-	alu-unit.vl unary-unit.vl shift-unit.vl \
+	unary-unit.vl shift-unit.vl \
 	mul-unit.vl reciprocal-unit.vl load-store-unit.vl \
 	instr-fetch.vl instr-decode.vl \
 	cpu.vl \
@@ -69,7 +69,7 @@ logic-analyzer-example.asc: logic-analyzer-example.json txd.pcf
 
 stats: instr-fetch.stats instr-decode.stats \
 	reg-file.stats reg-file-ice40.stats \
-	alu-unit.stats mem-mux.stats \
+	mem-mux.stats \
 	unary-unit.stats shift-unit.stats mul-unit.stats \
 	reciprocal-unit.stats ram-unit.stats \
 	cpu.stats tty-ice40.stats
@@ -82,7 +82,7 @@ mul-unit.stats: STATS_FLAGS = -top mul_unit
 tty-ice40.stats: avr109rx.vl avr109tx.vl
 
 cpu.stats: cpu-all.vl reg-file-ice40.vl mem-mux.vl \
-	alu-unit.vl unary-unit.vl shift-unit.vl \
+	unary-unit.vl shift-unit.vl \
 	mul-unit.vl reciprocal-unit.vl load-store-unit.vl \
 	instr-fetch.vl instr-decode.vl \
 	cpu.vl ram-unit.vl
diff --git a/hw/cpu/.gitignore b/hw/cpu/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2b3c8f4592cd42bf06bf24ed333aa74486358cf
--- /dev/null
+++ b/hw/cpu/.gitignore
@@ -0,0 +1 @@
+/shift_unit-test
diff --git a/hw/cpu/Makefile b/hw/cpu/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a316fa5824db2b6f7acd17d54ddc8e17bc9cdfcd
--- /dev/null
+++ b/hw/cpu/Makefile
@@ -0,0 +1,15 @@
+TESTS = alu_unit-test shift_unit-test
+
+IVERILOG_FLAGS = -g2005-sv -Wall -y lib -y ../arith/lib -I..
+
+all:
+	true
+
+check: $(TESTS)
+	../../run-tests $(TESTS)
+
+%: %.v
+	iverilog $(IVERILOG_FLAGS) -Mall=$@.dT  -o $@ $<  \
+	&& sed 's,^,$@: ,' < $@.dT > $@.d && rm -f $@.dT
+
+-include $(TESTS:=.d)
diff --git a/hw/alu-unit-tb.vl b/hw/cpu/alu_unit-test.v
similarity index 99%
rename from hw/alu-unit-tb.vl
rename to hw/cpu/alu_unit-test.v
index d62b281dc70fa12390897d15ad23980c21d516bc..b696693474646ad0922ac9ec5acfb9adf20323de 100644
--- a/hw/alu-unit-tb.vl
+++ b/hw/cpu/alu_unit-test.v
@@ -15,7 +15,6 @@
 */
 
 `include "instr-defines.vl"
-`include "alu-unit.vl"
 
 module main;
    reg [63:0] a;
diff --git a/hw/alu-unit.vl b/hw/cpu/lib/alu_unit.v
similarity index 100%
rename from hw/alu-unit.vl
rename to hw/cpu/lib/alu_unit.v