I'm trying to implement a CPU of my own design from scratch (google j1 forth cpu for a really great example).
At this point it's going to be a simple 16 bit CPU with a RISC-like instruction set.
So my question is... assuming you have a state machine for the processor, how do you know how much you can accomplish in one processor cycle?
I assume if you do too much in one state, that state will be the bottleneck constraining your max processor speed.
So for example, assuming I have a RISC-style "store reg1,reg2(offset)" where reg1, reg2, and offset are all encoded in the instruction, how many states would I want?
Expressed sequentially, it would be:
Code: Select all
insn = read_memory(ip);
value = read_reg[insn[8:10];
offset = read_reg[insn[11:13]);
offset += insn[0:7];
store_memory(offset, value);
Now, I bet the offset computations could be done in a single state, so that gets us down to four states.
But is it reasonable to read both memory and registers in the same state/cycle? What about reading two registers in the same state/cycle?
If you group the states solely by dependencies and can read two different registers at once, it collapses to three states:
Code: Select all
insn = read_memory(ip);
value = read_reg[insn[8:10]]; offset = read_reg[insn[11:13] + insn[0:7];
store_memory(offset, value);
-Dave