What does the number of “ single-word instructions ” mean on a MCU's memory specifications?
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
New contributor
add a comment |
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
New contributor
1
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 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
3 hours ago
add a comment |
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
New contributor
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
New contributor
New contributor
New contributor
asked 3 hours ago
Hesi
62
62
New contributor
New contributor
1
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 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
3 hours ago
add a comment |
1
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 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
3 hours ago
1
1
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 hours ago
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 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
3 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
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
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.
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
add a comment |
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.
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
});
}
});
Hesi 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
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
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.
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
add a comment |
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.
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
add a comment |
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.
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 12 mins ago
answered 3 hours ago
Chris Stratton
22.5k22863
22.5k22863
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
add a comment |
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
Did you mean "immediate operands"?
– chrylis
18 mins ago
Did you mean "immediate operands"?
– chrylis
18 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
Yes, thank you. Fixed it.
– Chris Stratton
12 mins ago
add a comment |
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.
add a comment |
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.
add a comment |
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.
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 3 hours ago
Elliot Alderson
5,0051918
5,0051918
add a comment |
add a comment |
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.
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.
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
1
First of all, it's 32,768 words, and it's a measure of the memory size, not speed.
– Dave Tweed♦
3 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
3 hours ago