ex1_f09 - EEL 4744C – Dr. Gugel Fall 2009 Exam #1 • •...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EEL 4744C – Dr. Gugel Fall 2009 Exam #1 • • • NAME____________________________________ UF ID#____________________________________ Open book and open notes, 90-minute examination to be done in pencil. No electronic devices are permitted. All work and solutions are to be written on the exam where appropriate. Point System (for instructor and TA use only) Page 2 17 points Page 3 19 points Page 4 39 points Page 5 16 points Page 6 10 points _________________ _________________ _________________ _________________ _________________ TOTAL _________________ out of 101 Grade Review Information: (NOTE: deadline of request for grade review is the day the exam is returned.) ________________________________________________________________________________ ________ ________________________________________________________________________________________ ________________________________________________________________________________________ _____________________________________________________________________ ___________________ ________________________________________________________________________________________ ________________________________________________________________________________________ __________________________________________________________ ______________________________ ________________________________________________________________________________________ ________________________________________________________________________________________ _______________________________________________ _________________________________________ ________________________________________________________________________________________ ________________________________________________________________________________________ ________________________________________________________________________________________ ________________________________________________________________________________________ 1.What is the largest signed number number you can subtract from the 16 bit signed number FFFF (i.e. FFFF – X) without creating an overflow? (2 pts.) ________________________________________________________________________________________________ 2. Name two other functions that the pin programmed for GPIO1 can be used for? (2 pt.) _________________________________________________________________________________________________ 3. A student has connect four LEDs (with current limiting resistors) to GPIO35:32. Write the code to initialize the GPIO pins and output 0x7. Assume the watchdog timer has been disabled and EALLOW has also been executed. (6 pts.) _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ 4. In the keypad lab, what was the purpose of the pull-up resistors on the GPIO input pins? (2 pts.) _________________________________________________________________________________________________ _________________________________________________________________________________________________ 5. Name three different ranges of SARAM DSP memory internal to the F28335 DSP? (3 pts.) _________________________________________________________________________________________________ _________________________________________________________________________________________________ _________________________________________________________________________________________________ 6 Name two assembler directives that can be used to alter DSP memory at load time. (2 pts.) _________________________________________________________________________________________________ _________________________________________________________________________________________________ Page 2 Page Score = 7. Create a subroutine to perform the following threshold detection. (10 pt.) If N1 > N2, return +1 in register AL. If N1 = N2, return 0 in register AL If N1 < N2, return -1 in register AL N1 N2 .bss .bss 1 1 ;assume N1 & N2 are 16 bit unsigned words that are written to at run time Sub_Threshold _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ 8. A student is given a new uP that has 20 address lines, 16 data lines, DataStrobe (-DS) and a R/-W signal. When the processor resets it automatically fetches the first PC value from 0xFFFFF. Assuming that we have 32K x 8 EPROMs and 256K x 8 SRAMs available, answer the following questions: If we would like to have 32K of EPROM (to hold our BIOS) in our system, how many EPROMs are required and what will be the range of the 32K in the uP memory map? (3 pt.) _________________________________________________________________________________________________ What data values (starting address of our BIOS) should be programmed in the highest two bytes of each EPROM(s)? Assume that the system is Big Endian. i.e. the lowest address in the EPROM contains the most significant byte or word of the data you are trying to place into memory. Fill out the table below for only the EPROMs you will require in your system. (6 pt.) Addr Value (Hex) ERPOM #4 Data EPROM #3 Data EPROM #2 Data EPROM #1 Data (least significant) Page 3 Page Score = We would like to place 512K of SRAM in the lowest 512K of our system memory map. Show the decode logic equations required for the /CS signals on the (4) SRAMs. Assume Full Address Decoding. (6 pt.) Low_256K_SRAM_D7_0_/CS = ________________________________________________________________ Low_256K_SRAM_D15_8_/CS = _______________________________________________________________ High_256K_SRAM_D7_0_/CS = ________________________________________________________________ High_256K_SRAM_D15_8_/CS = _______________________________________________________________ Stack, Addressing Modes & General Assembly Analysis - Given the attached assembly code & list files answer the following questions related to this code: 9. What is the first memory address of the stack? ____________________________________________ Hex (2 pt.) 10. What is the first memory address of the data vector? ________________________________________ Hex (2 pt.) 11. What is the range of memory allocated for the data vector? ___________________________________ Hex (3 pt.) 12. What is the return address for the subroutine? _____________________________________________ Hex (2 pt.) 13. What is effective address for the MOV SP, #END2 instruction? _______________________________ Hex (2 pt.) 14. What is the effective addr for the MOV AL,*AR0 instruction on Line 21 at run time? _________________ Hex (2 pt.) 15. What type of addressing mode is used on the MPY ACC,T,AL instruction? _____________________________ (2 pt.) 16. What instruction can potentially cause a break in the pipeline operation? _____________________________ (2 pt.) 17. What register or registers are corrupted by the subroutine? ________________________________________ (2 pt.) 18. What is the purpose of the PUSH and POP instructions? Don’t answer to push/pop data on/off the stack. Instead tell me why they were used from a programming point of view. (2 pt.) _________________________________________________________________________________________________ 19. What is value of the Stack Pointer (SP) after all the Pushes have been executed? ____________________ Hex (2 pt.) 20. What is the value of the Stack Pointer when we are executing the infinite branch? ___________________ Hex (2 pt.) 21. Assuming that AR1 = 0x1234, AR2 = 0x5678, T = 0x9ABC and ACC = 0xDDEEFF00 before SUB1 is called, what will stack memory look like after SUB1 is executed? Don’t forget the return address and show only the memory modified by calling and executing SUB1. (8 pt.) Addr (Hex) Data (Hex) Addr (Hex) Data (Hex) Page 4 Page Score = 22. If we assume that VECTOR is initialized to the following values at run time before the subroutine is executed: 0x5, 0x10, 0x10, 0x10, 0x10, 0x10 ;where the 0x5 is the data at the lowest addr for VECTOR What will the values change to after the subroutine has been called? (4 pt.) _________________________________________________________________________________________________ 22. What is the function of this subroutine? i.e. sort, find max in VECTOR, compute Pi, etc. (2 pt.) _________________________________________________________________________________________________ 23. If the data elements in VECTOR are sufficiently large, it is possible to yield an erroneous result. What can be done to check if an erroneous result has been computed? (2 pt.) _________________________________________________________________________________________________ _________________________________________________________________________________________________ 24. What can be modified (in simple quick words) in SUB1 such that an erroneous result will never occur? i.e. Tell me how to improve the code so that we don’t have to check for an error because none will ever occur? (2 pt.) _________________________________________________________________________________________________ _________________________________________________________________________________________________ General CPU/DSP Related – Using the G-CPU documentation and extrapolate this to the DSP hardware/software. 25. In the DSP we have an indirect addressing mode that can move the contents of the lower accumulator to an address stored in an auxiliary register. i.e. MOV *AR0,AL This is very similar to extended addressing on the G-CPU. Show a block diagram of the hardware required to perform this inside the DSP similar to the hardware block diagram found in the G-CPU. Show AR7:0, AL, AH, PC, etc. and all required bus connections. (6 pts.) The best diagram will receive the highest pts. Page 5 Page Score = 26. A student has wired (4) active high LEDs to GPIO3:0 (with current limiting resistors). They have attached a simple 2 x 2 keypad that has four buttons labeled 1 thru 4. The columns on the keypad are labeled C2 and C1. The rows on the keypad are labeled R2 and R1. C2 is connected to GPIO7 and C1 is connected to GPIO6. R2 is connected to GPIO6 and R1 is connected to GPIO5. GPIO7:6 are outputs and GPIO5:4 are inputs with pull-down resistors. See the figure below. Additional Notes: 1. Assume AR0 will always contain the value of the key pressed (1-4) or none (0). 2. When you write a pattern out to detect a key, you should not corrupt the GPIO outputs connected to the LEDs. Hint: Use the value in AR0 to maintain the proper LED display when scanning the keypad. Write a subroutine that returns the key pressed in AR0. i.e. 0 if no key pressed or 1-4 if a key is pressed. Assume the GPIO bits have already been initialized for input and output and that GPADAT has been set to the address of the GPA Data Register. Use compare statements to detect the key pressed. i.e. Don’t use a table look-up method. (10 pts.) Sub_Key_Pressed _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ _____________________________________________ Page 6 Page Score = ;example
problem
for
Fall
2009
Exam
I
 
 
 
 
 
 .global
 _c_int00

 ;for
linker
=>
first
line
of
code
 
 
 
 
 .text
 
 
 _c_int00:
 
 
 
 
 
 ;MAIN
PROGRAM
begins
here
 
 
 MOV
 
 SP,#END2
 
 ;set
stack
to
follow
program
code
 
 
 MOV
 
 AR0,#VECTOR
 
 ;load
ptr
to
data
vector
 
 
 LC
 
 SUB1
 END1:
 
 B
 
 END1,UNC
 
 ;extra
program
code
could
be
placed
here
 
 
 
 
 
 
 
 ;if
we
wanted
to
use
the
results
from
SUB1
 
 
 SUB1
 
 
 
 
 
 
 ;SUBROUTINE
 
 
 
 
 
 
 
 ;ARO
=
ptr
to
data
vector

 
 
 
 ;AR1
=
counter
 
 
 
 
 
 
 
 ;AR2
=
prt
for
result
 
 
 PUSH
 
 AR1
 
 
 PUSH
 
 AR2
 
 
 PUSH
 
 T
 
 
 PUSH
 
 AL
 
 
 PUSH
 
 AH
 
 
 
 MOV
 
 AL,*AR0
 ;get
vector
length

 
 
 MOV
 
 AR1,AL
 
 
 MOV
 
 AR2,AR0
 
 ;set
ptr
for
final
result
 
 
 
 MOV
 
 AL,#0
 
 
 ;clear
mem
loc
where
RESULT
will
be
placed
 
 
 MOV
 
 *AR2,AL
 
 REP1:
 
 INC
 
 AR0
 
 
 
 
 
 
 
 
 MOV
 
 AL,*AR0
 
 
 MOV
 
 T,AL
 
 
 
 
 
 MPY
 
 ACC,T,AL
 
 ;16
bit
unsigned
multiply,
AL*T
=>
ACC
 
 
 
 ADD
 
 *AR2,AL
 
 
 
 DEC
 
 AR1
 
 
 B
 
 REP1,NEQ
 
 
 
 
 
 
 POP
 
 AH
 
 
 POP
 
 AL
 
 
 POP
 
 T
 
 
 POP
 
 AR2
 
 
 POP
 
 AR1
 
 
 
 
 
 LRET
 
 
 
 END2:
 
 NOP
 
 
 
 
 ;dummy
NOP
so
we
can
use
the
label
END2

 
 
 
 
 
 
 
 ;in
our
main
program
 
 
 
 
 
 
 .bss
 
 VECTOR,512
 
 ;DATA
VECTOR
loaded
at
run
time
 
 
 
 
 
 
 
 
 
 
 
 
 
 Page 7 Page Score = 
 
 
 
 exam1_f09.lst




















































 
 






1














 
 ;example
problem
for
Fall
2009
Exam
I
 






2


















 .global



_c_int00


;for
linker
=>
first
line
of
code
 
 






3
00000000











.text
 






4






















 






5
00000000






_c_int00:
















 ;MAIN
PROGRAM
begins
here
 






6
00000000
28AD'




 
 MOV
 SP,#END2


 ;set
stack
to
follow
program
code
 








00000001
001E

 






7
00000002
28A0‐









 MOV
 AR0,#VECTOR
 ;load
ptr
to
data
vector
 








00000003
0000

 






8
00000004
0080'










 LC

 SUB1
 








00000005
0007

 






9
00000006
6F00

END1:



 B
 END1,UNC
 ;extra
program
code
would
be
…
 





10














 





11
00000007






SUB1























 ;SUBROUTINE
 





12










































 ;ARO
=
ptr
to
data
vector
 





13
 
 
 
 
 
 
 
 ;AR1
=
counter
 





14



 
 
 
 
 
 
 
 ;AR2
=
prt
for
result
 





15
00000007
22A1









 PUSH

 AR1
 





16
00000008
22A2










 PUSH
 AR2
 





17
00000009
22AC









 PUSH
 T
 





18
0000000a
22A9










 PUSH

 AL
 





19
0000000b
22A8










 PUSH
 AH
 





20














 





21
0000000c
92C0






 MOV
 AL,*AR0
 get
vector
length

 ; 





22
0000000d
96A1










 MOV

 AR1,AL
 





23
0000000e
78A2











 MOV


 AR2,AR0



 ;set
ptr
for
final
result
 





24














 





25
0000000f
9A00










 MOV

 AL,#0
 
 ;clear
mem
loc
where
RESULT
…
 





26
00000010
96C2










 MOV


 *AR2,AL
 





27














 





28
00000011
0AA0

REP1:



 INC

 AR0













































 





29
00000012
92C0










 MOV

 AL,*AR0
 





30
00000013
2DA9











 MOV

 T,AL




















 





31
00000014
12A9









 MPY

 ACC,T,AL

 ;16
x
16
bit
multiply















 





32
00000015
72C2








 ADD


 *AR2,AL
 





33














 





34
00000016
0BA1









 DEC


 AR1
 





35
00000017
60FA











 B


 REP1,NEQ








 





36






























 





37
00000018
2AA8











 POP


 AH
 





38
00000019
2AA9









 POP


 AL
 





39
0000001a
2AAC









 POP


 T
 





40
0000001b
2AA2









 POP

 AR2
 





41
0000001c
2AA1










 POP


 AR1





















 





42
0000001d
7614








 LRET
 





43






























 





44
0000001e
7700

END2:



 NOP
 
 
 ;dummy
NOP
so
we
can
use
…
 





45






































 





46
00000000















 .bss

 VECTOR,512

 ;DATA
VECTOR
loaded
…
 
 No
Assembly
Errors,
No
Assembly
Warnings,
No
Concussion
 
 
 Page 8 Page Score = ...
View Full Document

This document was uploaded on 11/24/2010.

Ask a homework question - tutors are online