1 / 12

ITEC 352

ITEC 352. Lecture 14 ISA(5). Review. Questions? Exam 1 next Friday Assembly Assembler Basic structure Registers Memory. Outline. More assembly Instructions Structure Usage Intro to loops Textbook link http:// www.mrkay.org / zenpc /ARCHMAN/. Instruction Format.

Download Presentation

ITEC 352

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. ITEC 352 Lecture 14 ISA(5)

  2. Review • Questions? • Exam 1 next Friday • Assembly • Assembler • Basic structure • Registers • Memory

  3. Outline • More assembly • Instructions • Structure • Usage • Intro to loops • Textbook link • http://www.mrkay.org/zenpc/ARCHMAN/

  4. InstructionFormat • Every ARC instruction is 32 bits in length. • For instance, the instruction below must fit within 32 bits when represented in binary. • To do this, ARC enforces certain formats that allow us to use the 32 bits in different ways. • These are called instruction formats. • A format defines how the various bit fields of an instruction are laid out within 32 bits and how it is interpreted by the ARC control unit.

  5. ARC Instruction and PSR Formats

  6. PSR • A register that is used to store results of instructions • Not values • If a result is 0 • If a result is negative • Carry bit (c) • Overflow bit (v)

  7. Data Formats

  8. ARC Pseudo-Ops • • Pseudo-ops are instructions to the assembler. They are not part of the ISA.

  9. .org 3000 a: 10 25 2 3 4 a_start: 3000 counter: 0 output: 0 Adding 5 integers … Variables for the program ld [a_start], %r1 ! Load the starting address of a into %r1 ld [counter], %r2 ! Register r2 is the counter. andcc %r3,%r0, %r3 ! What does this do? loop: subcc%r2, 5, %r0 ! Have we reached the end ? be done ! If %r2 – 5 = 0, exit loop. addcc %r2, 1, %r2 ! Increment counter ld %r1, %r4 ! Load the number from the array addcc %r4, %r3, %r3 ! Accumulate sum into %r3. addcc %r1, 4, %r1 ! Goto next address ba loop done: st %r3, [output] jmpl %r15+4, %r0

  10. Summary Storage location for address of the array a. Having this location allows us to load the address “3000” into a register. Length is being used as a “counter” to determine when to end the loop.

  11. Other ARC instructions • Software traps: • Allows programs to invoke services from the OS/hardware, e.g., reading a keyboard or writing onto a display. • ARC has trap instructions – but they do not control the OS/hardware (due to JVM limitations).

  12. Summary • Assembly programming 101 • Different language, but still within same paradigm

More Related