0
$\begingroup$

Let's say there was a CPU with an input bus of 4 bits and the 4 bits are the opcode then the next 4 bits are the operand. It would just be an 8-bit instruction split in two. Is this possible and how would it be done with logic gates?

$\endgroup$
2
  • 1
    $\begingroup$ One would need to remember the first part of an instruction (the opcode) until all parts (operands) are available, maybe until processed and result(s) made use of. Circuits to do so have been named latches, flip-flops, registers. Time allowing, compare Intel 8088 & 8086. $\endgroup$
    – greybeard
    Commented Apr 26, 2023 at 6:31
  • $\begingroup$ "x86 instructions can be anywhere between 1 and 15 bytes long": this should answer the first part of your question. $\endgroup$
    – user16034
    Commented Apr 26, 2023 at 12:57

1 Answer 1

0
$\begingroup$

You should look into "state machines".

Simple CPUs with variable length instructions have some kind of state machine.

Default state is fetching the opcode, then it fetches parameters or do memory accesses, eventually going through different states to execute each instruction.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.