Re: volatile vs aliased



Rolf wrote:
Do we have a difference to C/C++ increment operator here? consider

pragma Volatile (x);
x := x + 1;   -- (1)
        vs.
x++;          -- (2)

In the Ada case (1) we are forced to have "read from memory",
"increment" and "write to memory" instructions, whereas in C/C++ (2)
you can get a single "increment memory" instruction (presuming the
mentioned assembler instructions exist on a given processor)

Are there really memory chips with built-in arithmetic circuitry, so that the processor can send an "add one" instruction to the memory and have the variable incremented without reading it first? At least I've never heard of that. As far as I know, adding and subtracting is the processor's job.


And why would you use pragma Volatile on a variable stored in the memory, anyway? As Ludovic described it, it would only be useful on variables mapped to special hardware devices. I don't think you would want to store a counter there.

--
Björn Persson                              PGP key A88682FD
                   omb jor ers @sv ge.
                   r o.b n.p son eri nu
.



Relevant Pages

  • Re: [Lit.] Buffer overruns
    ... > floating point support or a memory expansion option. ... had virtual memory support grafted on. ... > where the modified instruction was fetched from. ... vis-a-vis the official coporate strategic operating system TSS/360. ...
    (sci.crypt)
  • Re: [PATCH] Mantaining turnstile aligned to 128 bytes in i386 CPUs
    ... :This doesn't contradict your claim since main memory is not really involved. ... that gives the same not-very-real-world cache state for all iterations ... full, and the cpu stalls anyway. ... static instruction order makes it easiest for them, ...
    (freebsd-arch)
  • Re: [PATCH] Mantaining turnstile aligned to 128 bytes in i386 CPUs
    ... :This doesn't contradict your claim since main memory is not really involved. ... that gives the same not-very-real-world cache state for all iterations ... full, and the cpu stalls anyway. ... static instruction order makes it easiest for them, ...
    (freebsd-current)
  • Re: New ARM Cortex Microcontroller Product Family from STMicroelectronics
    ... FIFOs or instruction prefetching are not ... It is much better to just have single cycle ... memory. ... The Stellaris CM3 running at 50 ...
    (comp.arch.embedded)
  • Fourth edition of Computer Architecture: A Quantitative Approach
    ... Computer Architecture: ... Increased coverage on achieving parallelism with multiprocessors. ... Advanced Techniques for Instruction Delivery and Speculation ... Distributed Shared Memory and Directory-Based Coherence ...
    (comp.arch)