Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Modern Computer Architecture and Organization

You're reading from  Modern Computer Architecture and Organization

Product type Book
Published in Apr 2020
Publisher Packt
ISBN-13 9781838984397
Pages 560 pages
Edition 1st Edition
Languages
Author (1):
Jim Ledin Jim Ledin
Profile icon Jim Ledin
Toc

Table of Contents (20) Chapters close

Preface 1. Section 1: Fundamentals of Computer Architecture
2. Chapter 1: Introducing Computer Architecture 3. Chapter 2: Digital Logic 4. Chapter 3: Processor Elements 5. Chapter 4: Computer System Components 6. Chapter 5: Hardware-Software Interface 7. Chapter 6: Specialized Computing Domains 8. Section 2: Processor Architectures and Instruction Sets
9. Chapter 7: Processor and Memory Architectures 10. Chapter 8: Performance-Enhancing Techniques 11. Chapter 9: Specialized Processor Extensions 12. Chapter 10: Modern Processor Architectures and Instruction Sets 13. Chapter 11: The RISC-V Architecture and Instruction Set 14. Section 3: Applications of Computer Architecture
15. Chapter 12: Processor Virtualization 16. Chapter 13: Domain-Specific Computer Architectures 17. Chapter 14: Future Directions in Computer Architectures 18. Answers to Exercises 19. Other Books You May Enjoy

Answer

Create your assembly language source file. The Ex__8_expr_arm64.s file contains the following example solution to this exercise:

.text
.global _start
_start:
    // Print the leading output string
    ldr     x1, =msg1
    mov     x2, #msg1_len
    bl      print_string
    // Compute [(129 – 66) * (445 + 136)] / 3
    mov     x0, #129
    sub     x0, x0, #66
    mov     x1, #445
    add     x1, x1, #136
    mul     x0, x1, x0
    mov     x1, #3
    udiv    x0, x0, x1
    // Print the upper byte of the result
    mov     x19, x0
    lsr     x0, x0, #8
    bl      print_byte
    // Print the lower byte of the result    
    mov     x0, x19
    bl      print_byte
    
    // Print the trailng output string
    ldr     x1, =msg2
    mov     x2, #msg2_len
    bl      print_string
    
    // Exit the program with syscall 93, returning status 0
    mov     x0, #0
    mov     x8, #93
    svc     0
// Print a string; x1=string address, x2=string length
print_string:
    mov...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime