Instruction Encoding [assembly]

In summary, a 1-address computer, such as MARIE, has instructions with only one operand address. The machine details include a word with n bits, k of which are used for opcode and the remaining for memory address(es). With 100 distinct opcodes in the ISA, the minimum values for k and n are 7 and 9 respectively. For part (a), the maximum number of opcodes that can be used is 128. In part (b), assuming a word size that is an integer number of bytes, the minimum value for n is 8 and the largest memory that can be used is 16M words. The largest program requires 128M words of memory to run, with the minimum required bits for
  • #1
twoski
181
2

Homework Statement



A 1-address computer is one whose instruction can contain at most one operand address. MARIE is an example of such a computer. Typically each instruction is stored as a single word in the memory. Assume the following machine details.

(i) A word contains n bits, and k bits (k < n) are used to encode each opcode. The remaining bits are used to specify memory address(es).
(ii) There are 100 distinct opcodes in the ISA.
(iii) The largest program requires 128M words of memory to run.

(a) What is the minimum value of k required? What is the minimum value of n required? Keeping minimum value of k, what is the maximum number of opcodes that can be used?

(b) If the size of each word must be an integer number of bytes, what is the minimum value of n required? What is largest memory that can be used in this computer then?


The Attempt at a Solution



A) The minimum value for k is 7 since the ISA has 100 distinct opcodes. The minimum value for n is 9 since the lowest possible size for instructions is 1 bit (our professor's slides say that possible sizes for instructions are 8,16,32 or 64 and i don't think having 1 bit for the address makes any sense). If k = 7, then the maximum amount of opcodes is 128.

B) I don't get this... It's saying that i can only have 8/16/32/etc bits which i have already assumed. Did i miss something?
 
Physics news on Phys.org
  • #2
twoski said:
(iii) The largest program requires 128M words of memory to run.
Does this mean 128,000 or 128,000,000 words or 128*1024 or 128*1024*1024 words?

twoski said:
(a)What is the minimum value of n required?
This part of a is not restricting the word size to be a multiple of 8 bits.
 
  • #3
The assignment just says 128M, i was hoping someone here would be able to hazard a guess as to what that means. It's ambiguous so maybe i'll email the professor about it.

If the minimum bits for k is 7 (since 128 is the closest to 100 without being lower than 100) then the minimum size for n would be 1 which makes the minimum amount of total bits 8. Although i don't know how smart this would be since having 1 bit for addresses would be absurd - is there a specific limit on how small addresses can be?
 
  • #4
twoski said:
the minimum size for n would be 1
The minimum size for n is the the number of bits required to address 128M words, except I don't know that M stands for in this case, but mostly likely it's 1024*1024 = 1048576 (asssuming that small m would mean 1,000,000).
 
Last edited:
  • #5
Well in similar questions he uses "128 Mbits" so maybe it was just a typo and he meant 128 Mbits instead of 128M words?

So if the total words is size m, the minimum size would be n where n^2 = m, right?
 
  • #6
twoski said:
Well in similar questions he uses "128 Mbits" so maybe it was just a typo and he meant 128 Mbits instead of 128M words?
Just assume he mean 128M words.

twoski said:
So if the total words is size m, the minimum size would be n where n^2 = m, right?
Yes, if total bits size is m, then n^2 = m / 8.
 

FAQ: Instruction Encoding [assembly]

What is instruction encoding?

Instruction encoding is the process of converting assembly language instructions into binary code that can be understood and executed by a computer's central processing unit (CPU).

Why is instruction encoding important?

Instruction encoding is important because it allows programmers to write instructions in a human-readable format and then have them translated into machine code that can be executed by the computer. It also allows for a more compact and efficient way of storing and retrieving instructions.

What are the different types of instruction encoding?

There are three main types of instruction encoding: fixed-length encoding, variable-length encoding, and self-modifying encoding. Fixed-length encoding uses a set number of bits for each instruction, while variable-length encoding allows for instructions of different lengths. Self-modifying encoding allows for instructions to be modified or created at runtime.

How does instruction encoding differ between processors?

Instruction encoding can differ between processors based on the architecture and design of the processor. Different processors may have different instruction sets and use different encoding methods. This can affect the speed and efficiency of executing instructions on different processors.

What are some common challenges with instruction encoding?

Some common challenges with instruction encoding include compatibility issues between processors, the need for efficient use of limited memory, and ensuring that instructions are correctly translated and executed by the CPU.

Similar threads

Replies
10
Views
2K
Replies
7
Views
2K
Replies
1
Views
2K
Replies
7
Views
3K
Replies
4
Views
4K
Replies
2
Views
5K
Back
Top