What does the number of “ single-word instructions ” mean on a MCU's memory specifications?












1














I have copied the following sentence from a PIC MCU datasheet:



"PIC18(L)F26K22, PIC18(L)F46K22: 64 Kbytes of Flash Memory, up to 37,768 single-word instructions."



the question is what does " 37,768 single-word instructions" mean for a memory ?



does it show how fast is the memory or something else ? what's its meaning and how is it calculated ?










share|improve this question







New contributor




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




















  • First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
    – Dave Tweed
    2 hours ago










  • By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
    – Elliot Alderson
    2 hours ago
















1














I have copied the following sentence from a PIC MCU datasheet:



"PIC18(L)F26K22, PIC18(L)F46K22: 64 Kbytes of Flash Memory, up to 37,768 single-word instructions."



the question is what does " 37,768 single-word instructions" mean for a memory ?



does it show how fast is the memory or something else ? what's its meaning and how is it calculated ?










share|improve this question







New contributor




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




















  • First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
    – Dave Tweed
    2 hours ago










  • By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
    – Elliot Alderson
    2 hours ago














1












1








1







I have copied the following sentence from a PIC MCU datasheet:



"PIC18(L)F26K22, PIC18(L)F46K22: 64 Kbytes of Flash Memory, up to 37,768 single-word instructions."



the question is what does " 37,768 single-word instructions" mean for a memory ?



does it show how fast is the memory or something else ? what's its meaning and how is it calculated ?










share|improve this question







New contributor




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











I have copied the following sentence from a PIC MCU datasheet:



"PIC18(L)F26K22, PIC18(L)F46K22: 64 Kbytes of Flash Memory, up to 37,768 single-word instructions."



the question is what does " 37,768 single-word instructions" mean for a memory ?



does it show how fast is the memory or something else ? what's its meaning and how is it calculated ?







microcontroller pic memory






share|improve this question







New contributor




Hesi 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




Hesi 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






New contributor




Hesi 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









Hesi

62




62




New contributor




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





New contributor





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






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












  • First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
    – Dave Tweed
    2 hours ago










  • By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
    – Elliot Alderson
    2 hours ago


















  • First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
    – Dave Tweed
    2 hours ago










  • By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
    – Elliot Alderson
    2 hours ago
















First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed
2 hours ago




First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed
2 hours ago












By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
– Elliot Alderson
2 hours ago




By the way, according to international standard the size of the Flash would correctly be described as 64 kibibytes or 64 KiB. The prefix kibi means 2^10 while kilo means 10^3.
– Elliot Alderson
2 hours ago










2 Answers
2






active

oldest

votes


















2














First, your question contains a typo, you mean 32,768 (2^15) not 37,768.



The PIC in question has a 16-bit instruction word.



The flash memory size is specified as 64K (65536) bytes. With two bytes per word, that is space for 32768 simple instructions.



Many processors, apparently including this one, offer instructions of varying length - more complex instructions may include things like intermediate operands or memory addresses. These take more bits to encode, and so are longer than the "single-word" instructions.



The data sheet is thus giving you a best case. Depending on the compiler or hand coding strategy, actual code might have varying average instruction length, so it is harder to say how many typical instructions could fit in flash. Even if it's possible to write a program using all single-word instructions, on a machine designed to support them it may well be more efficient to use some multi-word ones, especially if that avoids needing to go do another fetch of a constant from data memory.






share|improve this answer





























    0














    I expect that it should be 32,768 single-word instructions. If a "word" is two bytes and the memory has 65,536 bytes then the memory can hold 32,768 such words. It doesn't have anything to do with the speed of the memory.






    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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      Hesi 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%2f415641%2fwhat-does-the-number-of-single-word-instructions-mean-on-a-mcus-memory-spec%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      First, your question contains a typo, you mean 32,768 (2^15) not 37,768.



      The PIC in question has a 16-bit instruction word.



      The flash memory size is specified as 64K (65536) bytes. With two bytes per word, that is space for 32768 simple instructions.



      Many processors, apparently including this one, offer instructions of varying length - more complex instructions may include things like intermediate operands or memory addresses. These take more bits to encode, and so are longer than the "single-word" instructions.



      The data sheet is thus giving you a best case. Depending on the compiler or hand coding strategy, actual code might have varying average instruction length, so it is harder to say how many typical instructions could fit in flash. Even if it's possible to write a program using all single-word instructions, on a machine designed to support them it may well be more efficient to use some multi-word ones, especially if that avoids needing to go do another fetch of a constant from data memory.






      share|improve this answer


























        2














        First, your question contains a typo, you mean 32,768 (2^15) not 37,768.



        The PIC in question has a 16-bit instruction word.



        The flash memory size is specified as 64K (65536) bytes. With two bytes per word, that is space for 32768 simple instructions.



        Many processors, apparently including this one, offer instructions of varying length - more complex instructions may include things like intermediate operands or memory addresses. These take more bits to encode, and so are longer than the "single-word" instructions.



        The data sheet is thus giving you a best case. Depending on the compiler or hand coding strategy, actual code might have varying average instruction length, so it is harder to say how many typical instructions could fit in flash. Even if it's possible to write a program using all single-word instructions, on a machine designed to support them it may well be more efficient to use some multi-word ones, especially if that avoids needing to go do another fetch of a constant from data memory.






        share|improve this answer
























          2












          2








          2






          First, your question contains a typo, you mean 32,768 (2^15) not 37,768.



          The PIC in question has a 16-bit instruction word.



          The flash memory size is specified as 64K (65536) bytes. With two bytes per word, that is space for 32768 simple instructions.



          Many processors, apparently including this one, offer instructions of varying length - more complex instructions may include things like intermediate operands or memory addresses. These take more bits to encode, and so are longer than the "single-word" instructions.



          The data sheet is thus giving you a best case. Depending on the compiler or hand coding strategy, actual code might have varying average instruction length, so it is harder to say how many typical instructions could fit in flash. Even if it's possible to write a program using all single-word instructions, on a machine designed to support them it may well be more efficient to use some multi-word ones, especially if that avoids needing to go do another fetch of a constant from data memory.






          share|improve this answer












          First, your question contains a typo, you mean 32,768 (2^15) not 37,768.



          The PIC in question has a 16-bit instruction word.



          The flash memory size is specified as 64K (65536) bytes. With two bytes per word, that is space for 32768 simple instructions.



          Many processors, apparently including this one, offer instructions of varying length - more complex instructions may include things like intermediate operands or memory addresses. These take more bits to encode, and so are longer than the "single-word" instructions.



          The data sheet is thus giving you a best case. Depending on the compiler or hand coding strategy, actual code might have varying average instruction length, so it is harder to say how many typical instructions could fit in flash. Even if it's possible to write a program using all single-word instructions, on a machine designed to support them it may well be more efficient to use some multi-word ones, especially if that avoids needing to go do another fetch of a constant from data memory.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 hours ago









          Chris Stratton

          22.4k22863




          22.4k22863

























              0














              I expect that it should be 32,768 single-word instructions. If a "word" is two bytes and the memory has 65,536 bytes then the memory can hold 32,768 such words. It doesn't have anything to do with the speed of the memory.






              share|improve this answer


























                0














                I expect that it should be 32,768 single-word instructions. If a "word" is two bytes and the memory has 65,536 bytes then the memory can hold 32,768 such words. It doesn't have anything to do with the speed of the memory.






                share|improve this answer
























                  0












                  0








                  0






                  I expect that it should be 32,768 single-word instructions. If a "word" is two bytes and the memory has 65,536 bytes then the memory can hold 32,768 such words. It doesn't have anything to do with the speed of the memory.






                  share|improve this answer












                  I expect that it should be 32,768 single-word instructions. If a "word" is two bytes and the memory has 65,536 bytes then the memory can hold 32,768 such words. It doesn't have anything to do with the speed of the memory.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 hours ago









                  Elliot Alderson

                  5,0051918




                  5,0051918






















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










                      draft saved

                      draft discarded


















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













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












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
















                      Thanks for contributing an answer to Electrical Engineering Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f415641%2fwhat-does-the-number-of-single-word-instructions-mean-on-a-mcus-memory-spec%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Understanding the information contained in the Deep Space Network XML data?

                      Ross-on-Wye

                      Eastern Orthodox Church