Re: [理工] [計組] 指令個數
※ 引述《juan19283746 (小阮)》之銘言:
: A given computer has 16bit instruction. Operand address are specified
: using 6bit field. There are 13 two-operand instructiond and 13
: zero-operand instructions required. What is the maximum number of one-operand
: instruction the can be provided in this computer ?
: (A)192 (B)191 (C)64 (D)63
: 答案給B
: 我的解法...
: (2^4-13)*6^2-13 = 95
: 想請問這題正確的解法 謝謝
就假設operand都在16個bits的最後面,
two-operand instruction需要12個bits決定operand,所以指令數最多2^(16-12) = 16個
用掉13個,所以前4個bits剩下三種組合可以識別指令(instructions)。
接下來考慮後12個bits,
one-operand instruction需要6個bits決定operand,所以指令數最多2^(12-6) = 64個。
加上前面4個bits剩下的三種組合後為64 * 3 = 192。
但是前10個bits要留一個組合識別zero-operand instructions,
只要留一個是因為沒有operand所以最後6個bit總共可以識別2^6 > 13個。
所以答案為 192 - 1 == 191。
希望這樣講夠清楚@@
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.67.37.229
※ 編輯: jigfopsda 來自: 203.67.37.229 (09/21 23:13)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):