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

Clash Royale CLAN TAG#URR8PPP
$begingroup$
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
$endgroup$
add a comment |
$begingroup$
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
$endgroup$
4
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
1
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23
add a comment |
$begingroup$
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
$endgroup$
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
microcontroller pic memory
asked Jan 7 at 2:47
HesiHesi
83
83
4
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
1
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23
add a comment |
4
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
1
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23
4
4
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
1
1
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
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 immediate 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.
$endgroup$
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
add a comment |
$begingroup$
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.
$endgroup$
add a comment |
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
);
);
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
Required, but never shown
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
$begingroup$
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 immediate 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.
$endgroup$
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
add a comment |
$begingroup$
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 immediate 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.
$endgroup$
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
add a comment |
$begingroup$
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 immediate 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.
$endgroup$
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 immediate 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.
edited Jan 7 at 6:00
answered Jan 7 at 2:56
Chris StrattonChris Stratton
22.6k22863
22.6k22863
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
add a comment |
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Did you mean "immediate operands"?
$endgroup$
– chrylis
Jan 7 at 5:53
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
$begingroup$
Yes, thank you. Fixed it.
$endgroup$
– Chris Stratton
Jan 7 at 5:59
add a comment |
$begingroup$
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.
$endgroup$
add a comment |
$begingroup$
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.
$endgroup$
add a comment |
$begingroup$
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.
$endgroup$
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.
answered Jan 7 at 2:56
Elliot AldersonElliot Alderson
5,74411018
5,74411018
add a comment |
add a comment |
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.
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
Required, but never shown
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
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
Required, but never shown
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
Required, but never shown
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
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
4
$begingroup$
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
$endgroup$
– Dave Tweed♦
Jan 7 at 2:56
$begingroup$
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.
$endgroup$
– Elliot Alderson
Jan 7 at 2:59
1
$begingroup$
I guess it's this datasheet: microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/… It does actually contain the 37768 figure (page 64, section 5.1), so technically the quote here is correct. It's obviously a typo, though, there's the correct number in table 1 on page 2.
$endgroup$
– ilkkachu
Jan 7 at 6:23