Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Processor begins...?

Status
Not open for further replies.
Alright, I know the thread name is very vague, but...

What exactly causes a CPU, upon initial powering, to start receiving instructions from ROM/RAM/Whatever. I know that when it gets going and has an instruction queue, it can take off and just do it's own thing, but how and where is the first instruction loaded? From the BIOS?

Clarifying this would be great, thanks. :)
 
The CPU is designed to either start fetching/executing instructions from a fixed address, or to load an address from a fixed address and start executing code there.

It is up to the person who designs/programs the system as to what code is at the starting address.

If you have a more specific question I would be happy to provide info.
 
3v0 said:
The CPU is designed to either start fetching/executing instructions from a fixed address, or to load an address from a fixed address and start executing code there.

It is up to the person who designs/programs the system as to what code is at the starting address.

If you have a more specific question I would be happy to provide info.

Alright, another question: Can processors (some, most, any) directly fetch instructions from ROM/RAM, or do they have to be prepared with some logic circuit?
 
ArtemisGoldfish said:
Alright, another question: Can processors (some, most, any) directly fetch instructions from ROM/RAM, or do they have to be prepared with some logic circuit?

Most all fetch their instructions from a ROM/RAM, that is a common feature of any general purpose processor. In reality the processor doesn't know or care what kind of memory is being used when it fetches an instruction, It just places an address onto it's address buss and expects to receive the instructions back on it's data buss, so where the instructions are contained is just a implementation detail for a specific processor.

Lefty
 
Leftyretro said:
Most all fetch their instructions from a ROM/RAM, that is a common feature of any general purpose processor. In reality the processor doesn't know or care what kind of memory is being used when it fetches an instruction, It just places an address onto it's address buss and expects to receive the instructions back on it's data buss, so where the instructions are contained is just a implementation detail for a specific processor.

Lefty

So, in effect, I could take a Parallel EEPROM like this: Datasheet , write the instructions to it in the CPU's set (assuming it's 8-bit also, since the ROM is 8-bits wide) and it'd start executing instructions?
 
hi,
So, in effect, I could take a Parallel EEPROM like this: Datasheet , write the instructions to it in the CPU's set (assuming it's 8-bit also, since the ROM is 8-bits wide) and it'd start executing instructions?

Im afraid not.

The memory only holds the programmed instructions, it dosnt execute them.
The instructions are executed by the CPU.

A simple comparision would be if say someone gave you [the CPU], a list [the program instructions] of things to do.
You would be the one [CPU] executing the instructions on the list.

Is this clearer?

Eric
 
Last edited:
ericgibbs said:
hi,
So, in effect, I could take a Parallel EEPROM like this: Datasheet , write the instructions to it in the CPU's set (assuming it's 8-bit also, since the ROM is 8-bits wide) and it'd start executing instructions?

Im afraid not.

The memory only holds the programmed instructions, it dosnt execute them.
The instructions are executed by the CPU.


Eric

You...missed the rest of the conversation?
 
hi artemis,

I thought I was answering your last post?.

Like to help.

Can you rephrase and repost so I can play catchup.

Eric
 
ArtemisGoldfish said:
So, in effect, I could take a Parallel EEPROM like this: Datasheet , write the instructions to it in the CPU's set (assuming it's 8-bit also, since the ROM is 8-bits wide) and it'd start executing instructions?

Yes, if you mean the CPU starts executing the instructions.

Not sure about the specific device you mentioned. There is a timing issue, put simply the memory needs to have a speed compatible with the processor.

I am curious regarding why you are asking this. You can buy micocontrollers with enough built in flash to do most jobs. Maybe if you let us know where you are going with this we can save a few posts and jump to the end.

Are you interested in knowing how a PC boots ? Or is this confined to microcontrollers ?
 
When the processor is powered up, or reset, the program counter (address register which contains the bits of the binary address of the next-to-be-fetched-and-executed instruction) to some predetermined value. On the first clock cycle following the reset procedure, this address will then be the starting point of the program to be executed on power up or reset.

For some processors this starting address is 0. For others it is different.

For yet others, the power-up reset is a little more complex - the processor can fetch the address of first instruction of the program to execute from a predetermined ROM location and store that in the program counter, and then start execution. This enables the programmer to put the start-up program anywhere in ROM, as long as he stores the binary address of that program's first instruction in the ROM location where the processor expects to find it. This location is called a vector.

Processors use vectors like this to respond to different events, such as power-up, interrupt or reset. Typically the processor expects to find the start addresses of the different program modules in a block of ROM at a fixed, known address. For a power-up the processor might retrieve the address from the first element in this 'vector table' and start execution from that address. For a reset, it might fetch the address from the second element, and so on.

From a practical standpoint, all programs that are to be executed at power-up or reset are stored in ROM or some type of non-volatile directly addressable memory - NOT a hard disk or other form of backing store. Depending on the processor, it will either fetch an address from the vector table part of that ROM and execute from there, or start executing from an already known and fixed address in that ROM. Either way, it's all in ROM.

If the system is to run an operating system (or anything else, really) stored on some backing storage device, such as a USB stick or hard disk drive, it will be the job of the ROM program to copy that external program into RAM, and branch into the first (entry) instruction of that program.

Just for completeness (forgive me if this is superfluous or obvious), the ROM also often contains support subroutines that other programs can call to control and access the various hardware devices connected to the processor. These routines form a large part of the BIOS of PCs. The BIOS is a program in ROM that executes upon start-up and reset, which tests the system, loads the OS into RAM, subsequently relinquishing execution to the instructions of that OS, and provides support functions to the OS for hardware control and access.
 
3v0 said:
Yes, if you mean the CPU starts executing the instructions.

Not sure about the specific device you mentioned. There is a timing issue, put simply the memory needs to have a speed compatible with the processor.

I am curious regarding why you are asking this. You can buy micocontrollers with enough built in flash to do most jobs. Maybe if you let us know where you are going with this we can save a few posts and jump to the end.

Are you interested in knowing how a PC boots ? Or is this confined to microcontrollers ?

Sorry about not really giving any of my intentions. I hope to learn enough to be able to build a simple, old single-board computer, much like the Spectrum Z81 (But without the high price tag and limited availability). I would use microcontrollers, but that really ruins the fun for me, and I'm really into the fun of experimentation.
 
I believe that it should be compulsory in schools that every student build a discrete logic microcomputer. Nothing but 74somethings. Now that's an education.
 
ArtemisGoldfish said:
Sorry about not really giving any of my intentions. I hope to learn enough to be able to build a simple, old single-board computer, much like the Spectrum Z81 (But without the high price tag and limited availability). I would use microcontrollers, but that really ruins the fun for me, and I'm really into the fun of experimentation.

Not a problem. I am an old Z80 fan.

At one time a friend and I built a SBC Z80 that ran forth. It used 2 SCC chips (4 serial channels), other then that most 16F pics would run rings around it.
 
3v0 said:
At one time a friend and I built a SBC Z80 that ran forth. It used 2 SCC chips (4 serial channels), other then that most 16F pics would run rings around it.

For some purposes (probably most?), but the Z80 (or any other micro-processor) has the advantage of much more RAM (or at least you can connect much more RAM).
 
3v0 said:
Not a problem. I am an old Z80 fan.

At one time a friend and I built a SBC Z80 that ran forth. It used 2 SCC chips (4 serial channels), other then that most 16F pics would run rings around it.

I'm rather interested because at a Salvation Army (Goodwill-type store) a year or so ago when I was starting with electronics, I found a Z80 kit with all it's IC's, only missing a few resistors, but I had lots. Unfortunately, I accidentally killed the board with my 25-watt iron (Darn glass-epoxy boards and fragile leads), but I'm interested in building a simple computer now that I know some of the theory. The board I found at Salvo was a 4-chip setup: CPU, RAM, ROM, and Logic.
 
Last edited:
I'm interested in building a simple computer now that I know some of the theory.
Your biggest problem will be getting a ROM programmed with the proper boot code so you can load code into RAM/EEPROM and execute it. There are ROM emulators out there that are ideal for experimenting with building your own simple computer board:
http://elm-chan.org/works/erom/report_e.html
 
Nigel:
I agree.

At some point I recall seeing some Microchip with a memory bus (interface). IIRC it was a surface mount part with lots of pins.

ArtemisGoldfish:
This project is not a simple one.
Are you sure you can not fix the kit you have?
It may be worth finishing for historical reasons depending on what it is.

After you get the basic computer working you may want to look into some of the Zilog Periferal chips like the CTC as SCC. Both were powerful chips in their day.

In regard to kchriste's post. The link is for a ROM emulator with a ROM MONITOR loaded. It would be handy to have.
 
Last edited:
I have an AVR chip that has an external memory bus interface and it's in DIP, microchip must have at least one?
 
Sceadwian said:
I have an AVR chip that has an external memory bus interface and it's in DIP, microchip must have at least one?

They certainly have in the past, if I recall correctly you could configure the pins as either external memory or I/O - no idea if they still make one?, or even what it might have been called?.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top