CS303 System Software Module 1, Exercises of Architecture

Eg: Language translators like compiler, assembler. I. Application Software: Application software consists of programs designed to perform specific tasks for.

Typology: Exercises

2022/2023

Uploaded on 03/01/2023

johnatan
johnatan 🇺🇸

4

(29)

280 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS303 System Software Module 1
Page 1
MODULE I
SYLLABUS
INTRODUCTION : System Software Vs. Application Software, Different System
Software Assembler, Linker, Loader, Macro Processor, Text Editor, Debugger, Device
Driver, Compiler, Interpreter, Operating System(Basic Concepts only)
SIC & SIC/XE ARCHITECTURE: Addressing modes, SIC & SIC/XE Instruction set,
Assembler Directives and Programming.
INTRODUCTION
Computer Software
A computer cannot do anything on its own. It must be instructed to do a job. So its
necessary to specify a sequence of instructions that a computer must perform to solve a
problem. Such a sequence of instructions written in a language understood by a computer is
called a computer program. Computer software is the collection of computer programs and
related data that provide instructions telling a computer what to do. Software is divided into 2
types:
1. System Software
2. Application Software
1. System Software
System Software is a set of programs that manages and supports the operation of a
computer. It controls the computer system and enhances its performance. It enables the
application software to interact with the system hardware. That is system software act as a
bridge between application software and computer hardware. Eg: Operating System,
Compiler etc. System software can be broadly classified into 3 types:
i. System Control Programs
ii. System Support Programs
iii. System Development Programs
i.System Control Programs: controls the execution of programs, manage the storage and
processing resources of the computer and perform other management and monitoring
functions. Eg: Operating System, Database Management Systems(DBMS).
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download CS303 System Software Module 1 and more Exercises Architecture in PDF only on Docsity!

MODULE I

SYLLABUS

INTRODUCTION : System Software Vs. Application Software, Different System Software– Assembler, Linker, Loader, Macro Processor, Text Editor, Debugger, Device Driver, Compiler, Interpreter, Operating System(Basic Concepts only) SIC & SIC/XE ARCHITECTURE : Addressing modes, SIC & SIC/XE Instruction set, Assembler Directives and Programming.

INTRODUCTION

Computer Software

A computer cannot do anything on its own. It must be instructed to do a job. So its necessary to specify a sequence of instructions that a computer must perform to solve a problem. Such a sequence of instructions written in a language understood by a computer is called a computer program. Computer software is the collection of computer programs and related data that provide instructions telling a computer what to do. Software is divided into 2 types:

  1. System Software
  2. Application Software 1. System Software System Software is a set of programs that manages and supports the operation of a computer. It controls the computer system and enhances its performance. It enables the application software to interact with the system hardware. That is system software act as a bridge between application software and computer hardware. Eg: Operating System, Compiler etc. System software can be broadly classified into 3 types: i. System Control Programs ii. System Support Programs iii. System Development Programs i.System Control Programs: controls the execution of programs, manage the storage and processing resources of the computer and perform other management and monitoring functions. Eg: Operating System, Database Management Systems(DBMS).

ii. System Support Programs: provide routine service functions to the other computer programs and computer users. Eg: utilities, libraries System Development Programs: assists in the creation of application programs. Eg: Language translators like compiler, assembler. I. Application Software: Application software consists of programs designed to perform specific tasks for users. .Eg: Media player, Ms. Word, Notepad etc. There are 2 types of application software: i. General Purpose Application Software: These provide general user needs, not for a specific purpose. Eg: Spreadsheet program like Microsoft Excel, which can be used to perform different applications. ii. Special Purpose(Custom) Application Software: Typically used for specific applications. Eg: Turbo Tax, which is a special purpose application used to perform tax returns. Relationship between system software and application software: System software control and manages hardware thereby providing a platform for application software to operate. Application software helps user to accomplish one or more tasks using a computer through system software. For an application to run on a computer it needs to be allocate space from memory, allocated resources (CPU time, hardware like keyboard, display, printer etc), given access to system libraries, all of which is done by operating system which is a system software. Computer Hardware System Software Application Software

  1. Operating Systems
  2. Database Management Systems(DBMS) 1. Language Translators It is the program that takes an input program in one language and produces an output in another language. Different language translators are: a. Compiler b. Interpreter c. Assembler d. Macropreprocessor a. Compiler A compiler is a program that translates programs written in any high level language (source program) into its equivalent machine language program(target language). An important role of the compiler is to report any errors in the source program that it detects during the translation process. b. Interpreter An interpreter is also a language translator which converts source program in high level language into machine language, just like compiler did. It reads the source code one line at a time, converts this line into machine code and executes it. The machine code is then discarded and next line is processed. It stops translating after the first error. Compilers, on the other hand, translates the entire program in one go and then executes it. Compiler analyse the entire program, displays where errors have occurred. If errors are present, then program cannot run.

Interpreter works as follows. The interpreter reads the source program and stores it in memory. Program counter (PC) indicates which statement of the source program is to be interpreted next. During interpretation, it takes a source statement, determines its meaning and performs the actions and PC is incremented. The interpretation cycle consists of the following steps:  Fetch the statement.  Analyze the statement and determine its meaning.  Execute the meaning of the statement. Advantages of interpreter: Easier to use particularly for beginners, since errors are immediately displayed.

. Disdvantage of interpreter: Every line has to be translated every time it is executed, even if it is executed many times as the program runs. Because of this interpreters tend to be slow. Example for interpreters: Basic on older home computers, script interpreters such as JavaScript. c. Assembler Assembler converts assembly language program into its equivalent machine language. Assembly Language Machine Language Example: MASM (8086 assembler) d.Macro Preprocessor A macro processor is a program that reads a file and scans them for certain keywords. When a keyword is found, it is replaced by some text. The keyword/text combination is called a macro. A simple example is the C language pre-processor: #define max 100; int i; for(i=0;i<max;i++) { ......... }

Assembler

4 .Text Editors A text editor is a type of program used for editing plain text files. Text editors are often provided with operating systems or software development packages. Example for text editors are Microsoft word, gedit in Linux etc. 5 .Debuggers A debugger or debugging tool is a computer program that is used to test and debug other programs. 6 .Device Drivers In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer. A Device Driver is glue between an OS and its I/O devices. They act as translators converting requests received from the operating system into commands that the devices can understand. 7 .Operating System It is the most important system program that act as an interface between the users and the system. It makes the computer easier to use. It provides an interface that is more user-friendly than the underlying hardware. The functions of OS are:

  1. Process management
  2. Memory management
  3. Resource management
  4. I/O operations
  5. Data management
  6. Providing security to user’s job. 8 .Database Management System A database is a collection of related data. Data can be consider as a piece of information which can be recorded. Data Base Management System (DBMS) is a collection of programs that enables users to create and maintain a database. It is a general purpose software that facilitates the processes of defining, constructing, manipulating and sharing of database among various users and applications.

Defining a database means specifying the data types, structures and constraints for the data to be stored in the database.  Constructing the database is the process of storing the data on some storage medium that is controlled by the DBMS.  Manipulating the database means processing the database. It includes functions such as querying the database to retrieve specific data, updating the database to reflect changes in the mini world and generating reports from the data.  Sharing a database allows multiple users and programs to access the database concurrently. A Database System is a computerized record keeping system whose overall purpose is to store information and to allow users to retrieve and update that information on demand. Database system consists of a Database, Database Management System and an Application program. An application program accesses the database by sending requests or queries for data to the DBMS. Fig: A Database System

Instruction Formats

  • All machine instructions are of 24-bits length. It has following format:
  • x is a flag bit used to indicate indexed-addressing mode. If x=0, then direct addressing mode If x=1, then indexed addressing mode/indirect addressing mode

Addressing modes

The term addressing modes refers to the way in which the operand of an instruction is specified.Two types of addressing modes are available in SIC architecture, indicated by the setting of x-bit in the instruction. They are

  1. Direct addressing mode
  2. Indexed addressing mode or indirect addressing mode Addressing Mode Indication Target Address Calculation Direct X=0 TA=address Indexed/Indirect X=1 TA=address +(X)
  • where (X) represents the contents of index register.

Instruction Set

It includes instructions like:

1. Load and Store Registers (Data movement instruction)  Ex: LDA, STA, LDX, STX.  LDA – Load Accumulator, STA – Store the content of Accumulator to specified location  LDX – Load X Register, STX – Store the content of X Register to specified location 2. Arithmetic operating instructions  Ex: ADD, SUB, MUL, DIV.

 This involves register A and a word in memory, with the result being left in the A register. 3. Compare Instruction  Ex: COMP  Instruction COMP compares a value in A with a word in memory, and sets the condition code CC to indicate the result of <, > and =. 4. Branching instructions (Conditional Jump Instruction)  Ex: JLT, JEQ, JGT.  These instructions test the settings of CC and jump accordingly.  JLT – Jump on Less than, JEQ- Jump on Equal, JGT – Jump on Greater than 5. Subroutine linkage instructions  Ex: JSUB, RSUB  JSUB jumps to the subroutine placing the return address in register L  RSUB returns by jumping to the address contained in register L.

Input and Output Operations

 Input/Output is performed by transferring 1 byte at a time to or from the rightmost 8 bits of register A.  Each device is assigned a unique 8-bit code  There are 3 I/O instructions, each of which specifies device code as an operand.

  1. TD ( Test device)
    • Tests whether the addressed device is ready to send or receive a byte of data
    • The condition code is set to indicate the result of this test.
    • If CC setting is < the device is ready, if setting is = device is not ready
  2. RD (Read Data)
    • for reading data 3. WD (Write Data)
    • for writing data
  • The fraction is represented as a 36 bit number and has value between 0 and 1
  • The exponent is represented as a 11 bit unsigned binary number between 0 and 2047.
  • The sign of the floating point number is indicated by s : 0=positive, 1=negative.
  • Therefore, the absolute floating point number value is: f*2(e-1024)

Instruction Format

There are 4 different instruction formats available in SIC/XE:  Formats 1 and 2 do not reference memory at all  Instruction format 3 and 4 introduce addressing mode flag bits. Flag e: e=0 use Format 3 e=1 use Format 4 Flag p – indicates P rogram counter relative addressing Flag b - indicates B ase register relative addressing Flag x – indicates inde x ing. (uses index register) Flag i – indicates i mmediate addressing Flag n – indicates i n direct addressing

Instruction Set

SIC/XE supports all of the instructions that are available on standard SIC. SIC/XE supports following instructions:

1. Load and Store Registers (Data movement instruction)  Ex: LDCH, STCH, LDB, STB.  LDCH – Load Accumulator with character, STCH – Store the character on Accumulator to specified location.  LDX – Load X Register, STX – Store the content of X Register to specified location 2. Integer Arithmetic operating instructions  Ex: ADD, SUB, MUL, DIV.  This involves register A and a word in memory, with the result being left in the A register. 3. Floating Point Arithmetic Instruction  Ex: ADDF, SUBF, MULF, DIVF  F- stands for Floating Point 4. Compare Instruction  Ex: COMP  Instruction COMP compares a value in A with a word in memory, and sets the condition code CC to indicate the result of <, > and =. 5. Branching instructions (Conditional Jump Instruction)  Ex: JLT, JEQ, JGT.  These instructions test the settings of CC and jump accordingly.  JLT – Jump on Less than, JEQ- Jump on Equal, JGT – Jump on Greater than 6. Subroutine linkage instructions  Ex: JSUB, RSUB  JSUB jumps to the subroutine placing the return address in register L  RSUB returns by jumping to the address contained in register L.

• SIC/XE has capability for programmed I/O. Programmed I/O means I/O devices may

input or output data while CPU is busy with other works.3 instructions are provided for handling programmed I/O features: SIO - Start I/O HIO - Halt I/O TIO - Test I/O

Addressing Modes

The term addressing modes refers to the way in which the operand of an instruction is specified. Instruction format 3 and 4 introduce addressing mode flag bits. Flag e: e=0 use Format 3 e=1 use Format 4 Flag p – indicates P rogram counter relative addressing Flag b - indicates B ase register relative addressing Flag x – indicates inde x ing. (uses index register) Flag i – indicates i mmediate addressing Flag n – indicates i n direct addressing

1. Indexed Addressing Mode  If x= 1 , then it indicates indexed addressing mode.  In this addressing mode, the content of x register is added with address/disp for the target address calculation. TA=address +(X)  Indexed addressing mode can be combined with PC relative and Base relative addressing mode. In this case, the content of X register is also added for the target address calculation.

 Indexing cannot be used with immediate or indirect addressing modes.

2. Immediate Addressing Mode  If n=0 and i=1 , then it indicates Immediate addressing mode.  In this addressing mode, target address(TA) itself is used as the operand value.  No memory reference is performed. 3. Indirect Addressing Mode  If n=1 and i=0 , then it indicates Indirect addressing mode.  In this addressing mode, word at the location given by the target address is fetched. The value contained in this word is then taken as the address of the operand value. 4. Simple Addressing ModeIf n=0 and i=0, then it indicates simple addressing mode.  In this addressing mode, TA is taken as the location of the operand  If n=1 and i=1, it also indicates simple addressing mode ( same as n=0 and i=0) 5. Program Counter Relative AddressingIf b=0 and p=1, then it Indicates Program Counter(PC) relative addressing mode.  In this addressing mode, the displacement given in instruction is added with the content of program counter(PC) for obtaining the target address.

Examples of SIC/XE instructions and addressing modes  Following figure gives examples of different addressing modes available on SIC/XE.  The contents of B, PC and X registers are given as (B)=006000, (PC)= 003000 and (X)=000090. All values are given in hexadecimal.  Fig b gives the machine code for a series of LDA instruction (opcode for LDA is 00)  The target address generated by each instruction and the value loaded into register A is also shown

SIC Assembler Directives

Assembler directives are instructions that direct the assembler to do something. The assembler directives in SIC are:

1. START  Indicates the start of program.  Used to define program name and starting address  Eg: COPY START 1000 This means the program name is COPY and the starting address is 1000 2. END  Used to indicate the end of program.

 Optionally indicates first executable instruction.  Eg: END ALPHA This means the program name ENDs at here. And the first executable instruction is ALPHA

3. RESW  Used to reserves specified word for a data area.  Eg: ALPHA RESW 4 This is to reserve 4 words. (4 words means 4*3 =12 bytes) 4. RESB  Used to reserves specified byte for a data area.  Eg: A RESB 5 This is to reserve 5 bytes. 5. WORD  Used to generate one word integer constant  Eg: B WORD 6 This uses one word to store the integer constant 6 and the name B is assigned to the first location 6. BYTE  Generate character constant using required number of bytes  Eg: ALPHA BYTE C ‘HAI’ This generates number of bytes needed to store HAI.

SIC/XE Programming Examples

Program 1 //Sample data movement

Write a sequence of instructions for SIC/XE which stores the value 5 in

ALPHA and the character Z in C

LDA #5 Load value 5 into register A STA ALPHA Store in ALPHA LDCH #90 Load ASCII code for ‘Z’ into register A STCH C1 Store in character variable C … … … ALPHA RESW 1 Reserve one-word variable for ALPHA C1 RESB 1 Reserve one-byte variable for ALPHA