5e2e2eb5da
Return to the usual whitespace-skipping istreams. No need to go beyond word-based parsing. This exercise reinforces the amount of duplication between load_program() and transform_immediate(). |
||
---|---|---|
.. | ||
teensy | ||
000organization.cc | ||
001help.cc | ||
002test.cc | ||
003trace.cc | ||
003trace.test.cc | ||
010core.cc | ||
011direct_addressing.cc | ||
012indirect_addressing.cc | ||
013immediate_addressing.cc | ||
014index_addressing.cc | ||
015jump_relative.cc | ||
016jump_relative.cc | ||
017functions.cc | ||
019syscalls.cc | ||
020elf.cc | ||
021translate.cc | ||
022transform_immediate.cc | ||
Readme.md | ||
build | ||
build_and_test_until | ||
cheatsheet.pdf | ||
clean | ||
edit | ||
ex1 | ||
ex1.1.subx | ||
ex1.2.subx | ||
ex2 | ||
ex2.subx | ||
ex3 | ||
ex3.subx | ||
ex4 | ||
ex4.subx | ||
g | ||
gen | ||
gg | ||
nrun | ||
opcodes | ||
run | ||
subx | ||
subx.vim | ||
test_layers | ||
vimrc.vim |
Readme.md
The SubX VM
Bytecode interpreter for a subset of the 32-bit x86 ISA.
- Only instructions that operate on the 32-bit E*X registers. (No floating-point yet.)
- Only instructions that assume a flat address space; no instructions that use segment registers.
- No instructions that check the carry or parity flags; arithmetic operations always operate on signed integers (while bitwise operations always operate on unsigned integers)
- Only relative jump instructions (with 8-bit or 16-bit offsets).
These rules yield a clean instruction set. We don't care about running arbitrary binaries, just those generated by our forthcoming Mu compiler.
Targeting a VM enables more comprehensive tests for the compiler, without requiring access to processor/memory state without getting bogged down in details of the ELF format, ABI, STABS debugging format, etc., etc.
Having the VM implement a real (and ubiquitous) instruction set makes it easy to generate native binaries outside of tests.
Just unit tests so far:
./subx test
x86 instruction set resources used in building this: