.data
st1: .asciiz "\nNumber in binary:\n"
st2: .asciiz "\nPlease enter first Integer:"
st3: .asciiz "\nPlease enter the second Integer:"
st4: .asciiz "\nYour answer is: "
st5: .asciiz "\n-\n"
st6: .asciiz "\n"
.text
main:
#Prompt user to input first int
Homework
Question 1: Please convert -910 to signed binary
Question 2: Convert following C code to MIPS code
A[i+1] = g + A[12] + 1;
g, i are assigned to $s0, $s1 respectively
Base address of A is in $s2
Submit your answer as a PDF file to the dropbox
CSE2
Homework : Due Feb. 16th
Write a MIPS program that convert the input string to lower
case string, then print out the lower case string.
Input: Hello WOrlD. ThIS Is a MESs!
Output: hello world! this is a mess!
Hint:
In ascii code, capital case characters a
Lecture 2: Introduction
CSCE 212
Kareem Abdelfatah
Levels of Transformation
How do we ensure problems are solved by electrons?
(Richard Hamming)
Problem
Sorting array, compare two strings,.
Algorithm
Structure of the problem into steps by step procedure
(
Lecture 1: Introduction
CSCE 212
Kareem Abdelfatah
Introduction
CSCE 145/206
How
C+/Java
as a model of computation
Programmers view of a
computer system works
does an assembly program
end up executing as digital logic?
What happens in-between?
How is a co
Lecture 3: Introduction to Assembly
CSCE 212
Kareem Abdelfatah
The von Neumann Model
Model for designing and building computers, based on the following three
characteristics:
1)The computer consists of four main sub-systems:
Central processing unit
ALU (
Lecture 4: Assembly
CSCE 212
Kareem Abdelfatah
Arithmetic Operations
Add and subtract, three operands
Two sources and one destination
add a, b, c # a = b + c
All arithmetic operations have this form
Design Principle 1: Simplicity favors regularity
Requir
CSE 212- Introduction to Computer Architecture, Spring 2016
Tentative Syllabus
Meeting time and location: TR 6:00PM-7:15PM, SWGN 2A31
Course Objective: After successfully passing this course, students should be able to:
1. Describe the microstructure of a
Project 1
Sort array using Bubble sort algorithm.
1) First ask the user how many elements of his/her array.
2) Then, read the integer array elements as input from the User.
3) Then, print out the array before the sorting
4) Apply Bubble sort algorithm on
Lecture 10: Performance
CSCE 212
Dazhou Guo
02/14/16
Defining Performance
One computer performs better than the other?
Response time or execution time: the time between the
start and the end of a task
Throughput or bandwidth: the total amount of work do
Input:
Project II
A predened array. The size of the array is 100
Output:
1) The sum of all even digits
2) The sum of all odd digits
Requirements:
Please use loop unrolling & rescheduling to optimize your code.
68
5
29
60 51 100 39
55
88 76 86
22
73
63 66
Homework 4
Part 1:
Use non-forwarding
5-stage pipeline to
calculate total CPIs for
the following MIPS
code.
CPIs for each instruction
mul 4 clock cycles in
execution stage
add/sub 1 clock cycles in
execution stage
sw/lw 2 clock cycles in
accessing memory
Lecture 12: Instruction
Format
CSE 212
Dazhou Guo
Representing Instructions
Instructions are encoded in binary
Called machine code
MIPS instructions
Encoded as 32-bit instruction words
Small number of formats encoding operation
code (opcode), register n
Chapter 4
The Processor
Introduction
Simple subset, shows most aspects
Memory reference: lw, sw
Arithmetic/logical: add, sub, and, or, slt
Control transfer: beq, j
We will examine two MIPS implementations
A simplified version
A more realistic pipelin
Lecture 7: Assembly
CSCE 212
Kareem Abdelfatah
CSE212
02/03/16
For-Loop Practice
C Code
for (i = 0; i<a; i+)cfw_
b[i] = i;
a in $s0, i in $s1, and base
address of b[] in $s2
CSE212
addi $s1, $zero, 0 # set i = 0;
loop1:
blt $s1, $s0, loop2 # if i<a, go t
Lecture 8: Assembly
CSCE 212
Kareem Abdelfatah
CSE212
02/10/16
MARS Interface
CSE212
02/10/16
Write A Simple MIPS Script
C Code
MIPS Code
if (a>b) & (c=d)
e = 0;
else
e = f;
a = 2; b = 1 or 7;
c = 3; d = 3 or 4;
e = 5; f = 6;
addi $s0, $zero, 2
addi $s1,
Lecture 9: Assembly
CSCE 212
Kareem Abdelfatah
CSE212
02/09/16
Calendar
March 3, Thurs: Last day to drop a course or
withdraw without a grade of "WF" being
recorded
February 25, Thurs: First Midterm Exam.
February 16, Tues: Homework 2 Due.
February 27, Th
CSCE 212: Introduction to Computer Architecture
1. Course number and name: CSCE 212: Introduction to Computer Architecture
2. Credit: 3-hrs; Contact: 3 lectures of 50 minutes each per week
3.
Instructor: Fall 2010: Larry M. Stephens
Spring 2011: Manton Ma
CSCE 212: FINAL EXAM
Spring 2009
Name (please print):_
Total points: _/120
Instructions
This is a CLOSED BOOK and CLOSED NOTES exam. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor
CSCE 212: Exam 1
Name (please print):_
Fall 2009
Total points: _/60
Instructions
This is a CLOSED BOOK and CLOSED NOTES quiz. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor if you
CSCE 212: Quiz 4
Spring 2009
Name (please print):_
Total points: _/40
Instructions
This is a CLOSED BOOK and CLOSED NOTES quiz. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor if yo
CSCE 212: Quiz 5
Fall 2009
Name (please print):_
Total points: _/30
Instructions
This is a CLOSED BOOK and CLOSED NOTES quiz. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor if you
CSCE 212: FINAL EXAM
Name (please print):_
Fall 2009
Total points: _/100
Instructions
This is a CLOSED BOOK and CLOSED NOTES exam. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the proctor if yo
CSCE 212: Exam 1
Name (please print):_
Spring 2009
Total points: _/60
Instructions
This is a CLOSED BOOK and CLOSED NOTES quiz. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor if yo
CSCE 212: Exam 1
Name (please print):_
Spring 2010
Total points: _/110
Instructions
This is a CLOSED BOOK and CLOSED NOTES quiz. However, you may use
calculators, scratch paper, and the green MIPS reference card from your textbook. Ask
the instructor if y