6
\$\begingroup\$

The manual of a computer processor usually includes a description of something called programmer's model. This section normally presents the core registers of the processor, operating modes, endianness and the instruction set.

I think the term refers to an abstract model that describes how a programmer should use the core components of the processor to program it. But I'm not sure whether I'm right or not, so I'm looking for a formal definition.

\$\endgroup\$
  • 2
    \$\begingroup\$ You are basically correct. Think of it as a theoretical (whiteboard or emulated) computer which executes code in the manner of the actual processor, and which the programmer can have in mind for ordinary tasks. Of course like all abstractions, there are dark corners where it breaks down. \$\endgroup\$ – Chris Stratton Mar 29 '18 at 19:04
  • \$\begingroup\$ I have never seen such a thing. \$\endgroup\$ – Hot Licks Mar 30 '18 at 2:13
11
\$\begingroup\$

I would describe it as follows...

In a computer system, the programmers model shows what the CPU has available to a programmer for the execution of computer programs. It covers the CPU resources for execution of the CPU's instruction set.

This programmers model would not detail hardware, such as how the CPU's electronic circuitry works, how buses transport data or the I/O peripherals available. In other words, the programmers model would not cover functions that cannot be observed by CPU instructions. The latter excludes programs trying to detect hardware operations, such as cache behaviour, read/write variances because of varying bus delays etc.

I imagine this could be debated but its remained a continual definition for me across the CPU systems I've seen over the years.

\$\endgroup\$
6
\$\begingroup\$

Basically, the "programmer's model" shows all elements of the computer (state variables, AKA registers) that can affect — or be affected by — the execution of instructions.

That model is what the instruction descriptions refer to when explaining exactly what each instruction does.

The underlying details of how all of that is actually accomplished are hidden from the programmer.

For example, looking at the programmer's model for the M68K architecture, you'd never be able to tell whether the underlying physical implementation used 8, 16, or 32-bit data paths and registers. There have been examples of all three, but they're programmed identically. This is important for the reusability of software, including software development tools.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy