Ducky is a simple virtual CPU/machine simulator, with modular design and interesting features.
Ducky was created for learning purposes, no bigger ambitions. The goal was to experiment with CPU and virtual machine simulation, different instruction sets, and later working FORTH kernel become one of the main goals.
Ducky - as in "Ducky, the CPU" - is a 32-bit RISC CPU. Ducky, "the VM", is a simulator of Ducky CPU, adding few other modules to create the whole virtual machine, with CPUs, peripherals, storages and other components.
Instruction set was inspired by RISC CPUs, and sticks to LOAD/STORE aproach, with fixed-width instructions.
Flat, paged, with linear addressing. Main memory consists of memory pages, each page supports simple access control - simple MMU is implemented.
Virtual machine consists of several modules of different classes, and only few of them are necessary (e.g. CPU). Various peripherals are available, and it's extremely easy to develop your own and plug them in.
Multiple CPUs with multiple cores per each CPU, with shared memory. Each core can be restricted to its own segment of memory.
Modular persistent storages are available, and accessible by block IO operations, or by mmap-ing storages directly into memory.
Compiled programs are stored in bytecode files that are inspired by ELF executable format. These files consist of common sections (.text
, .data
, ...), symbols, and their content. Assembler (ducky-as
) translates assembly sources into object files, and these are then processed by a linker (ducky-ld
) into the final executable. Both object and executable files use the same format and bytecode for instructions and data.
Virtual machine can be suspended, saved, and later restored. This is also useful for debugging purposes, every bit of memory and CPU registers can be investigated.
Basic support is included - break points, watch points, stack traces, stepping, snapshots, ...
as
for translating assembler sources to bytecode filesld
for linking bytecode files into the final executableobjdump
for inspection of bytecode filescoredump
for inspection of snapshotsvm
for running virtual machine itselfimg
for converting binaries to images
FORTH
kernel - basic functionality but at least ANS compliant- network support - it would be awesome to have a network stack available for running programs
- functioning C compiler, with simple C library
- and few others...
The whole development is tracked on a GitHub page, including source codes and issue tracker.