Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronic Content > Electronic Theory

Electronic Theory Basic principles, ideas, concepts, laws, and formulas behind electronics.

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st March 2007, 12:19 AM
Experienced Member
ArtemisGoldfish is on a distinguished road
 
Send a message via AIM to ArtemisGoldfish Send a message via MSN to ArtemisGoldfish

Default Processor begins...?

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.
ArtemisGoldfish is offline   Reply With Quote
Old 21st March 2007, 02:09 AM
3v0
Moderator
3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all
 
Default

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 is online now   Reply With Quote
Old 21st March 2007, 03:09 AM
Experienced Member
ArtemisGoldfish is on a distinguished road
 
Send a message via AIM to ArtemisGoldfish Send a message via MSN to ArtemisGoldfish
Default

Quote:
Originally Posted by 3v0
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 is offline   Reply With Quote
Old 21st March 2007, 03:15 AM
Experienced Member
Leftyretro has a spectacular aura about
 
 
Default

Quote:
Originally Posted by ArtemisGoldfish
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 is offline   Reply With Quote
Old 21st March 2007, 05:22 PM
Experienced Member
ArtemisGoldfish is on a distinguished road
 
Send a message via AIM to ArtemisGoldfish Send a message via MSN to ArtemisGoldfish
Default

Quote:
Originally Posted by Leftyretro
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?
ArtemisGoldfish is offline   Reply With Quote
Old 21st March 2007, 05:39 PM
Experienced Member
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
 
 
Default

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 by ericgibbs : 21st March 2007 at 05:46 PM.
ericgibbs is online now   Reply With Quote
Old 21st March 2007, 05:41 PM
Experienced Member
ArtemisGoldfish is on a distinguished road
 
Send a message via AIM to ArtemisGoldfish Send a message via MSN to ArtemisGoldfish
Default

Quote:
Originally Posted by ericgibbs
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?
ArtemisGoldfish is offline   Reply With Quote
Old 21st March 2007, 05:54 PM
Experienced Member
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
 
 
Default

hi artemis,

I thought I was answering your last post?.

Like to help.

Can you rephrase and repost so I can play catchup.

Eric
ericgibbs is online now   Reply With Quote
Old 21st March 2007, 06:09 PM
3v0
Moderator
3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all
 
Default

Quote:
Originally Posted by ArtemisGoldfish
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 ?
3v0 is online now   Reply With Quote
Old 21st March 2007, 08:39 PM
Experienced Member
Cabwood will become famous soon enough
 
Default

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.
Cabwood is offline   Reply With Quote
Old 23rd March 2007, 03:21 AM
Experienced Member
ArtemisGoldfish is on a distinguished road
 
Send a message via AIM to ArtemisGoldfish Send a message via MSN to ArtemisGoldfish
Default

Quote:
Originally Posted by 3v0
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.
ArtemisGoldfish is offline   Reply With Quote
Old 23rd March 2007, 04:07 AM
Experienced Member
kchriste is a glorious beacon of lightkchriste is a glorious beacon of lightkchriste is a glorious beacon of lightkchriste is a glorious beacon of light
 
Default

A primer on Z80 assembly:
http://users.hszk.bme.hu/~pg429/z80guide/
After reading that, you may want to tackle building some hardware:
http://www.z80.info/homebrew.htm
Then again, maybe not.....
__________________
--- The days of the digital watch are numbered. ---
kchriste is offline   Reply With Quote
Old 23rd March 2007, 03:00 PM
Experienced Member
Cabwood will become famous soon enough
 
Default

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.
Cabwood is offline   Reply With Quote
Old 23rd March 2007, 03:28 PM
3v0
Moderator
3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all3v0 is a name known to all
 
Default

Quote:
Originally Posted by ArtemisGoldfish
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 is online now   Reply With Quote
Old 23rd March 2007, 03:54 PM
Super Moderator
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
 
 
Default

Quote:
Originally Posted by 3v0
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).
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


All times are GMT. The time now is 11:52 AM.




Electronic Circuits  |  Radio Controlled
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0