Does a microcontroller fetch instructions in blocks?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
It seems that the flash memory on most microcontrollers that stores the assembly code is NAND flash, which is only accessible on a per-block basis. Does the CPU has to fetch an entire block to execute the code, or am I mistaken and is it made of NOR flash that is byte accessible?
The datasheet of the ATmega 186 says the following:
This is the basic pipelining concept to obtain up to 1 MIPS
per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per
power-unit.
The datasheet is not very clear what the technology is behind this "flash", but is seems to be different from the EEPROM that is used for the data, that has 10 times as many write cycles.
Edit: the possible suggested duplicate question and answers are about pipelining, not about the storage technology.
microcontroller eeprom
New contributor
add a comment |Â
up vote
1
down vote
favorite
It seems that the flash memory on most microcontrollers that stores the assembly code is NAND flash, which is only accessible on a per-block basis. Does the CPU has to fetch an entire block to execute the code, or am I mistaken and is it made of NOR flash that is byte accessible?
The datasheet of the ATmega 186 says the following:
This is the basic pipelining concept to obtain up to 1 MIPS
per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per
power-unit.
The datasheet is not very clear what the technology is behind this "flash", but is seems to be different from the EEPROM that is used for the data, that has 10 times as many write cycles.
Edit: the possible suggested duplicate question and answers are about pipelining, not about the storage technology.
microcontroller eeprom
New contributor
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
It seems that the flash memory on most microcontrollers that stores the assembly code is NAND flash, which is only accessible on a per-block basis. Does the CPU has to fetch an entire block to execute the code, or am I mistaken and is it made of NOR flash that is byte accessible?
The datasheet of the ATmega 186 says the following:
This is the basic pipelining concept to obtain up to 1 MIPS
per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per
power-unit.
The datasheet is not very clear what the technology is behind this "flash", but is seems to be different from the EEPROM that is used for the data, that has 10 times as many write cycles.
Edit: the possible suggested duplicate question and answers are about pipelining, not about the storage technology.
microcontroller eeprom
New contributor
It seems that the flash memory on most microcontrollers that stores the assembly code is NAND flash, which is only accessible on a per-block basis. Does the CPU has to fetch an entire block to execute the code, or am I mistaken and is it made of NOR flash that is byte accessible?
The datasheet of the ATmega 186 says the following:
This is the basic pipelining concept to obtain up to 1 MIPS
per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per
power-unit.
The datasheet is not very clear what the technology is behind this "flash", but is seems to be different from the EEPROM that is used for the data, that has 10 times as many write cycles.
Edit: the possible suggested duplicate question and answers are about pipelining, not about the storage technology.
microcontroller eeprom
microcontroller eeprom
New contributor
New contributor
edited 1 hour ago
New contributor
asked 3 hours ago
Eloy
63
63
New contributor
New contributor
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago
add a comment |Â
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
2
down vote
Most microcontrollers actually use NOR flash, not NAND flash. And usually you can read whatever you like, it's usually only write and erase operations that are page-based. Unless you're using NAND flash that uses encoding/whitening, FEC, wear leveling, etc. In that case, the controller will do all that processing on a block or page basis.
add a comment |Â
up vote
1
down vote
No and Yes.
No, because as alex.forencich points out most MCUs use NOR flash. This greatly simplifies MCU architectures, as it allows them to fetch and begin executing a single instruction at a time. This is almost certainly how 8-bit AVRs, and PICs, and so on operate.
Yes, because some architectures use wider buses on their flash interfaces, pre-fetch, and/or multiple-issue to help overcome the latency of the underlying memory and improve overall performance. For instance, STM32F7 parts (Cortex M7) have a 128/256 bit bus between the flash controller and the underlying memory, and then a 64-bit AHB between the core and the flash controller. This means the flash controller retrieves four or eight instructions at a time, and the core can retrieve two instructions from the flash controller simultaneously. In this case, the core wants two instructions every cycle because it is uses a dual-issue pipeline, meaning that it can fetch and decode both instructions simultaneously, and in many cases dispatch both instructions to different processing units for simultaneous execution.
The flash controller may also pre-fetch additional instructions that the core has not yet requested, again to reduce the impact of flash latency. How far ahead the controller will pre-fetch, and whether it uses additional caching or other strategies where instructions are fetched in batches is highly architecture dependent.
add a comment |Â
up vote
0
down vote
In most microcontrollers there is typically very little that is written to flash in normal operation. It just holds the code. In some types of MCU if you want a faster execution then the user boots from flash into RAM and runs from there.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Most microcontrollers actually use NOR flash, not NAND flash. And usually you can read whatever you like, it's usually only write and erase operations that are page-based. Unless you're using NAND flash that uses encoding/whitening, FEC, wear leveling, etc. In that case, the controller will do all that processing on a block or page basis.
add a comment |Â
up vote
2
down vote
Most microcontrollers actually use NOR flash, not NAND flash. And usually you can read whatever you like, it's usually only write and erase operations that are page-based. Unless you're using NAND flash that uses encoding/whitening, FEC, wear leveling, etc. In that case, the controller will do all that processing on a block or page basis.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Most microcontrollers actually use NOR flash, not NAND flash. And usually you can read whatever you like, it's usually only write and erase operations that are page-based. Unless you're using NAND flash that uses encoding/whitening, FEC, wear leveling, etc. In that case, the controller will do all that processing on a block or page basis.
Most microcontrollers actually use NOR flash, not NAND flash. And usually you can read whatever you like, it's usually only write and erase operations that are page-based. Unless you're using NAND flash that uses encoding/whitening, FEC, wear leveling, etc. In that case, the controller will do all that processing on a block or page basis.
edited 46 mins ago
answered 1 hour ago
alex.forencich
31.4k14682
31.4k14682
add a comment |Â
add a comment |Â
up vote
1
down vote
No and Yes.
No, because as alex.forencich points out most MCUs use NOR flash. This greatly simplifies MCU architectures, as it allows them to fetch and begin executing a single instruction at a time. This is almost certainly how 8-bit AVRs, and PICs, and so on operate.
Yes, because some architectures use wider buses on their flash interfaces, pre-fetch, and/or multiple-issue to help overcome the latency of the underlying memory and improve overall performance. For instance, STM32F7 parts (Cortex M7) have a 128/256 bit bus between the flash controller and the underlying memory, and then a 64-bit AHB between the core and the flash controller. This means the flash controller retrieves four or eight instructions at a time, and the core can retrieve two instructions from the flash controller simultaneously. In this case, the core wants two instructions every cycle because it is uses a dual-issue pipeline, meaning that it can fetch and decode both instructions simultaneously, and in many cases dispatch both instructions to different processing units for simultaneous execution.
The flash controller may also pre-fetch additional instructions that the core has not yet requested, again to reduce the impact of flash latency. How far ahead the controller will pre-fetch, and whether it uses additional caching or other strategies where instructions are fetched in batches is highly architecture dependent.
add a comment |Â
up vote
1
down vote
No and Yes.
No, because as alex.forencich points out most MCUs use NOR flash. This greatly simplifies MCU architectures, as it allows them to fetch and begin executing a single instruction at a time. This is almost certainly how 8-bit AVRs, and PICs, and so on operate.
Yes, because some architectures use wider buses on their flash interfaces, pre-fetch, and/or multiple-issue to help overcome the latency of the underlying memory and improve overall performance. For instance, STM32F7 parts (Cortex M7) have a 128/256 bit bus between the flash controller and the underlying memory, and then a 64-bit AHB between the core and the flash controller. This means the flash controller retrieves four or eight instructions at a time, and the core can retrieve two instructions from the flash controller simultaneously. In this case, the core wants two instructions every cycle because it is uses a dual-issue pipeline, meaning that it can fetch and decode both instructions simultaneously, and in many cases dispatch both instructions to different processing units for simultaneous execution.
The flash controller may also pre-fetch additional instructions that the core has not yet requested, again to reduce the impact of flash latency. How far ahead the controller will pre-fetch, and whether it uses additional caching or other strategies where instructions are fetched in batches is highly architecture dependent.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
No and Yes.
No, because as alex.forencich points out most MCUs use NOR flash. This greatly simplifies MCU architectures, as it allows them to fetch and begin executing a single instruction at a time. This is almost certainly how 8-bit AVRs, and PICs, and so on operate.
Yes, because some architectures use wider buses on their flash interfaces, pre-fetch, and/or multiple-issue to help overcome the latency of the underlying memory and improve overall performance. For instance, STM32F7 parts (Cortex M7) have a 128/256 bit bus between the flash controller and the underlying memory, and then a 64-bit AHB between the core and the flash controller. This means the flash controller retrieves four or eight instructions at a time, and the core can retrieve two instructions from the flash controller simultaneously. In this case, the core wants two instructions every cycle because it is uses a dual-issue pipeline, meaning that it can fetch and decode both instructions simultaneously, and in many cases dispatch both instructions to different processing units for simultaneous execution.
The flash controller may also pre-fetch additional instructions that the core has not yet requested, again to reduce the impact of flash latency. How far ahead the controller will pre-fetch, and whether it uses additional caching or other strategies where instructions are fetched in batches is highly architecture dependent.
No and Yes.
No, because as alex.forencich points out most MCUs use NOR flash. This greatly simplifies MCU architectures, as it allows them to fetch and begin executing a single instruction at a time. This is almost certainly how 8-bit AVRs, and PICs, and so on operate.
Yes, because some architectures use wider buses on their flash interfaces, pre-fetch, and/or multiple-issue to help overcome the latency of the underlying memory and improve overall performance. For instance, STM32F7 parts (Cortex M7) have a 128/256 bit bus between the flash controller and the underlying memory, and then a 64-bit AHB between the core and the flash controller. This means the flash controller retrieves four or eight instructions at a time, and the core can retrieve two instructions from the flash controller simultaneously. In this case, the core wants two instructions every cycle because it is uses a dual-issue pipeline, meaning that it can fetch and decode both instructions simultaneously, and in many cases dispatch both instructions to different processing units for simultaneous execution.
The flash controller may also pre-fetch additional instructions that the core has not yet requested, again to reduce the impact of flash latency. How far ahead the controller will pre-fetch, and whether it uses additional caching or other strategies where instructions are fetched in batches is highly architecture dependent.
edited 11 mins ago
answered 30 mins ago
ajb
1,167411
1,167411
add a comment |Â
add a comment |Â
up vote
0
down vote
In most microcontrollers there is typically very little that is written to flash in normal operation. It just holds the code. In some types of MCU if you want a faster execution then the user boots from flash into RAM and runs from there.
add a comment |Â
up vote
0
down vote
In most microcontrollers there is typically very little that is written to flash in normal operation. It just holds the code. In some types of MCU if you want a faster execution then the user boots from flash into RAM and runs from there.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
In most microcontrollers there is typically very little that is written to flash in normal operation. It just holds the code. In some types of MCU if you want a faster execution then the user boots from flash into RAM and runs from there.
In most microcontrollers there is typically very little that is written to flash in normal operation. It just holds the code. In some types of MCU if you want a faster execution then the user boots from flash into RAM and runs from there.
answered 31 mins ago
Dirk Bruere
4,99622553
4,99622553
add a comment |Â
add a comment |Â
Eloy is a new contributor. Be nice, and check out our Code of Conduct.
Eloy is a new contributor. Be nice, and check out our Code of Conduct.
Eloy is a new contributor. Be nice, and check out our Code of Conduct.
Eloy is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f397429%2fdoes-a-microcontroller-fetch-instructions-in-blocks%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Possible duplicate of Are AVR multi-cycle instructions pipelined?
â Tony EE rocketscientist
2 hours ago