flat assembler
Message board for the users of flat assembler.

Index > Heap > paradox ?

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
roboticmehdi



Joined: 20 Apr 2011
Posts: 22
roboticmehdi
Hi revolution. How does cpu receive instructions from memory, bit by bit, byte by byte, word by word or maybe somehow otherwise ?
Post 24 Jun 2011, 15:52
View user's profile Send private message Reply with quote
roboticmehdi



Joined: 20 Apr 2011
Posts: 22
roboticmehdi
oh sure this may depend from cpu to cpu, but let's say we are talking about intel x86s (8086, 80386..)
Post 24 Jun 2011, 15:54
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
It depends on CPU even on the same family. For example 8086 reads/writes by 16bit words; 8088 by 8bit words. AFAIK, the modern 32bit CPU read 64bit words or maybe even 128.
Post 24 Jun 2011, 16:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1413
Location: Toronto, Canada
AsmGuru62
Much more complicated. The code instructions are loaded first into some cache then into CPU - also there are few conveyers...
Post 24 Jun 2011, 19:26
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17463
Location: In your JS exploiting you and your system
revolution
roboticmehdi wrote:
Hi revolution. How does cpu receive instructions from memory, bit by bit, byte by byte, word by word or maybe somehow otherwise ?
In a modern CPU system (mobo, memory, CPU, etc.) things are very complicated. But that doesn't really matter too much unless you are designing, or debugging, hardware related things. For most purposes, from a software perspective you can simply assume that instructions and data are read byte by byte and generally you don't have to worry about any hardware technology that underlies the CPU. Some instructions do require proper alignment to support proper hardware access, but these are explained in the manuals where needed.
Post 28 Jun 2011, 04:02
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
It is safe to assume that DATA is read 2^N bytes at a time when aligned and byte-by-byte otherwise (of course there can be exceptions like with SSE where unaligned 16 bytes will be read with 2x16-byte reads and the data is shifted the right amount).

What roboticmehdi asked was how CODE (machine instructions) are read and I think the answer can be split into two:
1) Fetch mechanism reads as much as it can at one time (a machine word length, which might be 64 or 128 bits in width or more)
2) Decoding happens byte at a time for all the prefixes. When instruction length is known, the full instruction will be fed through the decoding pipeline.

I haven't got enough knowledge to say if these happen in parallel or is #2 requesting #1 for more data or some other mechanism.
Post 28 Jun 2011, 06:05
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.