The Elements of Computing Systems: Building a Modern Computer from First Principles
Noam Nisan, Shimon Schocken
Format: PDF / Kindle (mobi) / ePub
In the early days of computer science, the interactions of hardware, software, compilers, and operating system were simple enough to allow students to see an overall picture of how computers worked. With the increasing complexity of computer technology and the resulting specialization of knowledge, such clarity is often lost. Unlike other texts that cover only one aspect of the field, The Elements of Computing Systems gives students an integrated and rigorous picture of applied computer science, as its comes to play in the construction of a simple yet powerful computer system.
Indeed, the best way to understand how computers work is to build one from scratch, and this textbook leads students through twelve chapters and projects that gradually build a basic hardware platform and a modern software hierarchy from the ground up. In the process, the students gain hands-on knowledge of hardware architecture, operating systems, programming languages, compilers, data structures, algorithms, and software engineering. Using this constructive approach, the book exposes a significant body of computer science knowledge and demonstrates how theoretical and applied techniques taught in other courses fit into the overall picture.
Designed to support one- or two-semester courses, the book is based on an abstraction-implementation paradigm; each chapter presents a key hardware or software abstraction, a proposed implementation that makes it concrete, and an actual project. The emerging computer system can be built by following the chapters, although this is only one option, since the projects are self-contained and can be done or skipped in any order. All the computer science knowledge necessary for completing the projects is embedded in the book, the only pre-requisite being a programming experience.The book's web site provides all tools and materials necessary to build all the hardware and software systems described in the text, including two hundred test programs for the twelve projects. The projects and systems can be modified to meet various teaching needs, and all the supplied software is open-source.
sixth bit is simply ignored. As a rule, when the 2’s complement method is applied to n-bit numbers, x + (–x) always sums up to 2n (i.e., 1 followed by n 0’s)—a property that gives the method its name. Figure 2.1 illustrates a 4-bit binary system with the 2’s complement method. An inspection of figure 2.1 suggests that an n-bit binary system with 2’s complement representation has the following properties: Figure 2.1 2’s complement representation of signed numbers in a 4-bit binary system.
memory (ROM), a screen, and a keyboard, all implemented as internal parts. In order to execute a program, the program’s code must be preloaded into the ROM. Control of the screen and the keyboard is achieved via their memory maps, as described in the Screen and Keyboard chip specifications. 5.3 Implementation This section gives general guidelines on how the Hack computer platform can be built to deliver the various services described in its specification (section 5.2). As usual, we
depicted on the right. Figure 7.2 Stack processing example, illustrating the two elementary operations push and pop. Following convention, the stack is drawn upside down, as if it grows downward. The location just after the top position is always referred to by a special pointer called sp, or stack pointer. The labels a and b refer to two arbitrary memory addresses. As usual in computer science, simplicity and elegance imply power of expression. The simple stack model is a versatile
calling commands and extends the basic translator into a full-scale virtual machine implementation. Program and Command Structure A VM program is a collection of one or more files with a .vm extension, each consisting of one or more functions. From a compilation standpoint, these constructs correspond, respectively, to the notions of program, class, and method in an object-oriented language. Within a .vm file, each VM command appears in a separate line, and in one of the following formats:
and Access ■ The local variables of a Jack subroutine are allocated to, and accessed via, the virtual local segment. ■ The argument variables of a Jack subroutine are allocated to, and accessed via, the virtual argument segment. ■ The static variables of a . jack class file are allocated to, and accessed via, the virtual static segment of the corresponding .vm file. ■ Within a VM function corresponding to a Jack method or a Jack constructor, access to the fields of the this object is obtained