2 ms·
I wonder what the challenges of emulating 36-bit machines on 32 and 64 bit systems are. Can you even do JIT? You probably don't need to, considering how slow t
by miki123211 3y ago
I wonder what the challenges of emulating 36-bit machines on 32 and 64 bit systems are.
Can you even do JIT? You probably don't need to, considering how slow these PDPs actually were, but it's an interesting question nevertheless.
- flohofwoe 3y agoFor ALU ops and address computations, if the 36-bit machines are also using the 2s-complements convention you can just do all computations in 64 bits and ignore the top bits. For memory accesses you could simply round up the data bus width of emulated CPU to the next power-of-2 as the "host word size". For instance if the emulated CPU accesses memory as 12-bit words, use an uint16_t array on the host CPU and treat the top 4 bits as junk. JIT-ing probably wouldn't make much of a difference with this approach as long as your host CPU is wider, since you just ignore the top-bits. When writing a chip emulator, it's actually not uncommon to deal with 'odd' bit widths. For instance a sound chip might have 3- or 5-bit wide counters. Also, in a language like Zig this stuff is quite convenient since Zig allows integer types of any width (e.g. you can have u3, u5, u36 etc...). Just have to be careful about how those types are represented in memory (e.g. bit-packed or not).