Re: int vs char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
>  > I had read somewhere that a 32 bit processor can
>  > read/write only and only 32 bits in any one
> cycle.
> 
> That's not strictly true, as most 32-bit processors
> these days are
> multiple-issue, but let's carry on.

This conflicts with your later statement of a
processor reading a whole word. I presume that the
word is 32 bits on a 32 bit processor. Or, is it that
they can read more than 32 bits. I was referring to
reading atleast 32 bits. 


> 
>  > 2. When a processor gives an instruction to read
> only
>  > 8 bits, then is it manipulating the 32 bits by
> itself?
> 
> No.  

Is it not manipulating them in the barrel register
after reading a word?

> 
>  > 3. If the address of my 'char' is 0x5, then do we
> only
>  > read the memory location 0x5, or from 0x4 to 0x7,
> and
>  > then manipulate it to get the value at 0x5 in the
>  > lowest 8 bits of the 32 bit register.
> 
> OK, this is how it usually works:
> 
> The processor reads a whole word.
> 
> The word is loaded into a barrel shifter (see
> http://en.wikipedia.org/wiki/Barrel_shifter) and the
> byte we want is
> shifted to the correct position in the word.
> 
> The high-order bits in the word are masked to zero
> (or the byte is
> sign extended).
> 
> Writing a single byte is harder: we either have to
> do a
> read/modify/write cycle or use byte select lines to
> the memory
> devices.  This is where caches come into play: it is
> very likely that
> the memory word we want to write is already in the
> cache, so even if
> we do want to do a read/modify/write, that doesn't
> involve a read
> access to external memory.
> 

Essentially you are also saying the same thing. When I
reuqest for one byte, the processor reads one word (32
bits), and manipulates those bits (in barrel register)
to get one byte in the lowest 8 bits of the register.

So, this confirms that a 32 bit (1 word = 32 bits)
processor can read only and only 32 bits (1 word) in
one cycle. It may read more in one cycle but not less.

Please let me know if I have not understood something
correctly.

--

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux