assembly - Loading program from RAM in 8086 -
the 8086 using 16-bit instruction ram addresses hold 8-bit how cpu load programms ram ? load 1 address , checks if instruction needs 1/2/3 bytes (e.g. moving immediate register 8/16 bit) , executes operation or getting wrong 1 ram 'space' 16-bit big ?
many instructions multi-byte, , yes means span 2 or more addresses.
iirc, 8086's memory bus 16-bit, can load 16 bits (two adjacent addresses) in single operation. you're confusing byte-addressable memory bus width.
does load 1 address , checks if instruction needs 1/2/3 bytes (e.g. moving immediate register 8/16 bit)
it continually fetches instruction bytes 6-byte buffer (2 bytes @ time, because it's 16-bit cpu 16-bit busses). buffer large enough hold largest allowed 8086 instruction (excluding prefixes, might decoded separately, idk). when it's done executing previous instruction, looks @ buffer. see link below better description, tries decode buffer whole instruction. if hits end of fetch buffer before finding end of instruction, waits until next fetch cycle has completed , tries again.
see also: 8086 cpu architecture, first hit "8086 code fetch". confirms fetch , execute overlap, it's pipelined in basic way.
tl:dr: fetches buffer until has whole instruction decode. shifts bytes front of buffer, because they're part of next instruction.
i've read instruction-fetch bottleneck 8086, optimizing code-size outweighed pretty else.
a pipelined cpu wouldn't have wait execution of previous instruction finish started on decoding. modern cpus have much higher bandwidth code-fetch, have queue of decoded instructions ready go (except when branches mess up.) see http://agner.org/optimize/, , other links in x86 tag wiki.
also, common instructions single byte, push r16
.
Comments
Post a Comment