Sunday 15 December 2013


Microprocessor
http://bits.wikimedia.org/static-1.23wmf5/skins/common/images/magnify-clip.png
microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistorsresistors, and diodes that work together. Microprocessors help to do everything from writing to searching the Web. Everything a computer does is described by lots of precise instructions, and microprocessors carry out these instructions at incredible speed—many millions of times a second.
The majority of microprocessors are used in embedded systems for mobile phonescars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.




Microprocessor operation
Like other Central processing units, microprocessors use three steps commonly called Fetch, Decode, and Execute.
·        Fetch step
-      an instruction copied from the computer memory into the microprocessor.

·        Decode step
-      the microprocessor figures out what operation the instruction is meant to do.

·        Execute step
-      this operation is performed.


Operations can be very simple, like adding two numbers, or complicated, like copying a series of letters and numbers (called a string) from one place in the computer's memory to a different place.


The Organization of a Computer

Any computer can perform the four basic operations of Input, Processing, Output, and Storage (IPOS). These operations constitute the IPOS cycle. The internal design or structure of a computer may differ from one system to another though the basic operations remain the same. Figure 1.1 provides a block diagram of a computer. The figure displays all the functional units of a computer which carry out the basic computer operations. The lines in the figure indicate the flow of instructions and data, while the Control Unit and the Arithmetic/Logical Unit together direct the flow of control in the central processing unit.


Input Unit
Data and instructions are entered into the computer through the input unit to get processed into information. Input devices like the keyboard, the mouse, or the microphone are used to enter the data. The data is entered in various forms depending on the type of input devices. For instance, a keyboard can be used to input characters, numbers, and certain symbols; a mouse is a device that has an on-screen pointer that enables the users to select items and choose options; a microphone can be used if the user wishes to enter instructions by making a voice entry.
Regardless of the ways in which the input devices receive the inputs, the input interfaces convert them into binary codes, i.e., 0s and 1s, as the primary memory of the computer is designed to accept data only in this format. Several advancements can be seen in input devices with devices like cordless keyboards, optical mouse, laser mouse, cordless mouse, etc., being introduced in the market.
Central Processing Unit
The actual processing of the data is carried out in the Central Processing Unit (CPU), which is the brain of computer. The CPU stores the data and instructions in the primary memory of the computer, called the Random Access Memory (RAM) and processes them from this location. The Arithmetic Logic Unit (ALU) and the Control Unit (CU) are the two subcomponents of the CPU. The ALU carries out the arithmetic and logical operations while the CU retrieves the information from the storage unit and interprets this information. The CPU also consists of circuitry devices called cache and registers. 

Arithmetic logic unit
The data and instructions stored in the RAM are transferred to the ALU for processing. The ALU performs the logical and the arithmetic operations on the data and the results are temporarily stored in the RAM. After the processing, the final results are stored in the secondary memory, i.e., the storage unit, and are released through an output device.
Control unit
The CU obtains the program instructions stored in the primary memory of the computer, interprets them, and issues signals that result in their execution. It helps in maintaining order and directs the operations of the entire system. It selects, interprets, and ensures the proper execution of the program instructions.
Processors
Some computers use more than one processor for processing in order to reduce the load on a single processor.
Output Unit
The output unit passes on the final results of computation to the users through the output devices like the monitor, printer, etc. A monitor displays the final results of the processed data on the screen while a printer can be used for obtaining the output in a printed format. These output devices link the computer with the users. The output interfaces convert the binary code produced by the computer into the human-readable form.




Storage Unit

Before the actual processing takes place, the data and instructions that enter the computer system have to be stored internally. Also, the final results generated by the computer after processing has to be stored before being sent to the output unit. The storage unit of a computer system is designed to store the data generated at various stages of processing. Storage media like hard disks, floppy disks, etc., aid in storing the data in various forms. The hard disk is an integral part of the computer system. It is also referred to as hard drive, disk drive, or hard disk drive. The hard disk provides a large amount of storage space for the programs and data. Computers these days feature a hard disk that has several gigabytes of storage capacity. The floppy disk drives, CD-ROM/CD-RW drives, DVD drives, and USB ports enable the user to store and exchange data with others using storage media like floppy disks, compact discs (CDs), digital video discs (DVDs), and pen drives.


~~ COA is FUN ~~


PREPARED BY :
< MOHD SYUKRI BIN MAT LAZIM >
< B031310013 >

Thursday 12 December 2013

INTRODUCTION TO MIPS R2000

Assalamualaikum and very good morning guys.Today i will explain about MIPS R2000 and its function and process that occur.

Figure 1


  • MIPS or Microprocessor without Interlocked Pipeline Stages is a reduced instruction set computer (RISC) instruction set architecture.
  • Figure 1 is the first model,R2000 was announced in 1985 had 32-bit purpose register.
  • MIPS processor compose of an integer processing unit (CPU) and collection of coprocessor that perform subsidiary tasks.

Now i will explain about the process occur ;

1)Memory Allocation

Figure 2
Figure 2 show memory allocation is the act of reserving a chunk of memory for some set of data.Memory contains bytes.Some of those bytes are instructions ,and some of those bytes are data.MIPS processors typically divide memory into three parts:

  • Text segment
  • Data segment
  • Stack segment


2)Data Alignment
Its value and the storage location(address).The address of a data can be evenly divisible by 1,2,4, or 8.In other words,data object can have 1 byte,2 byte,4 byte,8 byte alignment.

Figure 3:MIPS data sizes
3)Register

The MIPS microprocessor contains 32 user accessible registers that are numbered as 0-31.
  • Register are 32 bits for MIPS.
  • Register $1,$26,$27,$29 are reserved for special purpose by the assembler,compiler and operating system.
  • Register $0 is hard wired to the value zero , and $31 is the link register for jump and link instructions but can be used with other instructions with caution.
Figure 4:MIPS register conventions


*** Coprocessor 0 contains exception control registers that handles exception.
SPIM doesn't implement all of the coprocessor 0's registers , since they are not much useful in a simulator or part of the memory system , which is not implemented. However, it does provide trap registers as show as below.


Figure 5:Trap register

Figure 6:Exception code register


That all for today,i will explain more details on post later.
Thank you.


<Mohamad Hazarul Hazrin>
<B031310478>

NUMBER SYSTEM CONVERSION


 Ø§Ù„سَّلاَÙ…ُ عَÙ„َÙŠْÙƒُÙ…ْ ÙˆَرَØ­ْÙ…َØ©ُ اللهِ ÙˆَبَرَÙƒَاتُÙ‡ُ

NUMBER SYSTEM CONVERSION

hello,today i gonna teach you how to convert :
  • decimal - binary 
  •  binary - decimal 
  •  decimal - hexadecimal 
  •  hexadecimal - decimal


1 . How to convert decimal to binary

In order to convert decimal number x to binary number:
For decimal number x:
  1. Get the highest power of 2 that is less than the decimal number x:
    2n < x, (n=1,2,3,...)
  2. The high binary digit is equal 1:
    dn = 1
  3. Calculate the difference Δ of the number x and he power of 2, 2n:
    Δ = x - 2n
  4. Repeat step #1 with the difference until the result is 0.

for the example :
         Convert x=13 to binary.

Solution :

n=3, 23=8 < 13
n=4, 24=16 > 13
So
= 3
d3 = 1
Δ = 13 - 23 = 5
= 2, x = Δ = 5
d2 = 1
Δ = 5 - 22 = 1
= 1, x = Δ = 1
d2 = 0
= 0, x = Δ = 1
d0 = 1
Δ = 1 - 1 = 0
(d3d2d1d0)  = 1101
So 13 in decimal is equal to 1101 in binary:
x = 1310 = 11012


                                     this video shown to convert decimal to binary in easier way.


2 . How to convert binary to decimal 

The decimal number is equal to the sum of powers of 2 of the binary number's '1' digits place:
binary number:111001
power of 2:252423222120
1110012 = 1·25+1·24+1·23+0·22+0·21+1·20 = 57

                                                        this video is show how to convert binary to decimal

3 . How to convert from decimal to hexadecimal

For decimal number x:
  1. Get the highest power of 16 that is less than the decimal number x:
    16n < x, (n=1,2,3,...)
  2. The high hex digit is equal to the integer if the decimal number x divided by the highest power of 16 that is smaller than x:
    dn = int(x / 16n)
  3. Calculate the difference Δ of the number x and the hex digit dn times the power of 16, 16n:
    Δ = x - dn × 16n
  4. Repeat step #1 with the difference result until the result is 0.


for example :


Convert x=603 to hex:
n=2, 162=256 < 603
n=3, 163=4096 > 603
So
= 2
d2 = int(603 / 162) = 2
Δ = 603 - 2×162 = 91
= 1, x = Δ = 91
d1 = int(91 / 161) = 5
Δ = 91 - 5×161 = 11
= 0, x = Δ = 11
d0 = int(11 / 160) = 1110 = B16
Δ = 11 - 11×160 = 0
(d2d1d0)  = 25B
So
x = 60310 = 25B16

                                                   this video shown how to convert decimal to hexadecimal


4 . How to convert from hexadecimal to decimal 

         A regular decimal number is the sum of the digits multiplied with its power of 10.


Example #1 :

137 in base 10 is equal to each digit multiplied with its corresponding power of 10:
           13710 = 1×102+3×101+7×100 = 100+30+7
Hex numbers are read the same way, but each digit counts the power of 16 instead of power of 10.
Multiply each digit of the hex number with its corresponding power of 16.


Example #2 :

3B in base 16 is equal to each digit multiplied with its corresponding power of 16:
          3B16 = 3×161+11×160 = 48+11 = 59


Example #3 :

E7A9 in base 16 is equal to each digit multiplied with its corresponding power of 16:
          E7A916 = 14×163+7×162+10×161+9×16= 57344+1792+160+9 =59305


                                        this video shown how to convert hexadecimal to decimal



2's complement number
  • Positive Numbers
- Positive 2's complement numbers are represented as the simple binary.
  • Negative Numbers
- Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude equals zero.

Integer2's Complement
SignedUnsigned
550000 0101
440000 0100
330000 0011
220000 0010
110000 0001
000000 0000
-12551111 1111
-22541111 1110
-32531111 1101
-42521111 1100
-52511111 1011
Note:  The most significant (leftmost) bit indicates the sign of the integer; therefore it is sometimes called the sign bit.
If the sign bit is zero,
          then the number is greater than or equal to zero, or positive.
If the sign bit is one,
then the number is less than zero, or negative.

Calculation of 2's Complement

To calculate the 2's complement of an integer, invert the binary equivalent of the number by changing all of the ones to zeroes and all of the zeroes to ones (also called 1's complement), and then add one.
For example,
0001 0001(binary 17)   such that   1110 1111(two's complement -17)
 
NOT(0001 0001) = 1110 1110  (Invert bits)
1110 1110 + 0000 0001 = 1110 1111  (Add 1)

2's Complement Addition

Two's complement addition follows the same rules as binary addition.
For example,
5 + (-3)  =  2     0000 0101 = +5
+ 1111 1101
 = -3
  0000 0010 = +2

2's Complement Subtraction

Two's complement subtraction is the binary addition of the minuend to the 2's complement of the subtrahend (adding a negative number is the same as subtracting a positive one).
For example,
7 - 12  =  (-5)     0000 0111 = +7
+ 1111 0100
 = -12
  1111 1011 = -5

2's Complement Multiplication

Two's complement multiplication follows the same rules as binary multiplication.
For example,
(-4) × 4  =  (-16)     1111 1100 = -4
× 0000 0100
 = +4
  1111 0000 = -16

2's Complement Division

Two's complement division is repeated 2's complement subtraction. The 2's complement of the divisor is calculated, then added to the dividend. For the next subtraction cycle, the quotient replaces the dividend. This repeats until the quotient is too small for subtraction or is zero, then it becomes the remainder. The final answer is the total of subtraction cycles plus the remainder.
For example,
7 ÷ 3  =  2 remainder 1     0000 0111 = +7     0000 0100 = +4
+ 1111 1101
 = -3+ 1111 1101
 = -3
  0000 0100 = +4  0000 0001 = +1 (remainder)

Sign Extension

To extend a signed integer from 8 bits to 16 bits or from 16 bits to 32 bits, append additional bits on the left side of the number. Fill each extra bit with the value of the smaller number's most significant bit (the sign bit).
For example,
Signed Integer8-bit Representation16-bit Representation
-11111 11111111 1111 1111 1111
+10000 00010000 0000 0000 0001


posted by < MOHD SYUKRI BIN MAT LAZIM >

               < B031310013 >

MIPS (DATA REPRESENTATION)

DATA REPRESENTION

ASCII CODE CHART
Data Representation

In MIPS, we must understand how a computer represent a data from the viewside of MIPS programming language. This is important because it help us to understand how to perform computations and also manipulate data in MIPS program.

All data on digital computers is represented as a sequence of 0s and 1s. This includes numeric data, text, executable files, images, audio, and video. The ASCII standard associates a seven bit binary number with each of 128 distinct characters.

Character Representation


ASCII codes table - Format of standard characters


1 byte has 8 bits, and a character can be represented with one byte. Most of the computer offer 8-bit byte to represent characters following the ASCII(American Standard code for Information Interchange) as the standard for character representation. Above is the table of ASCII.

The ASCII bit patterns is assembled and to be placed in memory. For example:
.asciiz "X Y"  The bit pattern that will produced in object module is
     58 20 59 00
For number represent hexadecimal system, the front of each number can be written as 0x. For example for character "X", it corresponds to bit pattern 0x58, while 0x00 is NUL, which used by the assembler to show the end of string character. For "X Y", it can be write also as
.byte    88 32 89 00

Number Representation
In MIPS, number did not represented in binary system but in decimal or hexadecimal system. In order to insert number to a register, first we need to know the kind of number system which we want to write in the program.
Example, if want to load 16 into register $4, we have two ways to represent the decimal 16.
1. ori $4, $0, 16  (in decimal system)
2. ori $4, $0, 0x10  (in hexadecimal system)
We need to choose the number system using when want to load number into register.

MUHAMMAD ARIF BIN OMAR
B031310411

Universal gate (nand and nor)

 UNIVERSAL GATE

NAND gate as Universal Gate

Symbol of NAND Gate
Symbol of NAND Gate

The above diagram is of a two input NAND gate. The first part is an AND gate and second part is a dot after it represents a NOT gate. So it is clear that during the operation of NAND gate, the inputs are first going through AND gate and after that the output is reversed and we get the final output. Now we will look at the truth table of NAND gate.
We will consider the truth table of the above NAND gate i.e. a two input gate. The two inputs are A and B.
ABOUT
001
101
011
110
Now we will see how this gate can be used to make other gates.
Realization of NOT gate by NAND gate
Realization of NOT gate by NAND gate

This is the circuit diagram of a NAND gate used to make work like a NOT gate, the original logic gate diagram of NOT gate is given beside.
universal nand gate
The above diagram is of an OR gate made from combinations of NAND gates, arranged in a proper manner. The truth table of an OR gate is also given beside the diagram. Now we will see the design of an AND gate from NAND gates.
universal nand gate
The above diagram is of an AND gate made from NAND gate. So we can see that all the three basic gates can be made by only using NAND gates, that’s why this gate is called Universal Gate and it is appropriate.

NOR gate as universal gate

We have seen how NAND gate can be used to make all the three basic gates by using that alone. Now we will discuss the same in case of NOR gate.
universal nand gate
The above diagram is of an OR gate made by only using NOR gates. The output of this gate is exactly similar to that of a single OR gate. As we can see the circuit arrangement of OR gate using NOR gates is similar to that of AND gate using NAND gates.
universal nor gate
The above diagram as the name suggests is of AND gate using only NOR gate, again we can see that the circuit diagram of AND gate using only NOR gate is exactly similar to that of OR gate using only NAND gates. Now we will finally see how a NOT gate can be made by using only NOR gates.
universal nor gate
The above diagram is of a NOT gate made by using a NOR gate. The circuit diagram is similar to that of NOT gate made by using only NAND gate.
So, from the above discussion it is clear that all the three basic gates (AND, OR, NOT) can be made by only using NOR gate. And thus it can be aptly termed as Universal Gate.
MUHAMMAD ARIF BIN OMAR
B031310411