Fetching and executing instruction?

  • Thread starter Thread starter vead
  • Start date Start date
  • Tags Tags
    Instruction
Click For Summary
SUMMARY

The discussion centers on the instruction fetch-decode-execute cycle in microcontrollers, specifically addressing the source of instructions stored in various memory types such as ROM, RAM, and FLASH. It clarifies that instructions are fetched from ROM, decoded, and executed using data from RAM. The example provided illustrates how assembly code is converted into hexadecimal instructions stored in ROM, which are then fetched and executed sequentially by the CPU. The role of the program counter and the accumulator register in this process is also highlighted.

PREREQUISITES
  • Understanding of microcontroller architecture
  • Familiarity with assembly language programming
  • Knowledge of memory types: ROM, RAM, and FLASH
  • Basic concepts of CPU instruction cycles
NEXT STEPS
  • Research the instruction cycle of microcontrollers in detail
  • Learn about the role of the program counter in CPU operations
  • Study assembly language syntax and its conversion to machine code
  • Explore the differences between various memory types used in microcontrollers
USEFUL FOR

Electronics engineers, embedded systems developers, students studying microcontroller architecture, and anyone interested in understanding the instruction execution process in microcontrollers.

vead
Messages
92
Reaction score
0
Instruction should be fetch , decode and execute.
''Instruction fetch from memory''
I have read this statement many times but don't know which memory ROM or RAM memory ?
 
Physics news on Phys.org
vead said:
Instruction should be fetch , decode and execute.
''Instruction fetch from memory''
I have read this statement many times but don't know which memory ROM or RAM memory ?

The actual program instruction could be stored on ROM, RAM, FLASH or ten other types of internal or external memory. Depending on the processor and system architecture the instruction might have moved thru several times before actual CPU execution in the processor SRAM cache or internal SRAM memory registers.

Take a look at a typical microcode processor instruction cycle: https://www.cs.umd.edu/class/fall2001/cmsc411/projects/DLX/proj.html
 
Hello everyone I want understand how does microcontroller work so I have done some homework

Instruction should be fetch, decode and execute
assembly code
Mov A, #2
Mov R1, #3
Add A, R1

lets say program convert into hexa code

8000 0101 1st Instruction
8001 1o01 2nd instruction
8002 0101 3rd Instruction

this hex code stored into rom memory
address data
8000 0101
8001 1o01
8002 0101

location of data stored into RAM
location
8000
8001
8002

ok now we want to fetch 1st instruction

we now about accumulator register , decoder
Instruction 1st is 8000 0101 fetch from rom memory, decoder take the information and it will store the value in A register, processor send the request in Ram memory and it look location 8000 for data 0101

program counter execute instruction one by one
now 2nd instruction 8001 1001 fetch from rom memory decoder take instruction and it will store value into register R1 processor send request in ram memory and ram memory look location 8001 for data 1001

3rd instruction fetch from rom memory decoder decode instruction and tell the alu for addition
alu do addition and result will save in ram memory

In my above paragraph I think there are many wrong statement so please check out me and correct me
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
25
Views
10K
  • · Replies 2 ·
Replies
2
Views
3K