Modern Computer Architecture and Organization
eBook - ePub

Modern Computer Architecture and Organization

Jim Ledin, Dave Farley

Share book
  1. 666 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Modern Computer Architecture and Organization

Jim Ledin, Dave Farley

Book details
Book preview
Table of contents
Citations

About This Book

A no-nonsense, practical guide to current and future processor and computer architectures that enables you to design computer systems and develop better software applications across a variety of domainsKey Features• Understand digital circuitry through the study of transistors, logic gates, and sequential logic• Learn the architecture of x86, x64, ARM, and RISC-V processors, iPhones, and high-performance gaming PCs• Study the design principles underlying the domains of cybersecurity, bitcoin, and self-driving carsBook DescriptionAre you a software developer, systems designer, or computer architecture student looking for a methodical introduction to digital device architectures, but are overwhelmed by the complexity of modern systems? This step-by-step guide will teach you how modern computer systems work with the help of practical examples and exercises. You'll gain insights into the internal behavior of processors down to the circuit level and will understand how the hardware executes code developed in high-level languages.This book will teach you the fundamentals of computer systems including transistors, logic gates, sequential logic, and instruction pipelines. You will learn details of modern processor architectures and instruction sets including x86, x64, ARM, and RISC-V. You will see how to implement a RISC-V processor in a low-cost FPGA board and write a quantum computing program and run it on an actual quantum computer.This edition has been updated to cover the architecture and design principles underlying the important domains of cybersecurity, blockchain and bitcoin mining, and self-driving vehicles.By the end of this book, you will have a thorough understanding of modern processors and computer architecture and the future directions these technologies are likely to take.What you will learn• Understand the fundamentals of transistor technology and digital circuits• Explore the concepts underlying pipelining and superscalar processing• Implement a complete RISC-V processor in a low-cost FPGA• Understand the technology used to implement virtual machines• Learn about security-critical computing applications like financial transaction processing• Get up to speed with blockchain and the hardware architectures used in bitcoin mining• Explore the capabilities of self-navigating vehicle computing architectures• Write a quantum computing program and run it on a real quantum computerWho this book is forThis book is for software developers, computer engineering students, system designers, reverse engineers, and anyone looking to understand the architecture and design principles underlying modern computer systems: ranging from tiny, embedded devices to warehouse-size cloud server farms. A general understanding of computer processors is helpful but not required.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Modern Computer Architecture and Organization an online PDF/ePUB?
Yes, you can access Modern Computer Architecture and Organization by Jim Ledin, Dave Farley in PDF and/or ePUB format, as well as other popular books in Informatica & Hardware. We have over one million books available in our catalogue for you to explore.

Information

Year
2022
ISBN
9781803238234
Edition
2
Subtopic
Hardware

Appendix

Answers to Exercises

Chapter 1: Introducing Computer Architecture

Exercise 1

Using your favorite programming language, develop a simulation of a single-digit decimal adder that operates in the same manner as in Babbage’s Analytical Engine. First, prompt the user for two digits in the range 0-9: the addend and the accumulator. Display the addend, the accumulator, and the carry, which is initially zero. Perform a series of cycles as follows:
  1. If the addend is zero, display the values of the addend, accumulator, and carry and terminate the program
  2. Decrement the addend by one and increment the accumulator by one
  3. If the accumulator incremented from nine to zero, increment the carry
  4. Go back to step 1
Test your code with these sums: 0+0, 0+1, 1+0, 1+2, 5+5, 9+1, and 9+9.

Answer

The Ex__1_single_digit_adder.py Python file contains the adder code:
#!/usr/bin/env python """Ex__1_single_digit_adder.py: Answer to Ch 1 Ex 1.""" import sys # Perform one step of the Analytical Engine addition # operation. a and b are the digits being added, c is the # carry def increment_adder(a, b, c): a = a - 1 # Decrement addend b = (b + 1) % 10 # Increment accum, wrap to 0 if necessary if b == 0: # If accumulator is 0, increment carry c = c + 1 return a, b, c # Add two decimal digits passed on the command line. # The sum is returned as digit2 and the carry is 0 or 1. def add_digits(digit1, digit2): carry = 0 while digit1 > 0: [digit1, digit2, carry] = increment_adder( digit1, digit2, carry) return digit2, carry 
The Ex__1_test_single_digit_adder.py file contains the test code:
#!/usr/bin/env python """Ex__1_test_single_digit_adder.py: Tests for answer to  chapter 1 exercise 1.""" import unittest import Ex__1_single_digit_adder class TestSingleDigitAdder(unittest.TestCase): def test_1(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 0, 0), (0, 0)) def test_2(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 0, 1), (1, 0)) def test_3(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 1, 0), (1, 0)) def test_4(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 1, 2), (3, 0)) def test_5(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 5, 5), (0, 1)) def test_6(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 9, 1), (0, 1)) def test_7(self): self.assertEqual(Ex__1_single_digit_adder.add_digits( 9, 9), (8, 1)) if __name__ == '__main__': unittest.main() 
To execute the tests, assuming Python is installed and is in your path, execute the following command:
python Ex__1_test_single_digit_adder.py This is the output of a test run: C:\>python Ex__1_test_single_digit_adder.py ....... ---------------------------------------------------------------------- Ran 7 tests in 0.001s OK 

Exercise 2

Create arrays of 40 decimal digits each for the addend, accumulator, and carry. Prompt the user for two decimal integers of up to 40 digits each. Perform the addition digit by digit using the cycles described in Exercise 1, and collect the carry output from each digit position in the carry array. After the cycles are complete, insert carries and, where necessary, ripple them across digits to complete the addition operation. Display the results after each cycle and at the end. Test with the same sums as in Exercise 1 and test 99+1, 999999+1, 49+50, and 50+50.

Answer

The Ex__2_40_digit_adder.py Python file contains the adder code:
#!/usr/bin/env python """Ex__2_40_digit_adder.py: Answer to Ch 1 Ex 2.""" import sys import Ex__1_single_digit_adder # Add two decimal numbers of up to 40 digits and return the # sum. Input and output numeric values are represented as # strings. def add_40_digits(str1, str2): max_digits = 40 # Convert str1 into a 40 decimal digit value num1 = [0]*max_digits for i, c in enumerate(reversed(str1)): num1[i] = int(c) - int('0') # Convert str2 into a 40 decimal digit value num2 = [0]*max_digits for i, c in enumerate(reversed(str2)): num2[i] = int(c) - int('0') # Sum the digits at each position and record the # carry for each position sum = [0]*max_digits carry = [0]*max_digits for i in range(max_digits): (sum[i], carry[i]) = Ex__1_single_digit_adder. \ add_digits(num1[i], num2[i]) # Ripple the carry values across the digits for i in range(max_digits-1): if (carry[i] == 1): sum[i+1] = (sum[i+1] + 1) % 10 if (sum[i+1] == 0): carry[i+1] = 1 # Convert the result into a string with leading zeros # removed sum.reverse() sum_str = "".join(map(str, sum)) sum_str = sum_str.lstrip('0') or '0' return sum_str 
The Ex__2_test_40_digit_adder.py file contains the test code:
#!/usr/bin/env python """Ex__2_test_40_digit_adder.py: Tests for answer to  chapter 1 exercise 2.""" import unittest import Ex__2_40_digit_adder class Test40DigitAdder(unittest.TestCase): def test_1(self): self.ass...

Table of contents