Comments by "k98killer" (@k98killer) on "Core Dumped"
channel.
-
Whether using a reduced instruction set or a complex one is "better" is a matter of opinion and use case. Complex instruction set architecture operations can take operands from registers, memory, or even the op code itself ("immediate" values). I have implemented a CPU in Minecraft redstone that uses an even more reduced instruction set architecture in which every operation uses only immediate values because it is the simplest way to implement a Brainfuck machine: the data pointer (in its own register) always points to a memory address; "+" and "-" respectively increment or decrement the value at that memory location, implemented as `ADD value` and `SUB value` to compact sequential operations; ">" and "<" respectively increment or decrement the data pointer itself, implemented as `ADP value` and `SDP value` to compact sequential operations; "[" branches if the value at the memory location is 0, taking an offset equal to the number of instructions to skip forward; "]" branches if the value at the memory location is not 0, taking an offset equal to the number of instructions to jump past backwards; "," reads a byte from stdin, writes it to the current memory location then increments the stdin pointer; "." writes the current memory location value to stdout then increments the stdout pointer. If I wanted to implement this with a standard register machine ISA, it would require many more registers and multiple CPU instructions per Brainfuck operation. (I also was able to use 4 copies of the same memory module for stdin buffer, instruction ROM, program RAM, and stdout buffer, greatly simplifying the whole thing.)
1
-
1
-
1
-
1