1 / 8

16.317 Microprocessor Systems Design I

16.317 Microprocessor Systems Design I. Instructor: Dr. Michael Geiger Fall 2014 Lecture 16 HLL  assembly (continued). Lecture outline. Announcements/reminders HW 3 due 10/20 Review: HLL  assembly Conditional statements Loops Today’s lecture: HLL  assembly examples.

nerea-case
Download Presentation

16.317 Microprocessor Systems Design I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 16.317Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2014 Lecture 16 HLL  assembly (continued)

  2. Lecture outline • Announcements/reminders • HW 3 due 10/20 • Review: HLL  assembly • Conditional statements • Loops • Today’s lecture: HLL  assembly examples Microprocessors I: Lecture 18

  3. 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 Microprocessors I: Exam 2 Preview

  4. 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 Microprocessors I: Lecture 6

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

  6. Maximum value function in C int max(intv1, intv2) { if(v1 > v2) returnv1; else returnv2; } Microprocessors I: Lecture 6

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

  8. Final notes • Next time: • Interrupts • Reminders: • HW 3 due 10/20 Microprocessors I: Lecture 18

More Related