Docsity

4 Problems on Microprocessors Systems - Assignment 4 | EE 3750, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
HW4$(EE3750)$
Due$on$April$8,$2010$
Problem$1:$:$Write$a$program$sequence$that$compares$the$first$10$bytes$of$a$character$string$beginning$
at$CHAR_1$with$the$first$10$bytes$of$another$string$beginning$at$CHAR_2$and$branches$to$MATCH$if$they$
are$equal,$but$otherwise$continues$in$sequence.$$Assume$offsets$for$CHAR_1$and$CHAR_2$with$SI$and$DI,$
respectively.$
Problem$ 2:$ Write$ a$ program$ that$ outputs$ (i)$ “How$ are$ you?,$ (ii)$ waits$ for$ 10$ seconds,$and$ (iii)$ then$
outputs$“I$am$fine.”$Use$the$ concept$of$terminator$to$exit$a$loop.$Further,$ use$AH$=$ 0Eh$and$INT$10h$for$
teletype$output.$You$should$write$a$procedure$for$printing$the$strings.$
Problem$ 3:$ Write$ a$ program$ that$ performs$multiplication$of$numbers using$ the$ concept$ of$
addition.$$Use$AX$and$BX$to$for$the$operands$and$CL$for$the$counter. $
Problem$4:$[extra$credit]$Consider$two$versions$(a)$and$(b)$of$a$program$that$move$the$byte$contents$of$
a$block$of$memory$to$another$area$in$memory.$Let$LENGTHSTRING1$be$10$(in$decimal).$In$the$following,$
the$clock$cycles$represent$number$of$‘clock$cycles’$that$are$needed$to$execute$an$instruction.$
(a) $
Clock&
cycles&
(b) $
Clock&
cycles&
$$$$$$$$$$$$MOV$SI,$OFFSET$STRING1$
4&
$$$$$$$$MOV$SI,$OFFSET$STRING1$
4&
$$$$$$$$$$$$MOV$DI,$OFFSET$STRING2$
4&
$$$$$$$$MOV$DI,$OFFSET$STRING2$
4&
$$$$$$$$$$$$MOV$CX,$LENGTHSTRING1$
4&
$$$$$$$$MOV$CX,$LENGTHSTRING1$
4&
MOVE:$MOV$AL,$[SI]$
13&
$$$$$$$$CLD$
2&
$$$$$$$$$$$$$$MOV$[DI],$AL$
14&
MOVE:$MOVSB$
18&
$$$$$$$$$$$$$$INC$SI$
2&
$$$$$$$$LOOP$MOVE$
17*/7**&
$$$$$$$$$$$$$$INC$DI$
2&
$
$
$$$$$$$$$$$$$LOOP$MOVE$
17*/7**&
$
$
*$if$branch$is$NOT$taken$$
$
**$if$branch$is$taken$
$
$
(i) Assume$50$MHz$clock$and$estimate$the$time$needed$to$execute$the$sequences$in$(a)$and$(b).$
(ii) Repeat$(i)$when$following$two$instructions$$
MOVE:$MOVSB$
$$$$$$$$$$$$LOOP$MOVE$
are$replaced$by$a$single$instruction$REP$MOVSB,$which$requires$(9$+$17$n)$ clock$cycles.$Here$
n$is$the$number$of$repetition.$

Partial preview of the text

Download 4 Problems on Microprocessors Systems - Assignment 4 | EE 3750 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

HW4 (EE3750)

Due on April 8, 2010

Problem 1: : Write a program sequence that compares the first 10 bytes of a character string beginning at CHAR_1 with the first 10 bytes of another string beginning at CHAR_2 and branches to MATCH if they are equal, but otherwise continues in sequence. Assume offsets for CHAR_1 and CHAR_2 with SI and DI, respectively. Problem 2: Write a program that outputs (i) “How are you?, (ii) waits for 10 seconds, and (iii) then outputs “I am fine.” Use the concept of terminator to exit a loop. Further, use AH = 0Eh and INT 10h for teletype output. You should write a procedure for printing the strings. Problem 3: Write a program that performs multiplication of numbers using the concept of addition. Use AX and BX to for the operands and CL for the counter. Problem 4: [extra credit] Consider two versions (a) and (b) of a program that move the byte contents of a block of memory to another area in memory. Let LENGTHSTRING1 be 10 (in decimal). In the following, the clock cycles represent number of ‘clock cycles’ that are needed to execute an instruction. (a) Clock cycles (b) Clock cycles MOV SI, OFFSET STRING1 4 MOV SI, OFFSET STRING1 4 MOV DI, OFFSET STRING2 4 MOV DI, OFFSET STRING2 4 MOV CX, LENGTHSTRING1 4 MOV CX, LENGTHSTRING1 4 MOVE: MOV AL, [SI] 13 CLD 2 MOV [DI], AL 14 MOVE: MOVSB 18 INC SI 2 LOOP MOVE *17/7**** INC DI 2 LOOP MOVE *17/7****

  • if branch is NOT taken ** if branch is taken (i) Assume 50 MHz clock and estimate the time needed to execute the sequences in (a) and (b). (ii) Repeat (i) when following two instructions MOVE: MOVSB LOOP MOVE are replaced by a single instruction REP MOVSB, which requires (9 + 17 n ) clock cycles. Here n is the number of repetition.