Modified Harvard architecture

Modified Harvard architecture

The Modified Harvard Architecture is a variation of the Harvard computer architecture that allows the contents of the instruction memory to be accessed as if it were data. Most modern computers that are documented as Harvard Architecture are, in fact, Modified Harvard Architecture.

Contents

Harvard Architecture

The original Harvard architecture computer, the Harvard Mark I, employed entirely separate memory systems to store instructions and data. The CPU fetched the next instruction and loaded or stored data simultaneously and independently. This is in contrast to a Von Neumann architecture computer, in which both instructions and data are stored in the same memory system and (without the complexity of a cache) must be accessed in turn. The physical separation of instruction and data memory is sometimes held to be the distinguishing feature of modern Harvard architecture computers. With microcontrollers (entire computer systems integrated onto single chips), the use of different memory technologies for instructions (e.g. flash memory) and data (typically read/write memory) in von Neumann machines is becoming popular.[why?] The true distinction of a Harvard machine is that instruction and data memory occupy different address spaces. In other words, a memory address does not uniquely identify a storage location (as it does in a Von Neumann machine); you also need to know the memory space (instruction or data) to which the address belongs.

Modified Harvard architecture

A computer with a Von Neumann architecture has the advantage over pure Harvard machines in that code can also be accessed and treated the same as data, and vice versa. This allows for example reading data from disk storage and executing it as code; or self-optimizing software systems using technologies such as just-in-time compilation to write machine code into their own memory and then later execute it. Another example is Self-modifying code, which allows a program to modify itself. A disadvantage of these methods are issues with executable space protection, which increase the risks from malware and software defects. In addition, in these systems it is notoriously difficult to document code flow, and also can make debugging much more difficult.

Accordingly, some pure Harvard machines are specialty products. Most modern computers instead implement a modified Harvard architecture. Those modifications are various ways to loosen the strict separation between code and data, while still supporting the higher performance concurrent data and instruction access of the Harvard architecture.

The most common modification builds a memory hierarchy with a CPU cache separating instruction and data. This unifies all except small portions of the data and instruction address spaces, providing the von Neumann model. Most programmers never need to be aware of the fact that the processor core implements a (modified) Harvard architecture, although they benefit from its speed advantages. Only programmers who write instructions into data memory need to be aware of issues such as cache coherency and executable space protection.

Another change preserves the "separate address space" nature of a Harvard machine, just providing special machine operations to access the contents of the instruction memory as data. Because data is not directly executable as instructions, such machines are not always viewed as "modified" Harvard architecture:

  • Read access ... initial data values can be copied from the instruction memory into the data memory when the program starts. Or, if the data is not to be modified (it might be a constant value, such as pi, or a text string), it can be accessed by the running program directly from instruction memory without taking up space in data memory (which is often at a premium).
  • Write access ... a capability for reprogramming is generally required; few computers are purely ROM based. For example, a microcontroller usually has operations to write to the flash memory used to hold its instructions. This capability may be used for purposes including software updates and EEPROM replacement.

Comparisons

Three characteristics may be used to distinguish Modified Harvard machines from Harvard and Von Neumann machines:

  • Instruction and data memories occupy different address spaces. For pure Harvard machines, there is an address 'zero' in instruction space that refers to an instruction storage location and a separate address 'zero' in data space that refers to a distinct data storage location. By contrast, Von Neumann and modified Harvard machines store both instructions and data in a single address space, so address 'zero' refers to only one thing and whether the binary pattern in that location is interpreted as an instruction or data is defined by how the program is written. This characteristic unambiguously identifies a pure Harvard machine.
    • By a strict interpretation of this distinction, for example, the Microchip PIC17 and PIC18 architectures, as well as the Atmel 8-bit AVR architecture, would be regarded as pure Harvard Architecture machines because they do, in fact, maintain a distinct separation between code and data spaces, and address 'zero' of each does, in fact, refer to a physically different piece of memory. However, the distinction is made ambiguous by the colloquial use of the term "modified Harvard Architecture" to refer to such machines' inclusion of special instructions to read and/or write the contents of code space as though it were data.[1]
  • Instruction and data memories have separate hardware pathways to the central processing unit (CPU). This is the point of pure or modified Harvard machines, and why they co-exist with the more flexible and general von Neumann architecture: separate memory pathways to the CPU allow instructions to be fetched and data to be accessed at the same time, improving throughput. The pure Harvard machines have separate pathways with separate address spaces. Modified Harvard machines have such separate access paths for CPU caches or other tightly coupled memories, but a unified address space covers the rest of the memory hierarchy. A Von Neumann processor has only that unified address space. From a programmer's point-of-view, a modified Harvard processor is usually treated as a Von Neumann machine until cache coherency becomes an issue, as with self-modifying code and program loading. This can be confusing, but such issues are usually visible only to systems programmers and integrators.[clarification needed]
  • Instruction and data memories may be accessed in different ways. The original Harvard machine, the Mark I, stored instructions on a punched paper tape and data in electro-mechanical counters. This, however, was entirely due to the limitations of technology available at the time. Today a Harvard machine such as the PIC microcontroller might use 12-bit wide flash memory for instructions, and 8-bit wide SRAM for data. In contrast, a Von Neumann microcontroller such as an ARM7TDMI, or a modified Harvard ARM9 core, necessarily provides uniform access to flash and SRAM (as 8 bit bytes, in those cases).

Modern uses of the Modified Harvard architecture

Outside of applications where a cacheless DSP or microcontroller is required, most modern processors have a CPU cache which partitions instruction and data. Accordingly, they are hybrids of the Harvard and von Neumann models, and are best viewed as implementing a Modified Harvard Architecture. Examples include the x86 processors found in most desktop computers, and ARM cores embedded as applications processors in cell phones. MIPS, Blackfin, PowerPC, and many other processor families implement this flavor of Modified Harvard Architecture.[clarification needed]

There are also processors which are Harvard machines by the most rigorous definition (that program and data memory occupy different address spaces), and are only modified in the weak sense that there are operations to read and/or write program memory as data. For example, LPM (Load Program Memory) and SPM (Store Program Memory) instructions in the Atmel AVR implement such a modification. Similar solutions are found in other microcontrollers such as the PIC and Z8Encore!, many families of digital signal processors such as the TI C55x cores, and more. Because instruction execution is still restricted to the program address space, these processors are very unlike von Neumann machines.

Having separate address spaces creates certain difficulties in programming with high-level languages such as C, which don't directly support the notion that tables of read-only data might be in a different address space than normal writable data (and thus need to be read using different instructions).[1]

See also

Notes and references

  1. ^ a b The maintainers of the standard C library for the GCC port to the Atmel AVR microcontroller, which has separate address spaces for code and data, state in Data in Program Space that separate address spaces imply a Harvard architecture. They go on to explain that the C language only has one pointer address space, and thus was not designed for Harvard architecture machines. They then describe the non-standard extensions adopted by GCC for the AVR and the AVR C library to allow access to data stored in instruction (program) memory. They even explain why the const keyword cannot be pressed into service to distinguish data objects to be placed in instruction memory.

Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Harvard architecture — The Harvard architecture is a computer architecture with physically separate storage and signal pathways for instructions and data. The term originated from the Harvard Mark I relay based computer, which stored instructions on punched tape (24… …   Wikipedia

  • Super Harvard Architecture Single-Chip Computer — The Super Harvard Architecture Single Chip Computer (SHARC) is a high performance floating point and fixed point DSP from Analog Devices,not to be confused with Hitachi s SuperH (SH) microprocessor. SHARC is used in a variety of signal processing …   Wikipedia

  • Harvard Mark I — Portion of the Harvard IBM Mark 1, left side …   Wikipedia

  • Von Neumann architecture — The term Von Neumann architecture, aka the Von Neumann model, derives from a computer architecture proposal by the mathematician and early computer scientist John von Neumann and others, dated June 30, 1945, entitled First Draft of a Report on… …   Wikipedia

  • Western architecture — Introduction       history of Western architecture from prehistoric Mediterranean cultures to the present.       The history of Western architecture is marked by a series of new solutions to structural problems. During the period from the… …   Universalium

  • Organizational architecture — has two very different meanings. In one sense it literally refers to the organization in its built environment and in another sense it refers to architecture metaphorically, as a structure which fleshes out the organizations. Organizational… …   Wikipedia

  • Power Architecture — is a broad term to describe similar instruction sets for RISC microprocessors developed and manufactured by such companies as IBM, Freescale, AMCC, Tundra and P.A. Semi. The governing body is Power.org, comprising over 40 companies and… …   Wikipedia

  • Atmel AVR — AVR logo. Atmel AVR ATmega8 in 28 pin DIP . The AVR is a …   Wikipedia

  • Machine code — or machine language is a system of impartible instructions executed directly by a computer s central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data (in a register or in memory, e.g …   Wikipedia

  • Turing machine — For the test of artificial intelligence, see Turing test. For the instrumental rock band, see Turing Machine (band). Turing machine(s) Machina Universal Turing machine Alternating Turing machine Quantum Turing machine Read only Turing machine… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”