Practical Computer Architecture with Python and ARM by Alan Clements
Author:Alan Clements [Alan Clements]
Language: eng
Format: epub, pdf
ISBN: 9781837636679
Publisher: Packt Publishing
Published: 2023-07-31T00:00:00+00:00
Summary
In this chapter, we presented the TC1 simulator, which can take a text file in TC1 assembly language, convert it into machine code, and then execute it. TC1âs instruction set architecture is close to the classic RISC architecture with a register-to-register architecture (i.e., data operations take place on the contents of registers). The only memory operations permitted are loading a register from memory (or a literal) and storing a register in memory.
The simulator has two basic components: an assembler that translates a mnemonic such as ADD r1,r2,r3 into a 32-bit binary instruction, and an interpreter that reads the instruction, extracts the necessary information, and then executes the instruction.
Some of the elements of TC1 are rather unusual. A free-format structure for the source code is provided; for example, you can write ADD r1,r2,r3 or adD R1 r2 r3 and both instructions will be happily accepted. Why? First, it was done to demonstrate the use of string processing in Python. Second, it makes it easier for the user to enter input in their chosen case. All input is automatically converted into uppercase to make the language case-free. Similarly, a comma or space is allowed as a separator between parameters. Finally, the need for [] brackets to indicate indirect addressing was removed. Users may enter LDRI r0,[r1] or LDRI r0,r1.
Similarly, numbers can be entered in different forms (decimal, binary, or hexadecimal); for example, number bases can be indicated in Motorola format or Python format. Most real assemblers donât permit such luxury.
The first versions of TC1 required all addresses to be numeric; if you wanted to branch to line 30, you had to write BRA 30. It was the remarkable power and ease of use of Pythonâs dictionary structure that made it so easy to include labels. All you have to do is recognize a label, pop it in the dictionary together with its value, and then, whenever you encounter that label, just look up its value in the dictionary.
We also provided an example assembly language program to test TC1 and a short discussion of how we go about testing various instructions.
Having designed TC1, we created a rather simplified version and called it TC1mini. This simulator does not provide the same flexibility in writing instructions, and it does not have a large instruction set. It also does not encode the instruction into a binary form and then decode it again and execute it. It executes the assembly instruction directly (thanks one more to Pythonâs dictionary mechanism).
At the end of this chapter, we provided yet another simplified computer simulator to both emphasize the structure of a computer simulator and provide an example of the way in which you can modify the basic design.
In this key chapter, we introduced the TC1 computer simulator and presented its design. We also looked at variations of TC1 to help create a more complete picture of the simulator and assembler. In the next chapter, we will take things a step further and look at some more aspects of the simulator. We will describe several simulators that have different architectures.
Download
Practical Computer Architecture with Python and ARM by Alan Clements.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12508)
Hello! Python by Anthony Briggs(9858)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9746)
The Mikado Method by Ola Ellnestam Daniel Brolund(9738)
Dependency Injection in .NET by Mark Seemann(9284)
Hit Refresh by Satya Nadella(8767)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(8701)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8249)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7736)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7731)
Grails in Action by Glen Smith Peter Ledbrook(7658)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7506)
The Kubernetes Operator Framework Book by Michael Dame(7273)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7060)
Exploring Deepfakes by Bryan Lyon and Matt Tora(7058)
Practical Computer Architecture with Python and ARM by Alan Clements(6982)
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(6980)
Robo-Advisor with Python by Aki Ranin(6955)
Building Low Latency Applications with C++ by Sourav Ghosh(6832)
