13
University of Florida EEL 4744Summer 2015 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 30 June 2015 Page 1/13 Exam 1 , Instructions: Last Name , First Name May the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones , beepers and other noise making devices. Show all work on the front of the test papers. If you need more room, make a clearly indicated note on the front of the page, "MORE ON BACK", and use the back. The back of the page will not be graded without an indication on the front. You may use any of your XMEGA documents with limited added material; highlighting and tagging is permissible. You may not use any notes (mine or yours), examples, homework, labs, books, calculators, computer, electronic devices, etc. CLEARLY write your name at the top of this test page (and, if you remove the staple, all others). Be sure your exam consists of 13 distinct pages. Sign your name and add the date below. (If we struggle to read your name, you will lose points.) The space provided does not necessarily represent the amount of writing needed. You must pledge and sign this page in order for a grade to be assigned. In programs, the use of comments results in more partial credit. Read each question carefully and follow the instructions . The point values for problems may be changed at prof’s discretion. Part of your grade on tests, quizzes, labs, etc. is based not only on solving the problem you are presented with, but the manner in which you solve it. For example, there is a difference between two programs that meet the given specifications, but one is an elegant, extensible 20-line solution, while the other is an obfuscated 100-line program that also meets the specifications but would be difficult to extend later. Just as your future employer would value the latter program less than the first, so will I in grading your assignments. This exam counts for 28.5-31.5% of your total grade. Unless otherwise stated assume the following: The oscillator frequency is precisely 2 MHz. The code should run on an ATxmega128A1U as configure on the Out of the Box uPAD Development Board without any additional peripherals. You can assume the standard bit equates that I have used in class examples (e.g., BIT0 = 0b0000 0001, BIT76 = 0b1100 0000, INV76 = 0b0011 1111) have already been done for you. PLEDGE: On my honor as a University of Florida student, I certify that I have neither given nor received any aid on this examination, nor I have seen anyone else do so. __________________________ _____________________________ ________________ PRINT YOUR NAME SIGN YOUR NAME DATE (30 June 15) Regrade comments below. Give page # & problem # and reason for the petition. Problem Available Points 1a 4 1b 13 1c-e 16 2a-g 33 2h-i 9 3 11 4 14 TOTAL 100

May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 1/13 Exam 1

,

Instructions: Last Name , First Name

May the Schwartz

be with you!

SubjuGator 8 CAD image for the

2015 RoboSub Competition.

Turn off cell phones, beepers and other noise making devices. Show all work on the front of the test papers. If you need more room, make a clearly

indicated note on the front of the page, "MORE ON BACK", and use the back. The back of the page will not be graded without an indication on the front.

You may use any of your XMEGA documents with limited added material; highlighting and

tagging is permissible. You may not use any notes (mine or yours), examples, homework,

labs, books, calculators, computer, electronic devices, etc.

CLEARLY write your name at the top of this test page (and, if you remove the

staple, all others). Be sure your exam consists of 13 distinct pages. Sign your name

and add the date below. (If we struggle to read your name, you will lose points.) The space provided does not necessarily represent the amount of writing needed.

You must pledge and sign this page in order for a grade to be assigned.

In programs, the use of comments results in more partial credit.

Read each question carefully and follow the instructions.

The point values for problems may be changed at prof’s discretion.

Part of your grade on tests, quizzes, labs, etc. is based not only on solving the problem you are presented with, but the

manner in which you solve it. For example, there is a difference between two programs that meet the given specifications,

but one is an elegant, extensible 20-line solution, while the other is an obfuscated 100-line program that also meets the specifications but would be

difficult to extend later. Just as your future employer would value the latter program less than the first, so will I in grading your assignments.

This exam counts for 28.5-31.5% of your total grade.

Unless otherwise stated assume the following:

The oscillator frequency is precisely 2 MHz. The code should run on an ATxmega128A1U as configure on the Out of the Box uPAD Development Board without

any additional peripherals.

You can assume the standard bit equates that I have used in class examples (e.g., BIT0 = 0b0000 0001,

BIT76 = 0b1100 0000, INV76 = 0b0011 1111) have already been done for you.

PLEDGE:

On my honor as a University of Florida student, I certify that I have neither given

nor received any aid on this examination, nor I have seen anyone else do so. __________________________ _____________________________ ________________

PRINT YOUR NAME SIGN YOUR NAME DATE (30 June 15)

Regrade comments below. Give page # & problem # and reason for the petition.

Problem Available Points

1a 4

1b 13

1c-e 16

2a-g 33

2h-i 9

3 11

4 14

TOTAL 100

Page 2: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 2/13 Exam 1

,

Last Name , First Name

Pro

pa

Ga

torLeftO

RightOLeftGRightGScoutCCopterLLaunchCRecallC

XMEGA

PD3PD5

PD0

PD7

PE0PE1PE2PE3PE4PE5PE6PE7

Landed(L)

Crashed(H)

Start(L)

Kill(H)

Camera

LIDAR

Camera

[33%] 1. Your goal is to use create a circuit (shown below) to assist PropaGator (a robot boat) to

navigate through part of its RoboBoat competition challenges. Smart sensors can detect each of the following: LeftO (object/obstacle on the left), RightO (object/obstacle on the right),

LeftG (goal on the left), RightG (goal on the right), ScoutC (scouting complete) and

CopterL (copter landed). Two outputs are LaunchC (launch copter) and RecallC (recall

copter). The XMEGA inputs LeftO, RightO, LeftG, RightG, ScoutC, and CopterL correspond to Port E bits 0 through 5 (PE0-PE5), respectively, and the outputs LaunchC and

RecallC correspond to PE6 and PE7.

(4%) a) Complete the below schematic for the

PropaGator Assist Circuit, adding only

the required switch and LED circuits .

PortD pins 0 and 7 require switch circuits and pins 3 and 5 require LED

circuits. Add only the necessary switch

circuits and LED circuits. Each switch

should be shown in its true positions. Each LED should be on (i.e., lit) when

the corresponding signals is true.

5 min

4 min

Page 3: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 3/13 Exam 1

,

Last Name , First Name

(13%) b) Write a complete XMEGA assembly language program for the PropaGator Assist

Circuit, as described here. Wait until Start is true; once true, you should assume that it stays that way; immediately output false to both LaunchC and RecallC. After Start is

true, repeat the following forever: If LeftO is true and RightO is true, call subroutine

GoBackRandom; otherwise, if LeftO is true, call GoRight; else if RightO is true call

GoLeft; else if LeftG and RightG are true, call GoStraight and output a true to LaunchC; … (This is only a small part of the program, but all that you have to write for

this exam. You do NOT have to write the subroutines listed above.) Do NOT modify

this program based on parts c – e; solve those problems independently from parts a and b.

Labels Instructions Comments

18 min

Page 4: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 4/13 Exam 1

,

Last Name , First Name

1. b) (continued from previous page)

Labels Instructions Comments

Page 5: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 5/13 Exam 1

,

Last Name , First Name

(3%) 1 c) The Kill input is the most important signal in the entire system. When this signal goes

true, all propulsion motors need to be immediately shut down. (All well-designed robots have multiple and redundant kill systems.) Write assembly code to set up an interrupt

vector for the Kill input. The interrupt service routine, KILL_INTR_ISR, should be

executed when the Kill input first goes true.

Labels Assembly Instructions Comments

(7%) d) Write the INIT_ISR assembly subroutine (that would be called shortly after the start of

the main routine) to appropriately initialize the above interrupt. You can use an edge or a

level-triggered interrupt. Interrupts should be ready to execute upon returning from this subroutine, so be sure to configure all necessary registers.

Labels Assembly Instructions Comments

7 min

2 min

Page 6: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 6/13 Exam 1

,

Last Name , First Name

1. d) (continued)

Labels Instructions Comments

(6%) e) Write the interrupt service routine, KILL_INTR_ISR. The ISR’s only job is to call

subroutine KILL_PROPULSION. After this interrupt occurs, the rest of the robot must

operate as it normally does, but the boat won’t move (since propulsion has been

disabled). The active-high KILL signal is on PortD, pin7 (PD7).

Labels Instructions Comments

5 min

Page 7: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 7/13 Exam 1

,

Last Name , First Name

8K (8k x 8) SRAM Addr Range

0x - 0x = 0b - 0b

12K (12k x 8) ROM Addr Range:

0x - 0x = 0b - 0b

Port Addr Range:

0x - 0x = 0b - 0b

Port/Memory Blocks

[42%] 2. Design an expansion to an XMEGA board (like your uPAD) by adding an SRAM, a ROM,

an input port, an output port, and a keypad. Assume that each of the first four devices above can use only the address space from 0x7 3000 to 0x7 FFFF. Complete the figure to

the right and the table below for each of parts a-c.

( %) a) Add an 8K (8k x 8) SRAM within the required address range using

CS0, but without using any logic gates (or PLD). Configure CS0 by

specifying the below values. Add to the figure to the right and the

table below. Put this at the lowest possible address.

EBI_CTRL =

CS0_BASEADDRH =

CS0_BASEADDRL = CS0_CTRLA =

( %) b) With the space remaining, where should you add a 12K (12k x 8) ROM using any CSx

(except CS0) and additional SSI logic? (Note that 12k = 8k + 4k). Use as little

additional logic as possible for a robust solution. Put the ROM addresses as close to the SRAM addresses as possible. Add to the above right figure and the table below.

( %) c) With the space remaining, where should you add an input port and an output port using

any remaining available (not previously used) CSx and additional SSI logic. Use as

little additional logic as possible for a robust solution. Put the ports addresses as close

to the ROM addresses as possible. Add to the above right figure and the table below.

5 min

(a-g = 33%)

5 min

4 min

(a-g = 33%)

(a-g = 33%)

3 min

Page 8: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 8/13 Exam 1

,

Last Name , First Name

( %) 2. d) Derive the equations for the address part of address decoding, i.e.,

XAddr = f(Addresses only). In part g you will design the necessary circuits.

( %) e) Derive the control equations that you will need to control the ports and memories, e.g.,

XCtrl = f(XAddr, RE, WE, …). Leave Reset out of your equations and circuits in this

problem, but in general it should be included. In part g you will design the necessary

circuits.

( %) f) Assume that only pull-up resistors can be used, that bits 3-0 of an XMEGA port are used

for outputs, and bits 7-4 of the same XMEGA port are used for inputs. Explain how to detect if the keypad’s 4 and 7 keys are pressed at the same time. Be specific. Draw the

schematic of the keypad circuit on the next page to make this possible (as well as to allow

and single key press to be detected.)

4 min

3 min

(a-g = 33%)

(a-g = 33%)

4 min

(a-g = 33%)

Page 9: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 9/13 Exam 1

,

Last Name , First Name

12k x 8

ROM

CS

OE

8

__A__-A0

D7-D0

D7-D0

G

8-bit

Latch

8Q7-Q0

8

D7-D0

8-bit

Flip-Flop

8Q7-Q0

8

1 2 3

654

7 8 9

#0*

8k x 8 bit

RAM

WE

CS

OE

8A -A0

D7-D0

__

XMEGA

ALE1

= Port K

CLK EBI

WE

Reset

= Port J

Port ___

ALE2

RE

Port ___

Port H

CS2

D7-D0

G

8-bit

Latch

8Q7-Q0

8

CS1

CS0

In7-0

OE

8-bit

Tri-State

8Out7-0

8

CS3

( %) 2. g) Complete the circuit diagram below as specified in part a-f. Please USE LABELS

instead of wires! Please USE LABELS instead of wires! Add additional components

only if necessary (but only resistors and SSI gates, e.g., ANDs, NORs, NOTs, etc.).

12 min

(a-g = 33%)

Page 10: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 10/13 Exam 1

,

Last Name , First Name

(2%) 2. h) How many different addresses can be used to read from a single address on the ROM?

Show your work. You may leave your answer in the form of an expression, e.g., 37k or 27.

(2%) i) How many different addresses can be used to write to the outut port? Show your work. You may leave your answer in the form of an expression, e.g., 37k or 27.

(5%) j) Write an assembly language program fragment necessary to determine if the 4 and 7

keys are pressed at the same time. Store 0x37 into R16 if the key is pressed; otherwise

store 0. The program does not need to do anything else.

Labels Instructions Comments

2 min

2 min

5 min

Page 11: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 11/13 Exam 1

,

Last Name , First Name

[11%] 3. Assume an XMEGA subroutine named Sub_Exam1 is located at address 0x8E42. Assume

that an interrupt service routine, Exam1_ISR, is located at 0xAB12. (3%) a) Write the instruction at address 0x737A for appropriately initiating subroutine

execution in the empty box below left and fill out the blank in the last line’s address. If

possible, use an rcall rather than a call. Write the stack pointer initialization

instruction(s) in the boxes below right. Initialize the stack pointer at an appropriate location in internal XMEGA SRAM that would maximize the allowable stack space.

(8%) b) Assume that the before your code runs, all of stack data memory has been initialized to 0x00. For each of the below descriptions, draw the stack. If a value is unknown, indicate with ??;

you do not need to write 00 if the value is 0x00. Note that other interrupts can happen at any

time. In each case, show an arrow () at the location of the stack pointer. On the far left, show (valid) addresses for each of the used stack locations. Also provide the values

requested at the bottom of these tables.

1) after the stack is initialized 2) after push R16 (R16 = 0xAF) 3) immediately after the start and return of an

appropriately written Exam1_ISR execution after this point, assume other

interrupts can happen at ANY time

4) at the start of the subroutine execution 5) after the return from the subroutine 6) after a pop R17

3 min

Stack pointer initialization instructions

Address Subroutine execute instruction

0x737A

Addresses

1-After

Init

2- After

push R16

3- After

ISR exec

4 - At start

of sub

5- After

return

6- After

pop R17

SP =

SP =

SP =

SP =

SP =

SP =

R17 =

9 min

Page 12: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 12/13 Exam 1

,

Last Name , First Name [14%] 4. Answer or solve each of the following short problems.

(1%) a) Why is it importance of using flux while soldering?

(2%) b) If you were trying to debug a problem with your I/O port or SRAM, which signals would

be useful to measure using your DAD’s LSA (Logic State Analyzer)?

(2%) c) Give an example for when the DAD’s oscilloscope function is a better tool than the

DAD’s LSA function?

(1%) d) If an interrupt occurs while that interrupt is disabled (either locally or globally), what, if anything, happens?

(1%) e) Why do we use a capacitor on all of our ICs?

2 min

2 min

2 min

2 min

2 min

Page 13: May the Schwartz be with you! - Machine Intelligence LabMay the Schwartz be with you! SubjuGator 8 CAD image for the 2015 RoboSub Competition. Turn off cell phones, beepers and other

University of Florida EEL 4744—Summer 2015 Dr. Eric M. Schwartz

Department of Electrical & Computer Engineering 30 June 2015

Page 13/13 Exam 1

,

Last Name , First Name (1%) 4. f) What is a non-maskable interrupt (NMI) and what makes it different from a normal

interrupt?

(2%) g) What device is necessary when adding an input port? What other device (if any) could be

used, and what is the implications of using this device instead of the first one?

(2%) h) What is the preferred setting for unused pins on the CPLD? What can happen if this is

not used?

(2%) i) Give two advantages of using rjmp (or rcall) over jmp (or call).

2 min

2 min

2 min

2 min