Tuesday, March 21, 2023

UNIT 1 - Basic Structures of Computers (CSVTU, BHILAI: COMPUTER SYSTEM ARCHITECTURE NOTES) :

Branch: CSE/AI/AI&DS/AI&ML

Syllabus : Refer CSVTU website
click here 


UNIT 1 - Basic Structures of Computers:
Syllabus: 

Notes:   (Go through these points before answering the Questions)
👦Prerequisite – 
Systems architecture refers to the structure of the internal components of a computer system. Modern computers often have a von Neumann architecture, which involves: a processor; a memory unit, which stores both instructions and data; connections for input and output devices; and secondary storage for data.


Block Diagram of the computer.


In the 1940s, John von Neumann and his team developed the concept of the stored program computer.
John von Neumann coined and developed this architecture. The computer we are using nowadays is based on the von Neumann architecture. It is also known as Princeton architecture.




Harvard Architecture consists of code and data laid in distinct memory sections. It requires a separate memory block for data and instruction.

In a system or computer, most of the tasks are controlled with the help of a processor or CPU (Central processing unit), which is the main component of a computer. 

The CPU usually has two main systems: control unit (CU) and arithmetic and logic unit (ALU). 

The control unit (CU) is used to synchronize the tasks with the help of sending timings and control signals. On the other hand, mathematical and logical operations can be handled with the help of ALU. 

Micro programmed control units and hardwired control units can be called two types of control units. 

We can execute an instruction with the help of these two control units.

In the hardwired control unit, the execution of operations is much faster, but the implementation, modification, and decoding are difficult. In contrast, implementing, modifying, decoding micro-programmed control units is very easy. The micro-programmed control unit is also able to handle complex instructions. With the help of control signals generated by micro-programmed and hardwired control units, we are able to fetch and execute the instructions.

Figure – Basic CPU structure👇



Instruction Formats (Zero, One, Two and Three Address Instruction)

A instruction is of various length depending upon the number of addresses it contain. Generally CPU organization are of three types on the basis of number of address fields:

  1. Single Accumulator organization
  2. General register organization
  3. Stack organization
  1. Zero Address Instructions –
    Address is stored in the opcode, in the zero address instruction. A stack based organization uses zero address instruction.
  2. One Address Instructions –
    This use a implied ACCUMULATOR register for data manipulation. One operand is in accumulator and other is in register or memory location. Implied means that the CPU already know that one operand is in accumulator so there is no need to specify it. i.e there will be one opcode field and one address field.
  3. Two Address Instructions –
    Here two address can be specified in the instruction. Unlike earlier in one address instruction, the result was stored in accumulator here result can be stored at a different location rather than just accumulator, but require the number more of the bit to represent address.
  4. Three Address Instructions –
    This has three address field to specify a register or a memory location. The program created is much short in size but the number of bits per instruction increase.

Addressing Modes

The term addressing modes refers to the way in which the operand of an instruction is specified. The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.

An assembly language program instruction consists of two parts




Refer Q#4 For more details.



👦Prerequisite – 

There are two approaches of the design of the control unit of a microprocessor i.e.-

  • Hardware approach. &
  • Software approach.
Study 👉 Hardwired and Micro Programmed Control Unit.
To execute an instruction, there are two types of control units Hardwired Control unit and Micro-programmed control unit.

Question and Answers : (As per previous year CSVTU QP)

1. Explain the working of Hardwired Control Unit with neat Block Diagram.

Ans: See detailed Notes: 

👧All 3 methods including Sequence Counter method

      click👉 3 methods of hard wired Control Units

 👴For Sequence Counter method: 

      click👉sequence counter method hard wired CU

or 

Designing methods of hardwired control unit

Here the control signals are generated using hardware.   
There are three types of Hardwired Control Units.
1State table method :

  • Here the behavior of control unit is represented in the form of a table, which is known as the state table.
  • Here, each row represents the T-states and the columns represent the instructions.
  • Every intersection of the specific column to each row indicates which control signal will be produced in the corresponding T- state of an instruction.
  • Here the hardware circuitry is designed for each column(i.e. for a specific instruction) for producing control signals in different T-states.

2. Delay element method :

  • Here the control unit behavior is represented in the form of a flowchart.
  • Each step in the flowchart represents a control signal that needs to be produced for processing the instructions.
  • If all the steps of the instructions are performed, this means the instruction is executed completely.
  • Control signals perform micro-operations and each micro-operation requires one T-state.
  • For the micro-operations which are independent, they are required to be performed in different T-state. Therefore, for every consecutive control signal an exactly 1-state delay is required, which can be produced with the help of D FF.
  • Therefore. D Flip-Flops are inserted between every two consecutive control signals.


3. Sequence counter method :
This is the most popular and most commonly used method for generating delays between every consecutive control signal. 
It is similar to the delay element method, but the only difference is that instead of unnecessary D Flip flops there are triggering points in the circuit. They are activated after a gap of one-one  T-state.

Working of Sequence counter circuit –

  • Here one SR FF , one decode and one counter is used.
  • When the instruction cycle starts, then start = 1.
  • As we know, when Start =  1, because S is connected to Start, therefore Q  becomes 1 and and Q’ becomes 0.
  • Here the level triggering clock is used. Therefore, when clock = 1 or high and Start=1, as both outputs are connected to AND gate, so if the resultant of both is 1 that will enable the counter and counter starts counting from 0 0 0 state. So the 0 0 0 state is decoded by a decoder and produces output O1 , which will trigger the triggering point in the control circuit.
  • Suppose the counter is 3 bits, it generates 23 = 8 states(000 001 ….. 111) . The first count 0 0 0 is given to 3:8 decoder. It will active output number 1. This output is not a control signal but this will trigger the triggering point in the control unit circuit.
  • As the clock becomes high again after a gap of one T state, therefore clock =1 and start = 1 ,then the counter is enabled and changes it state to 001 and the counter decodes the count and makes O2 output high . And this will trigger a second triggering point in the circuit.
  • All counting states are decoded in the same manner.
2. Explain the working of Micro Programmed Control Unit with neat Block Diagram.

Ans:

See detailed Notes: 

Wilke's Design: click👉  Wilke's design

Some Drawbacks are there in Wilke's design, modified Diagram is shown below👇

Modern Approach : Modification of Wilke's Design : Modern Approach Microprogrammed Control Unit

or
The microprogrammed control unit uses the software approach to generate the control signals. The generation of the control signals is determined with the help of the program. This program is stored in the special memory of the processor which is smaller and faster. This memory is termed as microprogram memory or control store and the program is termed as the microprogram.

Microprogrammed Control Unit :
Microprogrammed Control Unit produces control signals by using micro-instructions.

Micro program :

  • A program is a set of instructions. An instruction requires a set of micro-operations.
  • Micro-operations are performed using control signals.
  • Here, these control signals are generated using micro-instructions.
  • This means every instruction requires a set of micro-instructions
  • A set of micro-instructions are called micro-program.
  • Microprograms for all instructions are stored in a small memory called control memory. 
    The control memory is present inside the processor.

Working : 
Consider an instruction that is fetched from the main memory into the instruction Register (IR). 

The processor uses its unique opcode to identify the address of the first micro-instruction. 

That address is loaded into CMAR (Control Memory Address Register). 

This address is decoded to decide the corresponding memory instruction from the control Memory. 

Micro-instructions will only have a control field. The control field Indicates the control signals to be generated. Most micro-instructions will not have an address field. 

Usually µPC will simply get incremented after every micro-instruction. 


This is as long as the micro-program is executing sequentially. 

If there is a branch micro-instruction only then there will be an address filed. 

If the branch is unconditional, the branch address will be directly loaded into CMAR.

For conditional branches, the branch condition will check the appropriate flag. This is done using a MUX which has all flag inputs. If the condition is true, then the mux will inform CMAR to load the branch address. If the condition is false CMAR will simply get incremented.
The control memory is usually implemented using flash ROM as it is non-volatile.


3. Write the Differences between Hardwired and Micro Programmed Control Unit.
Ans: 👦Prerequisite – See Q#1 for details

Difference Chart

Basis of DifferentiationHardwired Control UnitMicroprogrammed Control Unit
BasicIt is a circuitry approach.This control unit is implemented by programming
DesignRISC style instructionsCISC style instructions
ModificationModification is difficult as the control unit is hardwired. Modifying it will require the change in hardware.Modifications are easy in case of microprogrammed control unit as it will require the in change in the code only.
InstructionsIt works well for simple instructions.It works well for complex instructions also.
CostingImplementing hardwired structure requires a cost.Implementing microprograms is not costly.
Control memoryNo control memory is requiredControl memory is required
Execution SpeedFaster execution

Comparatively slow
4. What are Addressing Modes? Explain various Addressing modes with an Example.
Ans: 
The instruction set of a microprocessor is a list of all the software instructions that the processor can execute.When an instruction expressed in machine code, it is encoding using 0’s and 1’s(in hexadecimal format)

Types of addressing mode in Intel Microprocessor 8086

  1. Immediate addressing modeMOV AX,10ABH
  2. Direct addressing mode: MOV AX, [5000H]
  3. Register addressing mode: MOV AX,BX
  4. Register Indirect addressing mode: MOV AX,[BX]
  5. Indexed addressing mode: MOV AX,[SI]
  6. Register relative addressing mode: MOV AX, 50H[BX]
  7. Base plus index addressing mode: MOV AX, [BX] [SI]
  8. Base relative plus index addressing mode: MOV AX,50H[BX][SI]

Detailed Explanation: 



Note: An instruction may have 0-3 number of operands


Types of addressing modes:

  1. Register mode – In this type of addressing mode both the operands are registers.
    Example:
    MOV AX, BX
    XOR AX, DX
    ADD AL, BL
  2. Immediate mode – In this type of addressing mode the source operand is a 8 bit or 16 bit data. Destination operand can never be immediate data.
    Example:
    MOV CL, 0A
    ADD AL, 45
  3. Displacement or direct mode – In this type of addressing mode the effective address is directly given in the instruction as displacement, Example: MOV AX, [DISP]; MOV AX, [0500]
  4. Register indirect mode – In this addressing mode the effective address is in SI, DI or BX. Example: Physical Address = Segment Address + Effective Address, MOV AX, [DI]; ADD AL, [BX]; MOV AX, [SI] 
  5. Based indexed mode – In this the effective address is sum of base register and index register. Base register: BX, BP; Index register: SI, DI
  6. Indexed mode – In this type of addressing mode the effective address is sum of index register and displacement.
    Example:
    MOV AX, [SI+2000]
    MOV AL, [DI+3000]
  7. Based mode – In this the effective address is the sum of base register and displacement.
    Example:
    MOV AL, [BP+ 0100]
  8. Based indexed displacement mode – In this type of addressing mode the effective address is the sum of index register, base register and displacement.
    Example:
    MOV AL, [SI+BP+2000]

5. An instruction is stored at location 300 with its address field at location 301. The address field has the value 400, a processor register R1 contain the number 200. Evaluate Effective address if the addressing mode of the instruction are

(i) Direct

(ii) Immediate

(iii) Register Indirect

(iv) 
Relative
(v) Indexed

Answer:

the effective address if the addressing mode of the instruction is (i) 400 (ii) 301 (iii) 200 (iv)701 (v) 600



Explanation:

Given: An instruction is stored at location 300 with its address field at location 301. The address field at location 301. The address field has the value 400. A processor register r1 contains the number 200.


To find:  Evaluate the effective address if the addressing mode of the instruction is (i) direct (ii) immediate (iii) register indirect  (iv)relative (v) index with r1 as the index register

Solution: Note: An effective address is any operand to an instruction which references memory

The description given in the assignment can be represented like this:

Location _ Contents

300 _ opcode ; the instruction operation code

301 _ 400 ; address field of the above instruction

(a) Direct Addressing

(Example: Direct addressing mode: MOV AX, [5000H] means the content at memory location 5000 will be copied to AX), so as per our question,

Direct addressing means that the address field contains the address of memory location the instruction is supposed to work with (where an operand "resides").

Effective address would therefore be 400.

(b) immediate addressing:

(Example: Immediate addressing modeMOV AX,10AB)H

Immediate addressing means that the address field contains the operand itself.

Effective address would therefore be 301.

(c) register indirect addressing: 

(Ex: Register Indirect addressing mode: MOV AX,[BX])

Register indirect addressing means that the address of an operand is in the register. The address field in this case contains just another operand.

Effective address would therefore be in R1 = 200.

(d) relative addressing

(Ex: Register relative addressing mode: MOV AX, 50H[BX])

Relative addressing means that the address field contains offset to be added to the program counter to address a memory location of the operand.

Effective address would therefore be 301 + 400 = 701.

(e) indexed addressing with R1 as index register

There are several possible indexed addressing modes but in this case (there is an address field) it is co called "indexed absolute" addressing.

In indexed absolute addressing the effective address is calculated by taking the contents of the address field and adding the contents of the index register.

Effective address would therefore be 400 + R1 = 400 + 200 = 600.



6. What are the various Buses types in Computer system.
Ans: 
Inside computers, there are many internal components. In order for these components to communicate with each other, they make use of wires that are known as a ‘bus’.
There are three types of bus lines: Data bus, Address bus, and Control bus.

The address bus, which is a unidirectional pathway that allows information to travel in only one direction, carries information about where data will be stored in memory.

The data bus is a bidirectional pathway that carries the actual data (information) to and from the main memory.

The control bus carries the control and timing signals needed to coordinate the activities of the entire computer. Think of this as a traffic cop.


Pic Source: The Computer Buses Wikimedia Commons


Bus TypeDescription
Address busA unidirectional pathway – information can only flow one way
Data busA bi-directional pathway – information can flow in two directions
Control busCarries the control and timing signals needed to coordinate the activities of the entire computer
7. Explain Microoperations
or
Explain Instruction Execution
or
Explain significance of MAR, MBR , IR, GPR in execution of microoperations for fetching an Instruction.
Ans: See detailed Notes:  click👉 Microoperation 

OR 👲See the notes below: 



    Microprogram: Program stored in memory that generates all control signals required to execute the instruction set correctly, it consists micro-instructions.
    Micro-instruction: Contains a sequencing word and a control word. The control word is all control information required for one clock cycle.
    Micro-operations: Micro-operations are the atomic operations which executes a particular micro-instruction.
    Example of micro-operation during the fetch cycle:

    t1: MAR ←(PC)
    t2: MBR ←Memory
        PC ←(PC) + 1
    t3: IR ←(MBR)

  • Things a CPU must do:
    • Fetch Instructions
    • Interpret Instructions
    • Fetch Data
    • Process Data
    • Write Data
  • Components of the CPU
    • Arithmetic and Logic Unit (ALU): does the actual computation or processing of data
    • Control Unit (CU): controls the movement of data and instructions into and out of the CPU and controls the operation of the ALU.
  • A small amount of internal memory, called the registers, is needed by the CPU to fulfill these requirements


Register Organization

  • Registers are at top of the memory They serve two functions:
  1. User-Visible Registers - enable the machine- or assembly-language programmer to minimize main-memory references by optimizing use of registers
  2. Control and Status Registers - used by the control unit to control the operation

User-Visible Registers

Categories of Use

  • General Purpose registers - for variety of functions
  • Data registers - hold data
  • Address registers - hold address information
  • Segment pointers - hold base address of the segment in use
  • Index registers - used for indexed addressing and may be auto indexed
  • Stack Pointer - a dedicated register that points to top of a Push, pop, and other stack instructions need not contain an explicit stack operand.

Control and Status Registers

  • Essential to instruction execution
    • Program Counter (PC)
    • Instruction Register (IR)
    • Memory Address Register (MAR) - usually connected directly to address lines of bus
    • Memory Buffer Register (MBR) - usually connected directly to data lines of bus
  • Program Status Word (PSW) - also essential, common fields or flags contained include:
    • Sign - sign bit of last arithmetic operation
    • Zero - set when result of last arithmetic operation is 0
    • Carry - set if last op resulted in a carry into or borrow out of a high-order bit
    • Equal - set if a logical compare result is equality
    • Overflow - set when last arithmetic operation caused overflow
    • Interrupt Enable/Disable - used to enable or disable interrupts

The Instruction Cycle

    Instruction Cycle

    Registers Involved In Each Instruction Cycle:

    • Memory address registers(MAR) : It is connected to the address lines of the system bus. It specifies the address in memory for a read or write operation.
    • Memory Buffer Register(MBR) : It is connected to the data lines of the system bus. It contains the value to be stored in memory or the last value read from the memory.
    • Program Counter(PC) : Holds the address of the next instruction to be fetched.
    • Instruction Register(IR) : Holds the last instruction fetched.

Basic instruction cycle contains the following sub-cycles.

  • Fetch - read next instruction from memory into CPU
  • Execute - Interpret the opcode and perform the indicated operation
  • Interrupt - if interrupts are enabled and one has occurred, save the current process state and service the interrupt


Data Flow

  • Exact sequence depends on CPU design
  • We can indicate sequence in general terms, assuming CPU employs:
    • a memory address register (MAR)
    • a memory buffer register (MBR)
    • a program counter (PC)
    • an instruction register (IR)

Fetch cycle data flow

  • PC contains address of next instruction to be fetched
  • This address is moved to MAR and placed on address bus
  • Control unit requests a memory read
  • Result is
    • placed on data bus
    • result copied to MBR
    • then moved to IR

Meanwhile, PC is incremented.



************************************************************************************

for any further queries and doubts in this subject
please feel to write to me or contact me at:
Pradeep Kumar Chaudhary
pradeep14335@gmail.com








---------------------------------------------------------------------------------------------------------------------
Disclaimer:  साइट पर सामग्री केवल शैक्षिक उद्देश्यों के लिए है और यह पेशेवर सलाह नहीं है।

Educational Purpose Only: The information provided on this blog is for general informational and educational purposes only. All content, including text, graphics, images, and other material contained on this blog, is intended to be a resource for learning and should not be considered as professional advice.

No Professional Advice: The content on this blog does not constitute professional advice, and you should not rely on it as a substitute for professional consultation, diagnosis, or treatment. Always seek the advice of a qualified professional with any questions you may have regarding a specific issue.

Accuracy of Information: While I strive to provide accurate and up-to-date information, I make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to the blog or the information, products, services, or related graphics contained on the blog for any purpose. Any reliance you place on such information is therefore strictly at your own risk.

External Links: This blog may contain links to external websites that are not provided or maintained by or in any way affiliated with me. Please note that I do not guarantee the accuracy, relevance, timeliness, or completeness of any information on these external websites.

Personal Responsibility: Readers of this blog are encouraged to do their own research and consult with a professional before making any decisions based on the information provided. I am not responsible for any loss, injury, or damage that may result from the use of the information contained on this blog.

Contact: If you have any questions or concerns regarding this disclaimer, please feel free to contact me at my email: pradeep14335@gmail.com

No comments:

Post a Comment