Table of contents : Practical Computer Architecture with Python and ARM Contributors About the author About the reviewers Preface Who this book is for What this book covers To get the most out of this book Download the example code files Conventions used Get in touch Share Your Thoughts Download a free PDF copy of this book Part 1: Using Python to Simulate a Computer Chapter 1: From Finite State Machines to Computers Technical requirements The finite state machine Traffic lights example Solving a simple problem algorithmically Constructing an algorithm Summary Chapter 2: High-Speed Introduction to Python Technical requirements Reading programs Getting started with Python Python’s data types Mathematical operators Names, values, and variables Comments The list – a Python key data structure Slicing lists and strings Functions in Python Conditional operations and decision-making Using a conditional expression in Python Python’s if … else Reading data from a file Computer memory Register transfer language Summary Chapter 3: Data Flow in a Computer Technical requirements The Instruction Architecture Level (ISA) ISAs – the Naming of Parts The von Neumann architecture The address path Reading the instruction The CPU’s data paths Typical data movement instructions Data processing instructions Another look at the data flow An assembly-level program Executing conditional instructions Dealing with literal operands The machine-level instruction Instruction types and formats CISC and RISC Two ways of representing literals Summary Chapter 4: Crafting an Interpreter – First Steps Technical Requirements Building a simple computer interpreter in Python Python code for a primitive simulator The TC1 instruction set Bit-handling in Python Operator precedence in Python Decoding and executing an instruction Arithmetic and logical operations Functions in Python Branches and flow control Summary Chapter 5: A Little More Python Technical requirements More string features String processing Example – text Input List comprehensions The tuple Repetition and looping Repetition and Iterables Lists of lists Indenting in python The dictionary Functions revisited Imports Summary Chapter 6: TC1 Assembler and Simulator Design Technical requirements Analyzing instructions Processing the input Dealing with assembler directives Using the dictionary Labels Building the binary instruction Extracting the instruction and its parameters Intermission: The Pre-TC1 The Simulator The TC1 simulator program Single-stepping File input Example of a TC1 assembly language program Testing the assembler Testing flow control operations Testing shift operations TC1 postscript The classDecode function The testLine function The testIndex() function General comments The TC1tiny code listing TC1 postscript mark II Summary Chapter 7: Extending the TC1 Technical requirements Another look at python’s input and output Displaying data Input validation Validating data Adding new instructions First example – putting two memory locations in ascending order Second example – adding a bit-reversal instruction A new comparison operation Variable-length instructions A variable-length instruction machine Summary Chapter 8: Simulators for Other Architectures Technical requirements TC0: A stack-based calculator TC0: A python stack machine TC2: A one-address accumulator machine Enhancing the TC2 Simulator TC3: A CISC machine with a register-to-memory architecture The TC3 instruction set architecture Features of the simulator The complete TC3 code A sample run of TC3 Arithmetic and Logic Unit (ALU) Testing the ALU A final example: TC4 Comments on TC4 Summary Part 2: Using Raspberry Pi to Study a Real Computer Architecture Chapter 9: Raspberry Pi: An Introduction Technical requirements Raspberry Pi basics Basics of the Raspberry Pi operating system Directory navigation File operations Installing and updating programs and packages Creating and editing an assembly language program Assembling ARM code Debugging assembly language Using the Raspberry Pi debugger Accessing memory Features of the GCC ARM assembler Dealing with 32-bit literals A note on endianism Bringing everything together – a final example Summary Chapter 10: A Closer Look at the ARM Technical requirements Introducing the ARM Overview of the ARM’s architecture Arm register set Arithmetic instructions Flow control instructions Unconditional branches Conditional branch Conditional executions Sequential conditional execution Summary Chapter 11: ARM Addressing Modes Literal addressing Scaled literals Register indirect addressing Pointer-based addressing with an offset Two pointers are better than one Automatic indexing of pointer registers Example of string-copying Program counter-relative addressing Demonstration of program counter relative addressing Summary Chapter 12: Subroutines and the Stack The Branch with link instruction The stack A subroutine call and return Block move instructions Disassembling the code Block moves and stack operations Summary Appendices – Summary of Key Concepts Using IDLE Instructions and commands Running an ARM program Common confusions Vocabulary Index Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts Download a free PDF copy of this book