CS334: Number Systems Mars simulator Lab 1_2. Ins.Ebtesam AL-Etowi Quizzes/Participation/Absence 5%...
-
Upload
logan-ball -
Category
Documents
-
view
224 -
download
0
description
Transcript of CS334: Number Systems Mars simulator Lab 1_2. Ins.Ebtesam AL-Etowi Quizzes/Participation/Absence 5%...
CS334: Number Systems&& Mars
simulator Lab 1_2
Ins.Ebtesam AL-Etowi
Quizzes/Participation/Absence 5%
Logisim/MIPS Programming 5%
CPU Design Project 10%
Email: [email protected]
Website: http://ebtesamal-etowi.weebly.com
cs334
Ins.Ebtesam AL-Etowi
Contents:•Exercises && HW solution.•Mars simulator.
Ins.Ebtesam AL-Etowi
Perform the binary subtraction. Did signed overflow occur? determined whether or not overflow occurred.11101000 11101000-00010011
Perform the binary addition. Did signed overflow occur? determined whether or not overflow occurred.
0110111000011010
Exercises
10001000
11101010111101101+
discarde
solution
• You are given the following two numbers in two’s complement representation:
Ins.Ebtesam AL-Etowi
solution
16 Bit Binary Hexadecimal Decimal1111111100111100 0xFF3C -196
1111 1111 1000 1000 0xFF88 -1201111111110000000 0xFF80 -128
1111111111111010 0XFFFA -6
0000000000010001 0x0011 171111111111100111 0xFFE7 -25
H.W solution
Ins.Ebtesam AL-Etowi
simulator Mars 4.2
Download the Mars simulator from http://www.cs.missouristate.edu/MARS/
Step 1:
Step 2: Launch the Mars simulator.
Step 3: Click on the Edit tab on the top left (in this pane, you'll see your assembly language program. Well, after you've created it).
Step 4: Go to File and click on New, to start a new program.
Step 5: Let's start with a simple program.
Ins.Ebtesam AL-Etowi
Ins.Ebtesam AL-Etowi
MIPS assembly language
• Registers
32 general-purpose registers
register preceded by $ in assembly language instruction• Program Structure
data declaration section followed by program code section
Ins.Ebtesam AL-Etowi
Cont..))MIPS assembly language
• Data Declarations
placed in section of program identified with assembler directive .data
• Code
placed in section of text identified with assembler directive .text
contains program code (instructions).
Cont..))MIPS assembly language
Ins.Ebtesam AL-Etowi
• Commentsanything following # on a line # This comment
• Data Declarationsformat for declarations: name: storage_type value(s(
example var1: .word 3 # create a single integer variable with initial value 3
Ins.Ebtesam AL-Etowi
• Arithmetic Instructionsmost use 3 operands. all operands are registers; no RAM or indirect addressing. operand size is word (4 bytes).
Cont..))MIPS assembly language
Ins.Ebtesam AL-Etowi
General Example
Ins.Ebtesam AL-Etowi
Ins.Ebtesam AL-Etowi