What is meant by instruction cycle and clock cycle ?

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
hello ,
I need some help , I am confused on some terms.
1. The instruction time ?
2. instruction cycle ?
3. clock cycle ?


instruction cycle
fetch-and-execute cycle, fetch-decode-execute cycle
8051 runs on 12MHz

What is meant by instruction cycle and clock cycle ?
How is the 'clock cycle' of 8051 MCU related to the 'crystal' oscillator ?
 

sevenfold4

Joined Jan 12, 2015
80
hello ,
I need some help , I am confused on some terms.
1. The instruction time ?
2. instruction cycle ?
3. clock cycle ?


instruction cycle
fetch-and-execute cycle, fetch-decode-execute cycle
8051 runs on 12MHz

What is meant by instruction cycle and clock cycle ?
How is the 'clock cycle' of 8051 MCU related to the 'crystal' oscillator ?
The clock cycle is the period of the clock that you're feeding the to the micro (e.g. , a clock cycle takes 1us if the oscillator's frequency is 1MHz). The instruction cycle depends on the internal structure of the microcontroller or processor you use. E.g. , for a PIC an instruction cycle takes 4 clock cycles, for an 8051 it takes 12 cycles. This is because an instruction has multiple stages, like fetch, decode, execute and writeback.

http://www.8051projects.net/plugins/forum/forum_viewtopic.php?41545.0#post_41554

This page shows how Timer values are calculated, maybe it will serve you as an example.
 
Last edited:

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
The clock cycle is the period of the clock that you're feeding the to the micro (e.g. , a clock cycle takes 1us if the oscillator's frequency is 1MHz). The instruction cycle depends on the internal structure of the microcontroller or processor you use. E.g. , for a PIC an instruction cycle takes 4 clock cycles, for an 8051 it takes 12 cycles. This is because an instruction has multiple stages, like fetch, decode, execute and writeback.

http://www.8051projects.net/plugins/forum/forum_viewtopic.php?41545.0#post_41554

This page shows how Timer values are calculated, maybe it will serve you as an example.
I am explaining with your example.
Example: a clock cycle takes 1us if the oscillator's frequency is 1MHz
fetch-and-execute cycle,
explanations: 1 us for fetch cycle and 1 us for execute cycle. that means it take 2 us
fetch-decode-execute cycle
explanations: it take 3 us.
 

sevenfold4

Joined Jan 12, 2015
80
Your wording is weird
Anyways
1 Clock period = 1/frequency of the oscillator
1 Machine cycle = 12 oscillator periods (In case of 8051, because of the inner structure)
1 Instruction cycle = 1-4 machine cycles (Depending on the instruction given for 8051)
So if 1 machine cycle would calculate to 1us, then 1 instruction would take 1us (Depending on the instruction)
I think... In the past i just did the calculations and never really had to go too deep into it.
Correct me if i am wrong
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
Your wording is weird
Anyways
1 Clock period = 1/frequency of the oscillator
1 Machine cycle = 12 oscillator periods (In case of 8051, because of the inner structure)
1 Instruction cycle = 1-4 machine cycles (Depending on the instruction given for 8051)
So if 1 machine cycle would calculate to 1us, then 1 instruction would take 1us (Depending on the instruction)
I think... In the past i just did the calculations and never really had to go too deep into it.
Correct me if i am wrong
actually I don't understand what do you mean, still I am confused on following terms.
1. The instruction time ?
2. instruction cycle ?
3. clock cycle ?
 

sevenfold4

Joined Jan 12, 2015
80
actually I don't understand what do you mean, still I am confused on following terms.
1. The instruction time ?
2. instruction cycle ?
3. clock cycle ?
1. I guess that would be the time it takes to run 1 cycle?
2. Is the time to run the instructions.
3. Is the speed of the clock depending of the crystal and structure of your mcu
 
Top