Does a microcontroller fetch instructions in blocks?

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question









New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Possible duplicate of Are AVR multi-cycle instructions pipelined?
    – Tony EE rocketscientist
    2 hours ago














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.










share|improve this question









New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Possible duplicate of Are AVR multi-cycle instructions pipelined?
    – Tony EE rocketscientist
    2 hours ago












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.










share|improve this question









New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 hour ago





















New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









Eloy

63




63




New contributor




Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Eloy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • 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




Possible duplicate of Are AVR multi-cycle instructions pipelined?
– Tony EE rocketscientist
2 hours ago










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.






share|improve this answer





























    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.






    share|improve this answer





























      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.






      share|improve this answer




















        Your Answer




        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("schematics", function ()
        StackExchange.schematics.init();
        );
        , "cicuitlab");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "135"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        Eloy is a new contributor. Be nice, and check out our Code of Conduct.









         

        draft saved


        draft discarded


















        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






























        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.






        share|improve this answer


























          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.






          share|improve this answer
























            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.






            share|improve this answer














            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.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 46 mins ago

























            answered 1 hour ago









            alex.forencich

            31.4k14682




            31.4k14682






















                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.






                share|improve this answer


























                  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.






                  share|improve this answer
























                    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.






                    share|improve this answer














                    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.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 11 mins ago

























                    answered 30 mins ago









                    ajb

                    1,167411




                    1,167411




















                        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.






                        share|improve this answer
























                          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.






                          share|improve this answer






















                            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.






                            share|improve this answer












                            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.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 31 mins ago









                            Dirk Bruere

                            4,99622553




                            4,99622553




















                                Eloy is a new contributor. Be nice, and check out our Code of Conduct.









                                 

                                draft saved


                                draft discarded


















                                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.













                                 


                                draft saved


                                draft discarded














                                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













































































                                Comments

                                Popular posts from this blog

                                Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                What does second last employer means? [closed]

                                One-line joke