• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 71,  comments - 41,  trackbacks - 0
            ? 2003 by Charles C. Lin. All rights reserved.

            Introduction

            The goal of any computer organization course, in my mind, is to give you the understanding of how a computer works.

            In particular, I want to show you how to build a computer. This isn't a real computer, but it's not exactly fake either. A real computer requires many features to make it run fast, to interact with the keyboard, the mouse, the Internet, and so forth. All of those peripherals are very important when it comes to using a computer, and yet, they are really only secondary when it comes to understanding how a computer fundamentally works.

            The computer we'll build is not one you can buy from a store, or from someplace online. You'll never play a game, or watch a video, or write and compile a program on this computer.

            The purpose is to "build" a very rudimentary computer, and to make you believe that this computer could possibly work. Many details are left out. For example, we don't worry about very low level details. Silicon and semiconductor physics are not the point of this exercise.

            We'll work at a more abstract level, concerning ourselves with registers, wires, combinational and sequential logic devices. While these may not make any sense to you know, they should become clearer later on.

            We're not going to worry about how to make a computer run fast either. So our system doesn't include any caches, or pipelines. Nevertheless, by understanding the computer we build, you should have enough understanding to see how a more efficient computer can be built.

            Our goal is to build a CPU that can run a small subset MIPS32 ISA. Why MIPS32? Of all ISAs, MIPS32 is very simple. Simple doesn't mean bad. In fact, simple, in this case, means it can be efficient. It's also great for instruction purposes because it's easier to understand than IA32 (the instruction set for x86).

            We pick one ISA because this makes life simple. I could talk about half a dozen different ISAs, but that's like discussing half a dozen different programming languages. In the end, you know 6 programming languages badly, instead of one programming language well. By concetrating on one example, you learn how it works, and then you have something to compare it to when you learn other ISAs.

            What is a Computer?

            For us, a computer is going to consist of two devices: a CPU (central processing unit) and memory. These two devices are connected by a bus.

            The CPU consists of several parts.

            • registers

              Registers are very fast memory on the CPU. The CPU we're considering consists of 32 32-bit registers. We'll label them $r0 through $r31.

            • ALU

            What Does a Computer Do?

            A computer's purpose is to run programs. A program is a large number of machine code instructions (written in binary).

            Instructions are part of an ISA (instruction set architecture). An ISA tells you a valid set of instructions. The actual CPU runs those instructions. Think of an ISA as a kind of specification and the actual CPU as the implementation of the specifications.

            The individual steps for running a single instructions is:

            • Fetch an instrution

              We assume all programs are stored in memory. We get an instruction, one at a time, and copy it from memory to the CPU. This instruction is copied to a special register called the instruction register, or IR, for short.

              A typical ISA instruction is add $r2, $r3, $r4 which adds the contents of register 3 to the contents of register 4, and stores the result into register 2 (overwriting the previous contents of register 2).

              Note that this instruction is written in pseudo-English, much like C++ code is written in pseudo-English. The CPU processes a binary translation of this instruction. The actual instruction is really a 32-bit bitstring which stands for the add instruction.

            • Decode an instrution/Operand Fetch

              Once the instruction is in the CPU, the CPU has to figure out what instruction was fetched. Based on the binary pattern of the instruction, the CPU begins to fetch operands.

              Think of an instruction as a function. The operands are the arguments to the function. For the most part, the operands are stored in registers, so the CPU must get the data from the registers so it can be processed.

            • Execute instruction using ALU

              The ALU (arithmetic-logic unit) is a combinational logic device that performs operations based on some control inputs. For example, an ALU can add, subtract, do bitwise operations, and so forth. You tell the ALU what to do by setting the control bits correctly. If you change the control bits, the operation of the ALU also changes.

              The ALU has two 32-bit inputs. The inputs of the ALU can come from anywhere, but in the CPU we're talking about, it comes from two registers from the register file.

              For example, the contents of $r3 and $r4 can be fed in as inputs into the ALU. The ALU also has control inputs to tell it what to do. The CPU can set the control inputs so the ALU performs, say, addition, on its inputs.

              The ALU has a 32-bit output, which is the result of performing the operation on the input.

            • Memory Access (for loads and stores)

              The only instructions that interact with memory are load and store. This occurs at this step. This step is skipped for other instructions. However, load and stores are important enough to mention them at this step. We'll see why it has to be at this step.

            • Write Back to Register File

              The result of the ALU is stored at some register specified by the instruction. For example, in the instruction add $r2, $r3, $r4, the result is stored in the first register, which is $r2

            • Update PC

              The PC (program counter) stores the address of the next instruction to be fetched. Normally this is the address of the old instruction plus 4.

            These steps are repeated over and over until the program concludes.

            Understanding the Pieces

            Initially, our goal is to understand the various parts of the computer. In particular:
            • hidden registers: PC (program counter) and IR (instruction register) plus a few more registers.
            • the register file this device contains the user-visible registers, i.e., registers $r0 through $r31.
            • memory this is where the instructions and data are stored
            • ALU this performs arithmetic or logical operations on data stored in the register.
            • various parts We'll also use wires, other registers, multiplexers, and a few other devices.

            We begin by understanding the following parts:

            • What a wire is
            • What a bus is
            • What a clock is
            • What a register is
            • What a register file is
            • What an ALU is
            We'll talk about how to connect the various parts together and how these parts can execute instructions.

            Review Questions

            • What is a computer?
            • What are registers?
            • What is an ALU?
            • What is memory?
            posted on 2007-01-23 14:28 Charles 閱讀(341) 評論(0)  編輯 收藏 引用 所屬分類: 拿來主義
            <2007年3月>
            25262728123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            決定開始寫工作日記,記錄一下自己的軌跡...

            常用鏈接

            留言簿(4)

            隨筆分類(70)

            隨筆檔案(71)

            charles推薦訪問

            搜索

            •  

            積分與排名

            • 積分 - 50764
            • 排名 - 448

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲精品高清国产一久久| 久久精品人人做人人爽电影 | 久久高清一级毛片| 欧美亚洲日本久久精品| 无码国内精品久久综合88| 久久精品亚洲精品国产色婷 | 久久免费视频网站| 久久国产高清一区二区三区| 久久国语露脸国产精品电影| 97久久超碰成人精品网站| 亚洲伊人久久成综合人影院| 国内精品久久久久影院日本| 亚洲欧洲久久久精品| 国产精品99久久免费观看| 久久天天躁狠狠躁夜夜2020一 | 无码人妻久久一区二区三区免费 | 国产精品久久久久国产A级| 伊人久久大香线蕉AV一区二区| 色综合久久无码五十路人妻| 国产毛片久久久久久国产毛片 | 久久九色综合九色99伊人| 久久国产免费观看精品3| 久久无码高潮喷水| 久久这里只有精品视频99| 精品久久8x国产免费观看| 亚洲午夜久久久久久噜噜噜| 一极黄色视频久久网站| 久久久久免费视频| 狠狠久久综合伊人不卡| 精品国产乱码久久久久久郑州公司| 国内精品伊人久久久久妇| 亚洲欧美成人久久综合中文网 | 伊人久久大香线焦综合四虎| 久久亚洲精品中文字幕| 久久久久久久波多野结衣高潮| 久久WWW免费人成—看片| 久久国产成人亚洲精品影院| 国内精品伊人久久久久网站| 99精品久久久久久久婷婷| 国产日韩久久久精品影院首页| 99久久www免费人成精品|