Presentation is loading. Please wait.

Presentation is loading. Please wait.

EECE.3170 Microprocessor Systems Design I

Similar presentations


Presentation on theme: "EECE.3170 Microprocessor Systems Design I"— Presentation transcript:

1 EECE.3170 Microprocessor Systems Design I
Instructor: Dr. Michael Geiger Fall 2016 Lecture 18 HLL  assembly (continued)

2 Microprocessors I: Lecture 18
Lecture outline Announcements/reminders HW 4 due 2:00 PM today HW 5 to be posted; due 2:00 PM, Wednesday, 10/26 No Thursday office hours until my feet heal Will stay later most M/W (on campus until 4 today) Review: HLL  assembly Conditional statements Loops Today’s lecture: HLL  assembly examples 4/4/2019 Microprocessors I: Lecture 18

3 Microprocessors I: Exam 2 Preview
Review: HLL  assembly Conditional statements (if-then-else) Evaluate condition (CMP instruction(s)) Conditional jump (often to “else” case) “If” case ends with unconditional jump to skip “else” Loops Initialize variable at start Test loop condition (similar to if) Change loop variable 4/4/2019 Microprocessors I: Exam 2 Preview

4 Microprocessors I: Lecture 6
Practice problems See today’s handout for Description of how stack frame should be created Description of where to access function arguments, local variables Functions to be written int fact(int n): Calculate and return n! int max(int v1, int v2): Return largest value between v1 and v2 void swap(int *a, int *b): Given addresses a & b, swap contents Solutions to be posted as PDF online C versions in slides that follow; assembly in PDF file Will be covered in class today as well 4/4/2019 Microprocessors I: Lecture 6

5 Microprocessors I: Lecture 6
Factorial in C int fact(int n) { int i; int fact = 1; for (i = n; i > 1; i--) fact *= i; return fact; } 4/4/2019 Microprocessors I: Lecture 6

6 Maximum value function in C
int max(int v1, int v2) { if (v1 > v2) return v1; else return v2; } 4/4/2019 Microprocessors I: Lecture 6

7 Microprocessors I: Lecture 6
Swap in C void swap(int *a, int *b) { int temp; temp = *a; *a = *b; *b = temp; } 4/4/2019 Microprocessors I: Lecture 6

8 Microprocessors I: Lecture 18
Final notes Next time: PIC intro Reminders: HW 4 due 2:00 PM today HW 5 to be posted; due 2:00 PM, Wednesday, 10/26 No Thursday office hours until my feet heal Will stay later most M/W (on campus until 4 today) 4/4/2019 Microprocessors I: Lecture 18


Download ppt "EECE.3170 Microprocessor Systems Design I"

Similar presentations


Ads by Google