Top Banner
System Software by Leland L. Beck chapter 1, pp.1-20. www.BookSpar.com | Website for Students | VTU -NOTES - Question Papers
32

System Software by Leland L. Beck chapter 1, pp.1-20. | Website for Students | VTU -NOTES -Question Papers.

Mar 26, 2015

Download

Documents

Aidan Stewart
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

System Software

by Leland L. Beck

chapter 1, pp.1-20.www.BookSpar.com | Website for Students

| VTU -NOTES -Question Papers

Page 2: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Outline of Chapter 1

• System Software and Machine Architecture• The Simplified Instructional Computer (SIC)• Traditional (CISC) Machines– Complex Instruction Set Computers

• RISC Machines– Reduced Instruction Set Computers

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 3: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

System Software vs. Machine Architecture

• Machine dependent– The most important characteristic in which most

system software differ from application software – e.g. assembler translate mnemonic instructions into machine

code– e.g. compilers must generate machine language code

• Machine independent– There are aspects of system software that do not directly

depend upon the type of computing system – e.g. general design and logic of an assembler– e.g. code optimization techniques

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 4: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

The Simplified Instructional Computer (SIC)

• SIC is a hypothetical computer that includes the hardware features most often found on real machines

• Two versions of SIC– standard model– extension version

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 5: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Machine Architecture (1/5)

• Memory– 215 bytes in the computer memory– 3 consecutive bytes form a word – 8-bit bytes

• Registers

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Mnemonic Number Special useA 0 Accumulator; used for arithmetic operationsX 1 Index register; used for addressingL 2 Linkage register; JSUB

PC 8 Program counterSW 9 Status word, including CC

Page 6: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Machine Architecture (2/5)

• Data Formats– Integers are stored as 24-bit binary numbers; 2’s

complement representation is used for negative values

– No floating-point hardware

• Instruction Formats

• Addressing Modes

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

opcode (8) address (15)x

Mode Indication Target address calculationDirect x=0 TA=addressIndexed x=1 TA=address+(X)

Page 7: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Machine Architecture (3/5)

• Instruction Set– load and store: LDA, LDX, STA, STX, etc.– integer arithmetic operations: ADD, SUB, MUL,

DIV, etc.• All arithmetic operations involve register A and a word

in memory, with the result being left in the register

– comparison: COMP• COMP compares the value in register A with a word in

memory, this instruction sets a condition code CC to indicate the result

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 8: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Machine Architecture (4/5)

• Instruction Set– conditional jump instructions: JLT, JEQ, JGT• these instructions test the setting of CC and jump

accordingly

– subroutine linkage: 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

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 9: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Machine Architecture (5/5)

• Input and Output– Input and output are performed by transferring 1

byte at a time to or from the rightmost 8 bits of register A

– The Test Device (TD) instruction tests whether the addressed device is ready to send or receive a byte of data

– Read Data (RD)– Write Data (WD)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 10: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Examples

• Data movement Fig. 1.2• Arithmetic operation Fig. 1.3• Looping and indexing Fig. 1.4, Fig. 1.5• Input and output Fig. 1.6• Subroutine call Fig. 1.7

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 11: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Examples (Fig 1.2)-- Data movement

ALPHA RESW1FIVE WORD 5CHARZ BYTE C’Z’C1 RESB 1

. . LDA FIVE STA ALPHA LDCHCHARZ

STCH C1

(a)

• No memory-memory move instruction

• 3-byte word: – LDA, STA, LDL, STL, LDX,

STX• 1-byte:

– LDCH, STCH• Storage definition

– WORD, RESW– BYTE, RESB

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 12: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Examples (Cont.)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

• All arithmetic operations are performed using register A, with the result being left in register A.

BETA=ALPHA+INCR-ONEDELTA=GAMMA+INCR-ONE

Page 13: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Example-- Arithmetic operation (Fig 1.3)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

BETA=ALPHA+INCR-ONEDELTA=GAMMA+INCR-ONE

Page 14: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Example -- Looping and indexing (Fig. 1.4)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 15: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Example-- Looping and indexing (Fig. 1.5)

• Arithmetic– Arithmetic operations are performed using register A, with the

result being left in register A

• Looping (TIX)– (X)=(X)+1– compare with operand– set CC

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

GAMMA[I]=ALPHA[I]+BETA[I]I=0 to 100

Page 16: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Machine Architecture (1/4)

• Memory– 220 bytes in the computer memory

• More Registers

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Mnemonic Number Special useB 3 Base register; used for addressingS 4 General working registerT 5 General working registerF 6 Floating-point acumulator (48bits)

Page 17: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Machine Architecture (2/4)

• Data Formats– Floating-point data type: frac*2(exp-1024)

• frac: 0~1• exp: 0~2047

• Instruction Formats

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

exponent (11) fraction (36)s

Format 1op(8)

Format 2op(8) r1(4) r2(4)

Format 3 e=0op(6) n I x b p e disp(12)

Format 4 e=1op(6) n I x b p e address (20)

Page 18: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Machine Architecture (3/4)

• How to compute TA?

• How the target address is used?

– Note: Indexing cannot be used with immediate or indirect addressing modes

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Mode Indication Target address calculation operand Base relative b=1, p=0 TA=(B)+disp (0<=disp<=4095) (TA)PC-relative b=0, p=1 TA=(PC)+disp (-2048<=disp<=2047) (TA)

Direct b=0, p=0 TA=disp (format 3) or address (format 4) (TA)Indexed x=1 TA=TA+(X) (TA)

Mode Indication operand value

immediate addressingi=1, n=0 TAindirect addressing i=0, n=1 ((TA))

simple addressing i=0, n=0 SIC instruction (all end with 00)

i=1, n=1 SIC/XE instruction

Page 19: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Example of SIC/XE instructions and addressing modes

Page 20: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 21: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Machine Architecture (4/4)• Instruction Set– new registers: LDB, STB, etc.– floating-point arithmetic: ADDF, SUBF, MULF, DIVF– register move: RMO– register-register arithmetic: ADDR, SUBR, MULR, DIVR

– supervisor call: SVC• generates an interrupt for OS (Chap 6)

• Input/Output– SIO, TIO, HIO: start, test, halt the operation of I/O device

(Chap 6)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 22: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Programming Examples (Fig 1.2)

ALPHA RESW 1FIVE WORD 5CHARZ BYTE C’Z’C1 RESB 1

. . LDA FIVE STA

ALPHA LDCH CHARZ

STCH C1

(a)

ALPHA RESW 1C1 RESB 1

. . . LDA #5 STA ALPHA LDA #90 STCH C1

(b)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 23: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Programming Example -- Looping and Indexing Example (Fig 1.4)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 24: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Programming Example -- Looping and indexing (Fig 1.5)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 25: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC/XE Programming Example

• data movement– #: immediate addressing for SIC/XE

• arithmetic– ADDR S,X

• Looping (TIXR T)– (X)=(X)+1– compare with register specified– set CC

• COMPR X,Twww.BookSpar.com | Website for Students

| VTU -NOTES -Question Papers

Page 26: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

SIC Programming Example -- Sample Input and Output (Fig 1.6)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 27: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Homework #1

• Write a sequence of instructions for SIC/XE to set ALPHA equal to 4*BETA-9. Assume that ALPHA and BETA are defined as in Fig. 1.3 (b)

• Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of BETAGAMMA. Assume that ALPHA and BETA are defined as in Fig. 1.3(a)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 28: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Homework #2

• Please write a program for SIC/XE that contains routines. The routines read records from an input device (identified with device code F1) and copies them to an output device (code 05). This main routine calls subroutine RDREC to read a record into a buffer and subroutine ERREC to write the record from the buffer to the output device. Each subroutine must transfer the record one character at a time because the only I/O instructions available are RD and WD.

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 29: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Homework #2• Program copy {• save return address;• cloop: call subroutine RDREC to read one record;• if length(record)=0 {• call subroutine WRREC to write EOF;• } else {• call subroutine WRREC to write one record;• goto cloop; • }• load return address• return to caller• }

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 30: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Homework #2 (Cont.)

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Subroutine RDREC { clear A, X register to 0;

rloop: read character from input device to A register

if not EOR { store character into buffer[X]; X++; if X < maximum length goto rloop;

} store X to length(record); return }

EOR: character x‘00’

Page 31: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

Homework #2 (Cont.)• Subroutine WDREC {• clear X register to 0;• wloop: get character from buffer[X]• write character from X to output device• X++;• if X < length(record)• goto wloop; • return • }

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers

Page 32: System Software by Leland L. Beck chapter 1, pp.1-20.  | Website for Students | VTU -NOTES -Question Papers.

www.BookSpar.com | Website for Students | VTU -NOTES -Question Papers