Quote:
Opcodes are 1 byte, except push/pop operations which are 2 bits.
The increase in memory traffic caused by an instruction that addresses a memory location depends on the size of the memory address. In the task, it was specified that the memory addressing is 16 bits. This means that each memory address is 16 bits or 2 bytes in size. Consequently, every instruction that addresses a memory location (e.g. LOAD, STORE, PUSH, POP) would require 2 bytes for the memory address in addition to the opcode. This applies regardless of the size of the opcode itself. Coding opcodes with 2 bits sounds strange, is there a typing error?
//edit:
As all variables are 4 bytes in size, this also affects the calculation of memory traffic for some commands that use memory addresses (such as LOAD, STORE, PUSH, POP). Each access to a variable requires an additional 4 bytes for the value of the variable.
Example:
PUSH D
(2 bytes for memory address + 4 bytes for the value + x bytes for opcode)
Various architecture data are missing, if the data bus does not manage 4 bytes together, several accesses would be necessary.
If OriginalGriff's comment applies with the stack-based virtual machine, this will probably also result in higher values.