Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Computer Architecture with Python and ARM

You're reading from   Computer Architecture with Python and ARM Learn how computers work, program your own, and explore assembly language on Raspberry Pi

Arrow left icon
Product type Paperback
Published in Jul 2023
Publisher Packt
ISBN-13 9781837636679
Length 412 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alan Clements Alan Clements
Author Profile Icon Alan Clements
Alan Clements
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1: Using Python to Simulate a Computer
2. Chapter 1: From Finite State Machines to Computers FREE CHAPTER 3. Chapter 2: High-Speed Introduction to Python 4. Chapter 3: Data Flow in a Computer 5. Chapter 4: Crafting an Interpreter – First Steps 6. Chapter 5: A Little More Python 7. Chapter 6: TC1 Assembler and Simulator Design 8. Chapter 7: Extending the TC1 9. Chapter 8: Simulators for Other Architectures 10. Part 2: Using Raspberry Pi to Study a Real Computer Architecture
11. Chapter 9: Raspberry Pi: An Introduction 12. Chapter 10: A Closer Look at the ARM 13. Chapter 11: ARM Addressing Modes 14. Chapter 12: Subroutines and the Stack 15. Index 16. Other Books You May Enjoy Appendices – Summary of Key Concepts

Preface

A fundamental thread of computer science is computer architecture. This topic was once called computer hardware and is concerned with the physical computer itself; that is, the central processing unit (CPU), memory, buses, and peripherals. Computer hardware contrasts with computer software, which applies to the programs, applications, and operating systems that computers execute.

Most users are no more concerned with computer hardware and architecture than drivers worry about the operation of their vehicles’ carburetors. However, a knowledge of computer architecture is useful in many ways, ranging from how efficiently you operate your computer to maximizing its security. A good analogy is with pilots. They learn how to fly an aircraft, and a knowledge of how its engines operate is considered absolutely vital in handling abnormal situations, prolonging the engine life, and minimizing fuel consumption.

Computer architecture is a large subject and is broadly divided into three interrelated areas: instruction set architecture (ISA), computer organization, and computer hardware. The ISA represents the programmer’s view of the computer; that is, it’s an abstract model of what a computer does (rather than how it does it). For example, the programmer is interested in a computer’s instruction set, which includes operations such as add P,A,B, which adds A to B and puts the sum in P. This book explains computer architecture by demonstrating how you can write a program that simulates a computer.

The part of computer science that deals with how a computer implements the actions of its architecture is called computer organization and is largely beyond the scope of this text. Computer organization is concerned with the gates and circuits of the computer.

An author can’t do justice to all the aspects of a computer in one book. Here, I am interested in tackling one topic: the ISA. I am going to introduce the computer’s instruction set and explain what it does. I will also discuss different types of instruction sets; for example, the ARM processor found in most mobile phones is very different from the Intel and AMD processors at the heart of PCs and laptops. In the second part of this book, we will concentrate on a specific computer and look at a real-world architecture, the ARM processor.

This book is different. There are books on computer architecture. There are books on Python. There are books on the Raspberry Pi computer. Here, we combine all three of these topics. However, I don’t do this in a superficial way leaving the reader with a shallow and unsatisfactory knowledge of each topic.

My intention is to introduce a computer architecture and its instruction set. That is, I am going to explain how a computer works at the level of its native instructions (called assembly language). I describe what an instruction does and how it is read, interpreted (i.e., decoded), and then executed (implemented). I will also discuss the type of operations computers implement.

So, how does Python fit into this scheme? Python is a popular high-level programming language that is freely available for use on the PC, Apple Mac, and Raspberry Pi. Moreover, Python is probably the easiest computer language to learn, and it is remarkably powerful.

People learn by doing. I have decided to include sufficient Python for the reader to construct a simple computer simulator that can read a machine-level computer instruction and execute it. Because I will show how this Python simulator works, students can build computers to their own specifications. They can experiment with instruction sets, addressing modes, instruction formats, and so on. They can even build different types of computers to their own specifications, for example, by using complex instruction set computer (CISC) or reduced instruction set computer (RISC) architectures. CISC and RISC offer two different philosophies of computer design. Essentially, RISC computers have fixed-length instructions that permit only register load and store memory operations, whereas CISC computers can have variable-length instructions and permit direct data operations on memory. In reality, the distinction between RISC and CISC is more complex. The first generation of microprocesses all conformed to CISC philosophy.

Readers can build computers because they can write a program in Python that will execute the target language of a specific computer architecture and they can design that target language themselves.

One of the most popular computer architectures is the ARM processor found in countless mobile applications and even Apple laptops. Not only is this an economically dominant processor family but it’s also very popular in education because of its interesting and innovative architecture and its relatively gentle learning curve. Even better, this is the processor used by the low-cost Raspberry Pi computer. You can run ARM code on Raspberry Pi using software tools that come with the computer. You can also run Python programs on Raspberry Pi with free software. Consequently, Raspberry Pi provides students with an excellent low-cost machine that lets them study core hardware topics with no further investment in hardware or software.

lock icon The rest of the chapter is locked
Next Section arrow right
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 R$50/month. Cancel anytime