You are on page 1of 38

Systems Programming

SIC/XE MACHINE ARCHITECTURE


What are the main components of PC?
Simplified Instructional Computer (SIC)

• Simplified Instructional Computer (SIC) is a hypothetical computer that has


hardware features that are often found in real machines. There are two versions
of this machine:
• SIC standard Model
• SIC/XE(extra equipment or expensive)
• Object programs for SIC can be properly executed on SIC/XE which is known as
upward compatibility (Upward compatibility is important because it means you
can move to a newer, larger, and more sophisticated computer
without converting your data.).
Simplified Instructional Computer (SIC)
SIC Machine Architecture
Memory
• The memory in a simplified instructional computer is organized as a
sequence of 8-bit bytes (1 byte = 8 bits).
• A word can be formed by 3 consecutive bytes (1 word = 24 bits). This
means that with the help of 24 bits, the simplified instructional
computer is designed.
• The lower number byte is used to address a word, and the addressing
starts by 0 byte. A computer memory contains 32768 bytes
SIC Machine Architecture
Registers
• The simplified instruction computer contains 5 types of registers. There is an
address associated with every register, and that address is known as the register
number.
• Each register can contain only 3 bytes that mean its size is 3 bytes.
• The size of the integer depends on the size of a register.
• There is no stack (A software stack is a collection of independent components
that work together to support the execution of an application.) in the SIC, and it
basically stores the address with the help of linkage register.
• If we want to write the recursive program, it is very difficult in SIC. If we write a
function call with more than one layer, the programmer is required to maintain
memory for return addresses.
SIC Machine Architecture
Registers
Mnemonic Number Special use

A (Accumulator) 0 This register is used to perform the arithmetic operations.

X (Index Register) 1 This register is used for addressing.

L (Linkage Register) 2 If there is a case of the subroutine, this register will save the return
address of an instruction.

PC (Program Counter) 8 This register is used to store the next instruction address, which will
be executed.

SW (Status Word) 9 This register is used to contain a variety of information such as


Conditional code (CC).
SIC Machine Architecture
Registers

•mode bit refers to user mode(value=0) or supervising mode(value=1). It occupies 1


bit.[0]
•state bit refers whether process is in running state(value=0) or idle state(value=1). It
also occupies 1 bit.[1]
•id bit refers to process id(PID). It occupies 3 bits.[2-5]
•CC bit refers to condition code i.e. It tells whether the device is ready or not. It
occupies2bits[6-7]
Mask bit refers to interrupt mask. It occupies 4 bits.[8-11]
•X refers to unused bit. It also occupies 4 bits.[12-15]
•ICode refers to interrupt code i.e. Interrupt Service Routine. It occupies the remaining
bits.[16-23]
SIC Machine Architecture
Data format
• Integers are stored in 24 bits binary number
• 2’s complement representation for negative values
■ -N  2n – N
■ e.g., if n = 4, -1  24 – 1 = (1111)2

• Characters are stored using 8-bit ASCII codes


• No floating-point hardware on the standard version of SIC
SIC Machine Architecture
Instruction format
• The instructions provided to computers help the computer perform a task. The
computers comprise instructions in groups called fields. Each field has different
information and different significance based on which the CPU decides what to
perform. The group of bits is used to perform a particular operation on the data.
These operations are called instruction code or instruction format. The data on
which operations are performed are stored in the computer. Different computers
have their own set of instructions. The CPU or processor takes all these
instructions from memory and decodes the bits to carry out the instructions.
SIC Machine Architecture
Instruction format
There is a total 24-bit format contained by all instructions in a simplified instructional
computer. The memory size of a simplified instructional computer is 215 sup bytes.

In this image, X is used to show the index address mode.


SIC Machine Architecture
Addressing modes
The SIC can only support 2 modes, which are described as follows:
•Indexed
•Direct
If X = 0, it will show the direct addressing mode. If X = 1, it will show the indexed
addressing mode, which is shown as follows

Mode Indicate Target address Calculation

Direct X=0 TA = address


Indexed X=1 TA = address + (X)
SIC machine architecture
■ Instruction set
■ Load and store instruction
■ LDA, LDX, STA, STX
■ Ex: LDA ALPHA  (A)  (ALPHA)
STA ALPHA  (ALPHA) 
■ Arithmetic instruction (A
■ involve register A and a word in memory)
■ ADD, SUB, MUL, DIV

■ Ex: ADD ALPHA  (A)  (A) + (ALPHA)


■ Comparison instruction
■ involves register A and a word in memory
■ save result in the condition code (CC) of SW
■ COMP
■ Ex: COMP ALPHA  CC (<,+,>) of (A)?(ALPHA)
SIC machine architecture
■ Instruction set (Cont.)
■ Conditional jump instructions
■ according to CC
■ JLE, JEQ, JGT
■ test CC and jump accordingly

■ Subroutine linkage instructions


■ JSUB
■ jumps and places the return address in register L
■ RSUB
■ returns to the address in L
SIC Machine Architecture
Input and Output
• I/O are 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 as an operand.
• There are 3 I/O instructions:
• Test Device (TD) tests whether the device is ready or not.
Condition code in Status Word Register is used for this purpose. If
cc is < then the device is ready otherwise the device is busy.
• Read data(RD) reads a byte from the device and stores it in register
A.
• Write data(WD) writes a byte from register A to the device
Applications of SIC
• Computer Architecture education: The SIC is an excellent tool for
teaching computer architecture and organization, as it provides a
simplified model of a computer system.
• Assembly language programming education: The SIC’s instruction set is
simple and easy to understand, making it a useful tool for teaching
assembly language programming.
• Compiler development: The SIC can be used as a platform for
developing compilers for high-level programming languages.
• Operating system development: The SIC’s simple architecture can be
used as a basis for teaching operating system development.
• Emulation and simulation: The SIC can be used for emulation and
simulation purposes, allowing software developers to test their
programs on a simulated computer system before deploying them on
real hardware.
SIC/XE Machine Architecture
Memory
• Memory consists of 8 bit-bytes and the memory size is 1
megabytes (220 bytes). Standard SIC memory size is very small.
• This change in the memory size leads to change in the
instruction formats as well as addressing modes.
• 3 consecutive bytes form a word (24 bits) in SIC/XE architecture.
• All address are byte addresses and words are addressed by the
location of their lowest numbered byte.
SIC/XE Machine Architecture
Registers
• There are 9 registers
• The 5 registers of standard SIC(A, X, L, PC, SW)
• 4 Additional registers
SIC Machine Architecture
Data format
• Integers are stored in 24 bits binary number
• 2’s complement representation for negative values
• Characters are stored using 8-bit ASCII codes
• floating-point is represented as 48-bit
SIC Machine Architecture
Instruction format
• 15 bit address field no longer fit
• Two solutions
1- relative addressing (Format 3 instruction)
2- 20 bit address field (Format 4 instruction)
• Instructions do not reference memory at all ( Format 1 and
Format 2)
SIC/XE Machine Architecture
Instruction format
SIC Machine Architecture
Addressing modes
• Two addressing mode by setting x bit in the instruction

• (X) represents the contents of register x


SIC Machine Architecture
Instruction set
• All old instructions beside other new ones
• Load and store new registers(LDB, STB,…)
• Floating point instructions (ADDF, SUBF, MULF, DIVF)
• Register to register arithmetic instructions (ADDR, SUBR, MULR, DIVR)
• REVOEW APPENDIX A IN THE REFERENCE BOOK
SIC Machine Architecture
Input and Output
• I/O are 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 as an operand.
• Test Device (TD): tests whether the addressed device is
ready to send or receive
• < ready = not ready
• Read Data (RD)
• Write Data (WD)
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
• Given the object code.
• The is the value of the register?
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
SIC/XE Machine Architecture
Addressing modes Example

You might also like