01 - SS Chapter 01 Introduction To A Machine Architecture
01 - SS Chapter 01 Introduction To A Machine Architecture
References
1. Alfred V Aho, Monica S. Lam, Ravi Sethi, Jeffrey D
Ullman, Compilers- Principles, Techniques and Tools,
2nd edition, Addison-Wesley, 2011.
2. John J. Donovan, “System Programming”, 2nd Ed., Tata
McGraw Hill, 2009.
3. D. M. Dhamdhere, “System Programming and
Operating Systems”, 2nd Ed., Tata McGraw Hill, 2011.
Chapter 01
Introduction to a Machine
Architecture
Introduction
Practical computer systems divide software into two
major classes:
1) Application Software
2) System Software
System Software:
● System software consists of a variety of programs that
support
the operation of a computer .
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 (XE version)
SIC Machine Architecture
Features
⮚ Memory
⮚ Register
⮚ Data Format
⮚ Instruction Format
⮚ Addressing Mode
⮚ Input/output
⮚ Instruction Set
SIC Machine Architecture
Memory
• 8-bit bytes
• 3 consecutive bytes form a word (24 bits)
• All addresses in SIC are byte addresses
• 215 bytes =32768 bytes in the computer
memory
SIC Machine Architecture
• Registers
There are 5 registers all of 24 bits in length
SIC Machine Architecture
• Data Formats
• Integers are stored as 24-bit binary numbers
• 2’s complement representation is used for
negative values
• 8 bit ASCII code for characters
• No floating-point hardware
SIC Machine Architecture
Instruction Formats
• All instructions are of 24 bit format
• Addressing Modes
SIC Machine Architecture
• Instruction Set
• Data transfer
• Arithmetic operations
• Logical operations
• Branch operations
• Machine operations
SIC Machine Architecture
• Data transfer Instructions
LDA-load data into accumulator
LDX- load data into index register
LDL-load data into linkage register
LDCH-load char into accumulator
STA-store the contents of A into the memory
STX-store the contents of X into the memory
STL-store the contents of L into the memory
STSW-store the contents of SW into the memory
SIC Machine Architecture
Arithmetic group of Instructions
• ADD
• SUB
• MUL
• DIV
• All arithmetic operations involve register A
and a word in memory, with the result
being left in the register
SIC Machine Architecture
Logical group of Instructions
• AND
• OR
Both involve register A and a word in memory, with the
result being left in the register. Condition flag is not
affected.
• COMP
Compares the value in register A(<,>,=) with a word in
memory, this instruction sets a condition code CC to
indicate the result.
SIC Machine Architecture
Branch group of Instructions
• Write Data WD
• Data is sent to output device specified by the
memory.
SIC Machine Architecture
• Input and Output
• TIX
• Increments the content of X and compares its
content with memory
• Depending on the result the conditional flags are
updated
if (X) < (m) then CC = ‘<‘
if (X) = (m) then CC = ‘=‘
if (X) > (m) then CC = ‘>‘
SIC/XE Machine Architecture
• Memory
• Memory structure is same as that for SIC.
• 220 bytes in the computer memory.
• This increase leads to a change in instruction
format and addressing modes.
SIC/XE Machine Architecture
• More Registers
SIC/XE Machine Architecture
• Data Formats
• Floating-point data type of 48 bits
• frac: 0~1
• exp: 0~2047
• S(0=+ve , 1=-ve)
8
Format 1 (1 op
byte)
8 4 4
Format 2 (2
bytes) op r1 r2
6 1 1 1 1 1 1 12
Format 3 (3 op n i x b p e displacement
bytes)
6 1 1 1 1 1 1 20
Format 4 (4 op n i x b p e address
bytes)
SIC/XE Machine Architecture
• The Format 3 and Format 4 instructions have 6
flag bits:-
n – indirect addressing
I – immediate addressing
x – indexed addressing
b – base relative
p – PC relative
e – (0 – Format 3 1 – Format 4)
SIC/XE Machine Architecture
• Additional Addressing Modes
SIC/XE Machine Architecture
Addressing modes
Base relative (n=1, i=1, b=1, p=0)
Program-counter relative (n=1, i=1, b=0, p=1)
Direct (n=1, i=1, b=0, p=0)
Immediate (n=0, i=1, x=0)
Indirect (n=1, i=0, x=0)
Indexing (both n & i = 0 or 1, x=1)
Extended (e=1)
SIC/XE Machine Architecture
● Base Relative Addressing Mode
(STCH BUF,X)
n i x b p e
opcode 1 1 1 0 disp
GAMMA[I]=ALPHA[I]+BETA[I]
I=0 to 100
SIC/XE Programming Example
SIC Programming Example
to read 1 byte of data from device F1
and copy it to device 05
SIC Programming Example
To read 100 bytes of record from an input device into
memory
SIC/XE Programming Example
SUM START 3000
FIRST LDX ZERO
LDA ZERO
LOOP ADD TABLE, X
TIX COUNT
JLT LOOP
STA TOTAL
MULF ZERO
ADD ONE
RSUB
TABLE RESW 1000
COUNT RESW 1
ZERO WORD 0
TOTAL RESW 1
STR1 BYTE C’KLETECH’
STR2 BYTE X’F1’
END
ANY QUESTIONS??