CA Lecture 2
CA Lecture 2
Computer Architecture
Faculty: Shoib Ahmed Shourav
United International University
Preview of the last class
Microprocessor
without
Interlocked
Pipeline
Stages (MIPS)
• Assembler
• A program that translates a symbolic version of instructions into the binary
version.
• Assembly Language
• A symbolic representation of machine instructions.
• Five classic components
• Input
• output
• Memory
• Data-path
• Control
• Processor
Memory
• C code: a = b + c + d;
• MIPS code: add a, b, c
add a, a, d
• Design principle: Hardware implementation is simplified via regularity
• Operands must be registers in MIPS
• Register set of a machine is a limited number of special locations built directly into the hardware.
MIPS Assembly Language
• 32 registers in MIPS
• Registers are numbered from 0 to 31
• Each register can be referred to by number or name
• Number references: $0, $1, … $30, $31
• By convention, each register also has a name to make it easier to code
• $t0 -$t7 for temporary variables ($8-$15)
• $ra for return address
• Each MIPS register is 32 bits wide
• Groups of 32 bits called a word in MIPS
MIPS Assembly Language
• C code:
• f = (g + h) –(i + j);
MIPS Assembly Language
MIPS Assembly Language
• Arithmetic:
• add, addi, sub
• Why not subi?[Hints 2’s complement]
• Logical:
• and, or, nor, andi, ori, sll, srl
• Why not “not” instruction?
• Why not “nori” instruction?
Any Question?