ECE 30
Introduction to Computer Engineering
Lab #2 Solutions
Spring 2014
Note: the more advanced programming problems often dont have one single right solution; in
that case, we suggest a possible solution.
1. Solution:
a.
li
add
$a0, 44
$a1, $a0, $zero
b
ECE 30
Introduction to Computer Engineering
Solutions to Lab Problems #1
Spring 2014
1. We will denote the execution time as ET.
a. False
ETA for Program 1 = 1 sec
ETB for Program 1 = 5 sec
ETA < ETB . Thus, A is faster than B.
b. True
ETA for Program 2 =
ECE 30
Introduction to Computer Engineering
Solutions to Lab Problems #1
Spring 2012
1. We will denote the execution time as ET.
a. False
ETA for Program 1 = 1 sec
ETB for Program 1 = 5 sec
ETA < ETB . Thus, A is faster than B.
b. True
ETA for Program 2 =
ECE 30
Introduction to Computer Engineering
Quiz #1
April 21, 2014
Name
Student ID
Signature
Lab section
Your score
1
2
3
4
Total
out of
8
8
9
7
32
You may only use the MIPS assembly instructions listed below. Do not use any other instructions!
arithmetic
ECE 30
Introduction to Computer Engineering
Lab #5 Problems
Spring 2014
1. Simplify the following logic functions using a 3-variable K-Map:
a) F = XY Z + XY Z + XY Z
b) F = XY Z + XY Z + XY Z + XY Z + XY Z + XY Z
2. Shown below is the truth table for the
ECE 30 Introduction to Computer Engineering
Quiz 1 January 19, 2005
Name Student ID Signature
Solution
Your score 1 2 3 Total
out of 6 6 8 20
You may only use the MIPS assembly instructions listed below. Do not use any other instructions! arithm
ECE 30
Introduction to Computer Engineering
Example Problems, Set #2
Spring 2012
1. Let A be an array of integers (each represented by a 32-bit word), with the base address of
A stored in register $1. Assume that the constant c is stored in register $2. I
ECE 30
Introduction to Computer Engineering
Lab #5 Problems
Spring 2015
1. Simplify the following logic functions using a 3-variable K-Map:
a) F = XY Z + XY Z + XY Z
b) F = XY Z + XY Z + XY Z + XY Z + XY Z + XY Z
2. Shown below is the truth table for the
ECE 30
Introduction to Computer Engineering
Lab #2 Solutions
Spring 2012
Note: the more advanced programming problems often dont have one single right solution; in
that case, we suggest a possible solution.
1. Solution:
a.
li
add
$a0, 44
$a1, $a0, $zero
b
ECE 30 Introduction to Computer Engineering
Quiz 2 February 2, 2005
Name Student ID Signature Your score 1 2 Total out of 10 10 20
You may only use the MIPS assembly instructions listed below. Do not use any other instructions! arithmetic add addu
ECE 30
Introduction to Computer Engineering
Lab #2 Solutions
Spring 2013
Note: the more advanced programming problems often dont have one single right solution; in
that case, we suggest a possible solution.
1. Solution:
a.
li
add
$a0, 44
$a1, $a0, $zero
b
ECE 30
Introduction to Computer Engineering
Quiz #3 Solutions
May 27, 2014
Name
Student ID
Signature
Lab section
Your score
1
2
3
Total
1
out of
15
10
8
33
Shown above is a multi-cycle CPU. There are six special registers in this datapath: PC, IR, MDR, A,
ECE 30
Introduction to Computer Engineering
Example Problems, Set #5
Spring 2014
1. What decimal number does this twos complement binary number represent:
1111 1111 1111 1111 1111 1111 1110 11112 ?
2. What decimal number does this twos complement binary n
ECE 30
Introduction to Computer Engineering
Quiz #1 Solutions
April 20, 2015
You may only use the MIPS assembly instructions listed below. Do not use any other instructions!
arithmetic add
sub
addi
special
lui
slt
data
lw
transfer
sw
branch
beq
bne
jump
j
ECE 30
Introduction to Computer Engineering
Example Problems, Set #3
Spring 2014
Use the MIPS assembly instructions listed below to solve the following problems.
arithmetic
special
data
transfer
branch
jump
add
sub
addi
lui
slt
lw
sw
beq
bne
j
jal
jr
add
Introduction to SPIM
SPIM is a MIPS processor simulator which will allow you to view the inner workings of an R2000
processor as it runs assembly code. When you load a MIPS program into SPIM, it compiles the
program into machine language. Then you can eit
ECE 30
Introduction to Computer Engineering
Lab 3 solutions
Spring, 2014
You may only use the MIPS assembly instructions listed below. Do not use any other instructions!
arithmetic add
sub
addi
sll
special
lui
slt
data
lw
transfer
sw
branch
beq
bne
jump
j
ECE 30
Introduction to Computer Engineering
Lab #5 Solutions
Spring 2014
1. Solution:
a)
In simplied form, F = XY + YZ.
b)
In simplied form, F = X + Z.
1
2. Solution:
(a) F = A B C + A B C + A B C + A B C
(b) F = (A + B + C) (A + B + C) (A + B + C) (A + B
ECE 30
Introduction to Computer Engineering
Solutions to Lab Problems #1
Spring 2013
1. We will denote the execution time as ET.
a. False
ETA for Program 1 = 1 sec
ETB for Program 1 = 5 sec
ETA < ETB . Thus, A is faster than B.
b. True
ETA for Program 2 =
ECE 30
Introduction to Computer Engineering
Quiz #2 Solutions
May 12, 2014
You may only use the MIPS assembly instructions listed below. Do not use any other instructions!
arithmetic
logical
add
addu
sub
subu
addi
addiu
mult
multu
div
divu
mfhi
mflo
and
o
ECE 30
Introduction to Computer Engineering
Example Problems, Set #1
Spring 2014
1. Consider the following two machines and programs:
Program
1
2
Time on M1
10 seconds
3 seconds
Time on M2
5 seconds
4 seconds
The following additional measurements are made
ECE 30
Introduction to Computer Engineering
Lab Problems #1
Spring 2015
1. The following measurements of execution time were taken.
Program
Program 1
Program 2
Computer A
1 sec
6 sec
Computer B
5 sec
1 sec
Which of the following statements are true?
a. B
ECE 30
Introduction to Computer Engineering
Programming Project Merge Sort Algorithm
Due: Thursday, June 6, 2013
Oce Hours of the Project TA (Daniel Heineck)
Week of May 6th:
Monday: 4 - 6 pm
Thursday: 10 - 11 am
Friday: 9 - 11 am
Week of May 13th:
ECE 30
Introduction to Computer Engineering
Example Problems, Set #3
Spring 2013
Use the MIPS assembly instructions listed below to solve the following problems.
arithmetic
special
data
transfer
branch
jump
add
sub
addi
lui
slt
lw
sw
beq
bne
j
jal
jr
add
ECE 30
Introduction to Computer Engineering
Study Problems, Set #2
Spring 2012
1. Add comments to the following MIPS code and describe in one sentence what it computes.
Assume that $a0 and $a1 are used for the input and both initially contain the positive
ECE 30
Introduction to Computer Engineering
Example Problems, Set #1
Spring 2012
1. Consider the following two machines and programs:
Program
1
2
Time on M1
10 seconds
3 seconds
Time on M2
5 seconds
4 seconds
The following additional measurements are made
ECE 30 Introduction to Computer Engineering
Final Exam March 18, 2005
Name Student ID Signature
Solution
1 2 3 4 5 Total
Topic Your score out of Assembly language 10 Computer arithmetic 10 CPU design 10 Cache organization 10 Virtual memory 10 50
ECE 30
Introduction to Computer Engineering
Lab Problems #1
Spring 2012
1. The following measurements of execution time were taken.
Program
Program 1
Program 2
Computer A
1 sec
6 sec
Computer B
5 sec
1 sec
Which of the following statements are true?
a. B
ECE 30
Introduction to Computer Engineering
Programming Project cfw_Maximum Subarray Sum Problem
1. Project Description
The goal of this project is to implement the maximum sum subarray problem in
MIPS. The maximum subarray sum takes as inpu