Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 9 лет назад пользователемРаиса Лупандина
1 System Software by Leland L. Beck chapter 1, pp.1-20.
2 Chap 1 Outline of Chapter 1 n System Software and Machine Architecture n The Simplified Instructional Computer (SIC) n Traditional (CISC) Machines u Complex Instruction Set Computers n RISC Machines u Reduced Instruction Set Computers
3 Chap 1 System Software vs. Machine Architecture n Machine dependent u The most important characteristic in which most system software differ from application software u e.g. assembler translate mnemonic instructions into machine code u e.g. compilers must generate machine language code n Machine independent u There are aspects of system software that do not directly depend upon the type of computing system u e.g. general design and logic of an assembler u e.g. code optimization techniques
4 Chap 1 The Simplified Instructional Computer (SIC) n SIC is a hypothetical computer that includes the hardware features most often found on real machines n Two versions of SIC u standard model u extension version
5 Chap 1 SIC Machine Architecture (1/5) n Memory u 2 15 bytes in the computer memory u 3 consecutive bytes form a word u 8-bit bytes n Registers
6 Chap 1 SIC Machine Architecture (2/5) n Data Formats u Integers are stored as 24-bit binary numbers; 2s complement representation is used for negative values u No floating-point hardware n Instruction Formats n Addressing Modes opcode (8)address (15) x
7 Chap 1 SIC Machine Architecture (3/5) n Instruction Set u load and store: LDA, LDX, STA, STX, etc. u integer arithmetic operations: ADD, SUB, MUL, DIV, etc. F All arithmetic operations involve register A and a word in memory, with the result being left in the register u comparison: COMP F COMP compares the value in register A with a word in memory, this instruction sets a condition code CC to indicate the result
8 Chap 1 SIC Machine Architecture (4/5) n Instruction Set u conditional jump instructions: JLT, JEQ, JGT F these instructions test the setting of CC and jump accordingly u subroutine linkage: JSUB, RSUB F JSUB jumps to the subroutine, placing the return address in register L F RSUB returns by jumping to the address contained in register L
9 Chap 1 SIC Machine Architecture (5/5) n Input and Output u Input and output are performed by transferring 1 byte at a time to or from the rightmost 8 bits of register A u The Test Device (TD) instruction tests whether the addressed device is ready to send or receive a byte of data u Read Data (RD) u Write Data (WD)
10 Chap 1 SIC Programming Examples n Data movement Fig. 1.2 n Arithmetic operation Fig. 1.3 n Looping and indexing Fig. 1.4, Fig. 1.5 n Input and output Fig. 1.6 n Subroutine call Fig. 1.7
11 SIC Programming Examples (Fig 1.2) -- Data movement ALPHA RESW1 FIVE WORD5 CHARZ BYTECZ C1 RESB1. LDAFIVE STAALPHA LDCHCHARZ STCHC1 (a) n No memory-memory move instruction n 3-byte word: u LDA, STA, LDL, STL, LDX, STX n 1-byte: u LDCH, STCH n Storage definition u WORD, RESW u BYTE, RESB
12 Chap 1 SIC Programming Examples (Cont.) n All arithmetic operations are performed using register A, with the result being left in register A. BETA=ALPHA+INCR-ONE DELTA=GAMMA+INCR-ONE
13 SIC Programming Example -- Arithmetic operation (Fig 1.3) BETA=ALPHA+INCR-ONE DELTA=GAMMA+INCR-ONE
14 Chap 1 SIC Programming Example -- Looping and indexing (Fig. 1.4)
15 Chap 1 SIC Programming Example -- Looping and indexing (Fig. 1.5) n Arithmetic u Arithmetic operations are performed using register A, with the result being left in register A n Looping (TIX) u (X)=(X)+1 u compare with operand u set CC GAMMA[I]=ALPHA[I]+BETA[I] I=0 to 100
16 Chap 1 SIC/XE Machine Architecture (1/4) n Memory u 2 20 bytes in the computer memory n More Registers
17 Chap 1 SIC/XE Machine Architecture (2/4) n Data Formats u Floating-point data type: frac*2 (exp-1024) F frac: 0~1 F exp: 0~2047 n Instruction Formats exponent (11)fraction (36) s
18 Chap 1 SIC/XE Machine Architecture (3/4) n How to compute TA? n How the target address is used? u Note: Indexing cannot be used with immediate or indirect addressing modes
19 Example of SIC/XE instructions and addressing modes
20 Chap 1
21 SIC/XE Machine Architecture (4/4) n Instruction Set u new registers: LDB, STB, etc. u floating-point arithmetic: ADDF, SUBF, MULF, DIVF u register move: RMO u register-register arithmetic: ADDR, SUBR, MULR, DIVR u supervisor call: SVC F generates an interrupt for OS (Chap 6) n Input/Output u SIO, TIO, HIO: start, test, halt the operation of I/O device (Chap 6)
22 SIC/XE Programming Examples (Fig 1.2) ALPHA RESW1 FIVE WORD5 CHARZ BYTECZ C1 RESB1. LDAFIVE STAALPHA LDCHCHARZ STCHC1 (a) ALPHA RESW1 C1 RESB1. LDA#5 STAALPHA LDA#90 STCHC1 (b)
23 SIC/XE Programming Example -- Looping and Indexing Example (Fig 1.4)
24 SIC/XE Programming Example -- Looping and indexing (Fig 1.5)
25 Chap 1 SIC/XE Programming Example n data movement u #: immediate addressing for SIC/XE n arithmetic u ADDRS,X n Looping (TIXR T) u (X)=(X)+1 u compare with register specified u set CC n COMPRX,T
26 SIC Programming Example -- Sample Input and Output (Fig 1.6)
27 Chap 1 Homework #1 n 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) n Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of BETA GAMMA. Assume that ALPHA and BETA are defined as in Fig. 1.3(a)
28 Chap 1 Homework #2 n 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.
29 Chap 1 Homework #2 n Program copy { n save return address; n cloop: call subroutine RDREC to read one record; n if length(record)=0 { n call subroutine WRREC to write EOF; n } else { n call subroutine WRREC to write one record; n goto cloop; n } n load return address n return to caller n }
30 Chap 1 Homework #2 (Cont.) 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 x00
31 Chap 1 Homework #2 (Cont.) n Subroutine WDREC { n clear X register to 0; n wloop: get character from buffer[X] n write character from X to output device n X++; n if X < length(record) n goto wloop; n return n }
32 Chap 1
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.