Study Guides (380,000)
CA (150,000)
UTSG (10,000)
ECE (10)

ECE385H1 Study Guide - Final Guide: University Of Toronto Faculty Of Applied Science And Engineering, Endianness, Parity Bit

Electrical & Computer Engineering
Course Code
Robert Brym
Study Guide

This preview shows pages 1-3. to view the full 9 pages of the document.
NAME_______________________ or ID#____________________ (in case pages get detached)
Exam Type: D
A. Moshovos, G. Steffan
This is a type D exam. You are allowed to use the course
textbook (any version), the lab manual (any version) and one
double-sided A4 (or 8.5”x11”) sheet with notes. Calculators
are not permitted.
Last Name (Print): __________________
First Name: ________________________
Student Number: ___________________
Marks Max.
A 30
B 30
C 30
D 10
Total 100
State your assumptions. Show your work. Comment your code. Use
your time wisely as not all questions will require the same
amount of time. If you think that assumptions must be made to
answer a question, state them clearly. If there are multiple
possibilities, comment that there are, explain why and then
provide at least one possible answer and state the
corresponding assumptions.
There are 4 questions for a total of 100 marks. There are 1
es in the exam.

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

NAME_______________________ or ID#____________________ (in case pages get detached)
(A) [30 marks] Short Answer
1) Byte Order [6 marks] Assume that D0 is initialized to $A1B2C3D4 before each of the
following three instruction pairs executes. Give the value (in hex) of the least-significant byte
of D1 after each of the following pairs of instructions have executed, for both little and big
endian machines (i.e., give only one value for each box):
Little Endian Big Endian
Move.l d0,$1000
Move.l $1000,d1
$D4 $D4
Move.w d0,$1000
Move.b $1001,d1
$C3 $D4
Move.l d0,$1000
Move.w $1002,d1
$B2 $D4
2) [6 marks] Assuming the following initialization:
a0 = $00050000
d0 = $00000120
Write the effective address (i.e., the memory address accessed) of the destination (in hex)
for each of the following, assuming the initialization above for each row (ie., all rows are
Instruction Effective Address
add.b d0,$a0 $a0 (the hex value)
add.w d0,-12(a0) $4FFF4
add.l d0,-(a0) $4FFFC
add.w d0,(a0)+ $50000
3) [6 marks] The following 68K assembly sequence:
foo cmp.l d0, d1
bgt boo
sub.l d1, d0
boo sub.l d1, d0
implements one the following C statements:
(a) if (a > b) { b = b – a; } else {b = b – 2*a; }
(b) if (b > a) { b = b – a; } else {b = b – 2*a; }
(c) if (a == b) { b = a – b; } else { b = b – a; }
(d) if (a > b) { a= a – b; } else { a= b – a; }
(e) None of the above
Which one? Circle your answer. Figuring out which registers a and b map to is part of the

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

NAME_______________________ or ID#____________________ (in case pages get detached)
4) [6 marks] Assume the following configuration of a serial connection: 20K BAUD (bit cells
per second), 8 bits including one parity bit, even parity, 1 stop bit.
a) If I transmit the ASCII encoding for 'C' (1000011 in binary), what bit sequence would I
expect to receive for the frame? I.e., fill in the signal diagram below between the idle periods,
clearly showing zeros and ones.
First is the START BIT. Then the 7 data bits for C starting from
bit 0, then the parity which is 1 so that all the number of ones
sent is even and finally the stop bit: 10 bits total: 0110000111
b) What is the effective data rate of this connection?
Each 7 bits of actual data needs an additional 3 bits during
transmission (start/stop/parity bits). Hence 20000 / 10 * 7 =
14000 bits/sec. Answers with 8 data bits will be considered
correct and so will be answers with 20K = 1024*20.
5) [6 marks] While we have not discussed this in our lectures, in C one might declare the
following array of pointers to integers:
int *array[100];
Assuming the array has already been initialized, give the assembly
instructions to implement the following statement:
x = x + *(array[i]);
Assume the following: x is in d0; i is in d1; ARRAY is a label defining the base address of
array; an int is a long word.
add.l d1, d1 ; i = 2 * i
add.l d1, d1 ; i = 4 * i
movea.l #ARRAY, a0 ; a0=base address
adda.l d1, a0 ; a0 = address of array[i]
movea.l (a0),a0 ; a0 = array[i]
add.l (a0), d0 ; x = x + *array[i]
(idle) (idle)
You're Reading a Preview

Unlock to view full version