3 ms·
Why 8 bit opcodes if there's only 14 opcodes? Even if it's just to deal with fixed width 12bit opcodes embedding a constant would seem to be win. Of the given
by benj111 4y ago
Why 8 bit opcodes if there's only 14 opcodes?
Even if it's just to deal with fixed width 12bit opcodes embedding a constant would seem to be win.
Of the given examples only 1 would be longer (by 4 bits) all the rest would be shorter.
Or maybe that's the point as it is a teaching aid
Student: why 8 bits for only 14 op codes, you could do X
Teacher: why don't you try it?
- danielmarkbruce 4y agoSurely it's to make it simpler to implement?
- benj111 4y ago12bit instructions would be easier (I think?) If you're inplementing it in software. If you're doing hardware then you're either making the 256b memory 50% bigger or adding logic. Plus you need extra transistors to decode the longer instruction but you don't need to deal with the context switch of switching between instructions and data.
- danielmarkbruce 4y agoWhy would 12 bit be easier? It's written in C. For any given opcode you can just do a direct comparison in c to a char type. It would be easier to enter the instructions in text and the program read it, it would be easier to compare. I could easily be missing something here, but any time you have to chose between a nice round single byte and something else in c, it sounds like extra work to choose something else.
- benj111 4y agoTo me the tradeoff is mask and shift / bitfield v go get instruction, this instruction relies on data, go get the data, now complete the instruction. It seems to me that would add complication, more so than a weird width. I suppose you could conceptualise an instruction data pair as one 16 bit instruction.
- danielmarkbruce 4y agoI see your point, I think I agree with you on second thought.