Sunday 16 December 2012

Topic 4 Subtopic 4 Data Representation

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.




SOON BOON JIAN
B031210199

4 comments:

  1. i can understand well.^^

    ReplyDelete
  2. Very detail. I like the way u express it out.

    ReplyDelete
  3. great job and very details.

    ReplyDelete
  4. wow!! is a clear explanation.

    ReplyDelete