Computer Organization and Design RISC-V Edition

 

计算机组织与设计 RISC-V 版

Image

关于

作者

David A. Patterson & John L. Hennessy

译者

Google翻译

译文摘抄

2.1. Introduction
2.1.简介

To command a computer’s hardware, you must speak its language. The words of a computer’s language are called instructions, and its vocabulary is called an instruction set . In this chapter, you will see the instruction set of a real computer, both in the form written by people and in the form read by the computer. We introduce instructions in a top-down fashion. Starting from a notation that looks like a restricted programming language, we refine it step-by-step until you see the actual language of a real computer. Chapter 3 continues our downward descent, unveiling the hardware for arithmetic and the representation of floating-point numbers.
要控制计算机的硬件,您必须说它的语言。计算机语言的单词称为指令,其词汇称为指令集。在本章中,你将看到真实计算机的指令集,既有人编写的形式,也有计算机读取的形式。我们以自上而下的方式引入指令。从看起来像受限制的编程语言的符号开始,我们逐步完善它,直到您看到真实计算机的实际语言。第三章继续深入,揭示算术硬件和浮点数的表示。

instruction set
指令集

The vocabulary of commands understood by a given architecture.
给定架构理解的命令词汇表。

You might think that the languages of computers would be as diverse as those of people, but in reality, computer languages are quite similar, more like regional dialects than independent languages. Hence, once you learn one, it is easy to pick up others.
你可能认为计算机的语言和人类的语言一样多种多样,但实际上,计算机语言非常相似,更像是地区方言而不是独立的语言。因此,一旦你学会了一个,学习其他的就很容易了。

The chosen instruction set is RISC-V, which was originally developed at UC Berkeley starting in 2010.
选择的指令集是 RISC-V,最初是从 2010 年开始在加州大学伯克利分校开发的。

To demonstrate how easy it is to pick up other instruction sets, we will also take a quick look at two other popular instruction sets.
为了演示选择其他指令集有多么容易,我们还将快速浏览一下其他两个流行的指令集。

  1. MIPS is an elegant example of the instruction sets designed since the 1980s. In several respects, RISC-V follows a similar design. MIPS 是自 20 世纪 80 年代以来设计的指令集的一个优雅示例。在多个方面,RISC-V 遵循类似的设计。

  2. The Intel x86 originated in the 1970s, but still today powers both the PC and the Cloud of the post-PC era.
    Intel x86 起源于 20 世纪 70 年代,但至今仍为 PC 和后 PC 时代的云提供动力。

This similarity of instruction sets occurs because all computers are constructed from hardware technologies based on similar underlying principles and because there are a few basic operations that all computers must provide. Moreover, computer designers have a common goal: to find a language that makes it easy to build the hardware and the compiler while maximizing performance and minimizing cost and energy. This goal is time-honored; the following quote was written before you could buy a computer, and it is as true today as it was in 1946:
指令集出现这种相似性是因为所有计算机都是根据相似的基本原理由硬件技术构建的,并且因为所有计算机都必须提供一些基本操作。此外,计算机设计人员有一个共同的目标:找到一种语言,可以轻松构建硬件和编译器,同时最大限度地提高性能并最大限度地降低成本和能源。这个目标由来已久;以下引言是在您购买计算机之前写下的,无论在今天还是在 1946 年,这句话都是正确的:

It is easy to see by formal-logical methods that there exist certain [instruction sets] that are in abstract adequate to control and cause the execution of any sequence of operations.… The really decisive considerations from the present point of view, in selecting an [instruction set], are more of a practical nature: simplicity of the equipment demanded by the [instruction set], and the clarity of its application to the actually important problems together with the speed of its handling of those problems.
通过形式逻辑方法很容易看出,存在某些抽象的[指令集]足以控制并导致任何操作序列的执行。……从目前的角度来看,在选择一个指令集时真正具有决定性的考虑因素是[指令集]更具有实用性:[指令集]所需设备的简单性,其对实际重要问题的应用的清晰度以及处理这些问题的速度。

Burks, Goldstine, and von Neumann, 1946
伯克斯、戈德斯坦和冯·诺依曼,1946 年

The “simplicity of the equipment” is as valuable a consideration for today’s computers as it was for those of the 1940s. The goal of this chapter is to teach an instruction set that follows this advice, showing both how it is represented in hardware and the relationship between high-level programming languages and this more primitive one. Our examples are in the C programming language; Section 2.15 shows how these would change for an object-oriented language like Java.
对于今天的计算机和 20 世纪 40 年代的计算机来说,“设备的简单性”都是一个有价值的考虑因素。本章的目标是教授遵循此建议的指令集,展示它如何在硬件中表示以及高级编程语言与这种更原始的语言之间的关系。我们的例子是用C语言编写的; 第 2.15 节展示了对于像 Java 这样的面向对象语言来说这些将如何改变。

By learning how to represent instructions, you will also discover the secret of computing: the stored-program concept . Moreover, you will exercise your “foreign language” skills by writing programs in the language of the computer and running them on the simulator that comes with this book. You will also see the impact of programming languages and compiler optimization on performance. We conclude with a look at the historical evolution of instruction sets and an overview of other computer dialects.
通过学习如何表示指令,您还将发现计算的秘密:存储程序概念。此外,你还将通过用计算机语言编写程序并在本书附带的模拟器上运行它们来锻炼你的“外语”技能。您还将看到编程语言和编译器优化对性能的影响。最后,我们回顾了指令集的历史演变以及其他计算机方言的概述。

stored-program concept
存储程序概念

The idea that instructions and data of many types can be stored in memory as numbers and thus be easy to change, leading to the stored-program computer.
许多类型的指令和数据可以作为数字存储在内存中,因此很容易更改,从而产生了存储程序计算机。

We reveal our first instruction set a piece at a time, giving the rationale along with the computer structures. This top-down, step-by-step tutorial weaves the components with their explanations, making the computer’s language more palatable. Figure 2.1 gives a sneak preview of the instruction set covered in this chapter.
我们一次展示我们的第一个指令集,给出基本原理以及计算机结构。这个自上而下的分步教程将组件及其解释编织在一起,使计算机的语言更容易接受。图 2.1 简要预览了本章介绍的指令集。

Elaboration:
详细说明:

RISC-V is an open architecture that is controlled by RISC-V International, not a proprietary architecture that is owned by a company like ARM, MIPS, or x86. In 2020, more than 200 companies are members of RISC-V International, and its popularity is growing rapidly.
RISC-V 是一种由 RISC-V International 控制的开放架构,而不是 ARM、MIPS 或 x86 等公司拥有的专有架构。 2020年,RISC-V国际组织的成员超过200家公司,其受欢迎程度正在迅速增长。

下载