ot_dsim is a native C implementation of the CRYPTO emulator with a small
CPython API.
From the directory containing the repository:
pip3 install ot_dsim/The build uses setuptools and a local C compiler. The emulator has no runtime
Python dependencies. Execution of one engine is sequential, and the extension
is small, so no THREADS environment variable is needed for either building or
running it.
from ot_dsim import CryptoEngine
engine = CryptoEngine()
engine.set_imem(0, 0xFC000000)
engine.set_dmem(0, 0x12345678)
engine.set_pc(0)
engine.run_emulator()
assert engine.get_imem(0) == 0xFC000000
assert engine.get_dmem(0) == 0x12345678The binding exposes:
reset_emulator_state(dmem=False, imem=False)run_emulator()set_pc(pc)set_dmem(idx, value)andget_dmem(idx)set_imem(idx, value)andget_imem(idx)
DMEM and IMEM are both exposed as 1,024 32-bit words. Values written to either memory are truncated to 32 bits. Resetting always clears execution state; DMEM and IMEM are retained unless their corresponding reset arguments are true.