Important Questions and Answers on Computer Organization and Embedded Systems – Part 1

 

 1. Operation of  a computer.

Ans:

The operation of a computer can be summarized as follows:

• The computer accepts information in the form of programs and data through an input

unit and stores it in the memory.

• Information stored in the memory is fetched under program control into an arithmetic

and logic unit, where it is processed.

• Processed information leaves the computer through an output unit.

• All activities in the computer are directed by the control unit



2. Risc and Cisc

Ans:

Reduced Instruction Set Architecture (RISC)

The main idea behind this is to simplify hardware by using an instruction set composed of a few basic steps for loading, evaluating, and storing operations just like a load command will load data, a store command will store the data.

Characteristics of RISC

  • Simpler instruction, hence simple instruction decoding.
  • Instruction comes undersize of one word.
  • Instruction takes a single clock cycle to get executed.
  • More general-purpose registers.
  • Simple Addressing Modes.
  • Fewer Data types.
  • A pipeline can be achieved.
Complex Instruction Set Architecture (CISC)

The main idea is that a single instruction will do all loading, evaluating, and storing operations just like a multiplication command will do stuff like loading data, evaluating, and storing it, hence it's complex.

Characteristics of CISC

  • Complex instruction, hence complex instruction decoding.
  • Instructions are larger than one-word size.
  • Instruction may take more than a single clock cycle to get executed.
  • Less number of general-purpose registers as operations get performed in memory itself.
  • Complex Addressing Modes.
  • More Data types.
source:(https://www.geeksforgeeks.org/computer-organization-architecture/computer-organization-risc-and-cisc/)


3. Addressing mode:

Ans:

Register mode: The operand is the contents of a processor register; the name of the register
is given in the instruction.
Example:
                Add R4, R2, R3

Absolute mode: The operand is in a memory location; the address of this location is given
explicitly in the instruction.
Example:
                Load R2, NUM1
Immediate mode: The operand is given explicitly in the instruction.
 Example:
            Add R4, R6, 200immediate

4. Part of assembly language:

Model
The model defines the memory layout of the program. It tells the assembler how the program will use memory

Stack
The stack segment is used for temporary storage during program execution.

Data
The data segment stores initialized variables

Code
The code segment contains the actual instructions of the program.


5. Instruction difination with example

Ans:

Load
Loads (copies) data from memory into a register.
Example: load R2, N

Clear
Sets the contents of a register or memory to zero.
Example: Clear R3

Move
Transfers data from one location to another (register to register, memory to register, etc.).
Example:Move R4, #NUM

Add
Performs addition between two values and stores the result in a register.
Example:Add R3, R3, R5

Subtract
Performs subtraction between two values and stores the result in a register.
Example:Subtract R2, R2, R5

Store
Stores (copies) data from a register into a memory location.
Example:Store R3, SUM

6. Programs:

  • add:

.model small
.stack 100h
.data 
a db 6
b db 2 
.code
main proc
    mov ax,@data
    mov ds,ax
    
    ;add part
    mov al,a 
    add al,b  
    
  
    add al,'0'
     
    mov ah,2
    mov dl,al
    int 21h
    
    exit:
    mov ah,4ch
    int 21h
    main endp
end main


  • sub:

.model small
.stack 100h
.data 
a db 6
b db 2 
.code
main proc
    mov ax,@data
    mov ds,ax
    

    mov al,a 
    sub al,b  
    

    add al,'0'
     
    mov ah,2
    mov dl,al
    int 21h
    
    exit:
    mov ah,4ch
    int 21h
    main endp
end main


  • loop:(sum of series)

.model small
.stack 100h
.data
msg db 'sum of 1+3+5=$'
.code
main proc
    mov ax,@data 
    mov ds,ax  
    
    mov cx,3 
    mov al,1 
    mov bl,0 
    
    ;start loop
    sum_loop:
    add bl,al     
    add al,2      
    loop sum_loop   
    

    mov ah,9
    lea dx,msg
    int 21h
    
    

    mov ah,2
    add bl,48 
    mov dl,bl
    int 21h
    
    
    exit:
    mov ah,4ch
    int 21h
    main endp
end main
    
    
    
    
    







No comments

Theme images by hdoddema. Powered by Blogger.