Computer architecture, RAM and ROM

Thread Starter

ZimmerJ

Joined Dec 9, 2020
48
Harvard architecture has separate program and data memory-storages (ROM and RAM separated to my understanding). Why does it say that modern PC's use Von Neumann where the two are combined into one storage? As far as my experience goes with the hardware of modern PC's, they use separate RAM and SSD/HDD (SSD/HDD being Secondary memory, which corresponds to program memory, correct?). I did read somewhere that RAM and ROM both belong to the classification of Primary memory. So i know that i'm definitely missing something. It's very confusing to me.

Appreciate any answers, i didn't find any existing threads about the subject. If there is one, i'd be happy to be directed there.
 

Papabravo

Joined Feb 24, 2006
16,118
The separate program and memory spaces in the Harvard Architecture imply separate address and data buses. In the Princeton (von Neumann) architecture, the program and data memory share the same address and data bus. One consequence of this is that data can be executed as if it was a program and a program can be mistaken for data. Programs can be written to modify themselves. This is quite impossible in a Harvard architecture.
 
@Papabravo said it pretty well. Instruction and data space, so you can't execute data. They can both be RAM.

Memory management can have multiple processor modes and different I and d spaces. i.e spaces for the OS and spaces for the user.

Computers generally have a bootloader. The PDP-11 early on had a short program you would manually enter using switches that would read block #1 from the device your booting from. Block one had longer code that would read the rest of the OS and start executing. Eventually that became ROM with some selections possible.

Then eventualy "Boot?" appeared on the console which was a yes for default device or a supported device/unit #.

Now there is the UEFI (spelling) bootloader.
 

andrewmm

Joined Feb 25, 2011
1,467
Re the concept of drives ,
No this is not program storage

All code data runs from RAM,
there are mechanisms to move the code needed to / from ram as needed,

On top of that, depending upon the processor, there can be more than one level of cache,


A ROM, is a Read Only Memory
Mainly implemented now days by FLASH , which can actually be written as well as read, but relatively slowly.

As an example, Flash is used on a PC for the Built In Operating System, ( BIOS )
At start up, the processor copies that into its local memory and executes,

When you run a program on a PC, its normally on the hard drive / SD card, ( SD is a Flash )
Simplicity the CPU copies the first bit into the ram, and run it.

The difference in the architecture is do they use one RAM , or separate RAM areas, Either in one RAM on in multiple RAMs.
In the single RAM case, data is typically at one end of the memory and fills upwards, program is at the other end, and fills downward,
Thus you can trade off program space for data space. But the processor can only access program or data at any one time,

In the dual ram space case, program is in one area, data in the other, if you fill up the program area, even if the data area is empty , you are full. Also the processor can access both data and program at the same time.

It all depends on the needs,
If you are doing DSP, then data and program access at same time can be fast,
If you running WORD, then the extra complexity of dual ram access is not worth it.
 

nsaspook

Joined Aug 27, 2009
8,382
Typically code actually runs in registers, a CPU memory cell vs a RAM memory cell. Registers, Cache, RAM. Registers and RAM are both memory but they are accessed in different ways. Each register is directly addressed in the op code for operations more complex than just memory storage
Some architectures extend registers into fast localized RAM but this always places limits on those registers compared to registers native to the ALU.
http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/01/intro-computer2.html

cpu1.gif

memory.gif
 
Last edited:

Thread Starter

ZimmerJ

Joined Dec 9, 2020
48
The separate program and memory spaces in the Harvard Architecture imply separate address and data buses. In the Princeton (von Neumann) architecture, the program and data memory share the same address and data bus. One consequence of this is that data can be executed as if it was a program and a program can be mistaken for data. Programs can be written to modify themselves. This is quite impossible in a Harvard architecture.
I see, but Harvard architecture also implies that they are physically separated, right? That's why the program and data can share the same bus in Von Neumann architecture, because it uses the same memory?
 

Thread Starter

ZimmerJ

Joined Dec 9, 2020
48
Re the concept of drives ,
No this is not program storage

All code data runs from RAM,
there are mechanisms to move the code needed to / from ram as needed,

On top of that, depending upon the processor, there can be more than one level of cache,


A ROM, is a Read Only Memory
Mainly implemented now days by FLASH , which can actually be written as well as read, but relatively slowly.

As an example, Flash is used on a PC for the Built In Operating System, ( BIOS )
At start up, the processor copies that into its local memory and executes,

When you run a program on a PC, its normally on the hard drive / SD card, ( SD is a Flash )
Simplicity the CPU copies the first bit into the ram, and run it.

The difference in the architecture is do they use one RAM , or separate RAM areas, Either in one RAM on in multiple RAMs.
In the single RAM case, data is typically at one end of the memory and fills upwards, program is at the other end, and fills downward,
Thus you can trade off program space for data space. But the processor can only access program or data at any one time,

In the dual ram space case, program is in one area, data in the other, if you fill up the program area, even if the data area is empty , you are full. Also the processor can access both data and program at the same time.

It all depends on the needs,
If you are doing DSP, then data and program access at same time can be fast,
If you running WORD, then the extra complexity of dual ram access is not worth it.
So drives (secondary storage) is not program storage? But as you said, when you run a program on a PC it is normally on the hard drive (secondary)? I think i am confused by all the definitions. Program is a set of instructions intended to perform 1 or more things, secondary memory can store programs yes? I understand that it does not run directly from secondary, but needs to be accessed trough ram.
 

Thread Starter

ZimmerJ

Joined Dec 9, 2020
48
Typically code actually runs in registers, a CPU memory cell vs RAM memory cell. Registers, Cache, RAM. Registers and RAM are both memory but they are accessed in different ways. Each register is directly addressed in the op code for operations more complex than just memory storage
Some architectures extend registers into fast localized RAM but this always places limits on those registers compared to registers native to the ALU.
http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/01/intro-computer2.html

View attachment 229471

View attachment 229472
Alright, i like that, with the graphic explanation as well.
 

andrewmm

Joined Feb 25, 2011
1,467
I see, but Harvard architecture also implies that they are physically separated, right? That's why the program and data can share the same bus in Von Neumann architecture, because it uses the same memory?
Nope, it purely implies that there are two storage areas that are fixed and can be accessed at same time, Dual port rams fill tat requirment.
 

andrewmm

Joined Feb 25, 2011
1,467
So drives (secondary storage) is not program storage? But as you said, when you run a program on a PC it is normally on the hard drive (secondary)? I think i am confused by all the definitions. Program is a set of instructions intended to perform 1 or more things, secondary memory can store programs yes? I understand that it does not run directly from secondary, but needs to be accessed trough ram.
A drive, if it stores a picture , or if it stroes an executable , it does not care
A drive is what's called storage and you do not run programs form the drive ( normally )
The reason is the rams are 1000 times faster than drives , so if run from a drive the program slows down.
 

djsfantasi

Joined Apr 11, 2010
7,689
At the lowest level, there is no difference between programs and data. They are both a collection of values (numbers) representing different concepts. Programs have values that represent instructions. The same values could represent data. Data has values that contains representations of static data, like constants, images or maps. Or variable data, like variables. But at the lowest level, they are both a collection of values.

RAM is memory that can easily and quickly be modified. ROM is used for static values, such as programs (bootloaders or BIOs) and static data (character maps, for example). Secondary storage is used for long term storage of programs. It’s limited to slow, sequential access. Which is why programs are copied from secondary storage into RAM before executing. But all three, ROM, RAM and secondary storage, are used to hold collections of values. Just for different purposes.
 

nsaspook

Joined Aug 27, 2009
8,382
http://ithare.com/modified-harvard-architecture-clarifying-confusion/

Most microcontrollers use a “Modified Harvard” architecture.
For a typical 8-bit PIC the Harvard system is hidden by XC8 and is abstracted to the von Neumann Architecture C expects by a clever compiler but those that have used the old C18 version of C know there is a difference (different versions of libraries for flash data and ram) between RAM and FLASH addressing in the hardware.
 

Thread Starter

ZimmerJ

Joined Dec 9, 2020
48
At the lowest level, there is no difference between programs and data. They are both a collection of values (numbers) representing different concepts. Programs have values that represent instructions. The same values could represent data. Data has values that contains representations of static data, like constants, images or maps. Or variable data, like variables. But at the lowest level, they are both a collection of values.

RAM is memory that can easily and quickly be modified. ROM is used for static values, such as programs (bootloaders or BIOs) and static data (character maps, for example). Secondary storage is used for long term storage of programs. It’s limited to slow, sequential access. Which is why programs are copied from secondary storage into RAM before executing. But all three, ROM, RAM and secondary storage, are used to hold collections of values. Just for different purposes.
Aha, that cleared up alot. Thanks
 
Top