Harvard Architecture of Microcontroller

Harvard architecture computers have separate memory areas for program instructions and data. There are two or more internal data buses which allow simultaneous access to both instructions and data. The CPU fetches instructions on the program memory bus. If the fetched instruction requires an operation on data memory, the CPU can fetch the next program instruction while it uses the data bus for its data operation. This speeds up execution time at the cost of more hardware complexity.

Since Harvard machines assume that only instructions are stored in program memory space, how do you write and access data stored in program memory space? For example, a data value declared as a C constant must be stored in ROM as a constant value. Different microcontrollers have different solutions to this problem. A good C compiler automatically generates the code to suit the target hardware’s requirements. Some chips have special instructions allowing the retrieval of information from program memory space. These instructions are always more complex or expensive than the equivalent instructions for fetching data from data memory.

Typically these chips have a register analogous to the program counter (PC) which refers to addresses in program space. Also, some chips support the use of any 16 bit value contained in data space as a pointer into the program address space. These chips have special instructions to use these data pointers.


It is important that you understand how your Harvard architecture part deals with data in program space. It is possible to generate more efficient code using symbolic constants declared with #define directives instead of declared constants. You may also create global variables for constant values.


Post a Comment

If you have any questions or droughts feel free to ask here.