
Spacelizard APU is a tiny 8-bit arithmetic processing unit.
It contains:
ABZ, carry C, negative N, overflow VThe control interface uses ui_in:
ui_in[7] = EXEC strobeui_in[6:4] = opcodeui_in[3:0] = argumentThe data bus uses uio_in and uio_out.
uo_out[7:0] always shows the current value of register A.
RAM uses only arg[2:0], so addresses are 0 to 7.
| Opcode | Function |
|---|---|
000 |
load/move/clear registers |
001 |
arithmetic: add/sub |
010 |
logic: and/or/xor/not |
011 |
shifts/rotates |
100 |
write RAM |
101 |
read RAM into A |
110 |
read register/status to uio_out |
111 |
read RAM directly to uio_out |
Apply a command on ui_in, put data on uio_in if needed, then pulse EXEC high for one clock cycle.
Example: load A = 0x12
uio_in = 0x12ui_in = 0b10000000ui_in = 0b00000000uo_out should show 0x12Example: add B into A
ABopcode = 001, arg = 0uo_outThe included cocotb test can be run with:
make -C test
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | ARG0 | A0 | DATA0 |
| 1 | ARG1 | A1 | DATA1 |
| 2 | ARG2 | A2 | DATA2 |
| 3 | ARG3 | A3 | DATA3 |
| 4 | OP0 | A4 | DATA4 |
| 5 | OP1 | A5 | DATA5 |
| 6 | OP2 | A6 | DATA6 |
| 7 | EXEC | A7 | DATA7 |