• <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.

            Register File, Part 1

            Consider a typical R-type instruction.
               add $r10, $r3, $r4   # R[10] = R[3] + R[4]
            The first step to executing this instruction is fetching the operands. In this case, we need to get the values of $r3 and $r4.

            Recall that the CPU processes a 32-bit machine code instruction that's translated from the assembly code above, and encoded in that instruction are the 3 registers. In particular, each of the register is encoded using 5 bit UB.

            For example, register 3 is encoded as 00011 and register 4 is encoded as 00100.

            We're going to create a circuit called a register file. This circuit contains all 32 user-visible integer registers. We could create one for floating point, but that's not absolutely necessary. You'll still understand how a CPU works if we leave out floating point registers (they work pretty much like the integer registers).

            We want the ability to access both registers (in this case, $r3 and $r4) at the same time. That way, we can save time. If we have to access one register at a time, it would slow down the execution of the instruction.

            So, we have two sets of inputs to our register file, which specify which two registers we want. They can even be the same register.

            Here's how our initial register file looks:

            We've labelled the inputs as SRC 1 Index and SRC 2 Index, which are 5 bits each. We can think of registers 3 and 4 and source registers, and their result is stored in the destination register (in our example, it's $r10).

            Register File, Part 2

            However, we need the register file to have outputs. These outputs are going to be 32 bits each since each register in MIPS32 has 32 bits. The outputs are the contents of the registers specified by SRC 1 Index and SRC 2 Index. Thus SRC 1 Data is the contents of the register specified by SRC 1 Index, and SRC 2 Data is the contents of the register specified by SRC 2 Index.

            Register File, Part 3

            At this point, the two 32-bit outputs are sent to the ALU (we'll discuss the ALU in more detail soon). The ALU does computations on these and produces a 32-bit result. This result is saved back into the destination register. The register file needs 32-bit data as input as a 5-bit index. We'll call these DST Index and DST Data for short.

            The DST Index comes from the instruction itself, just as SRC 1 Index and SRC 2 Index did. In our example, that's the encoding of $r10 (which is 01010).

            It turns out we need one more input, in addition to DST Index and DST Data. Even though this particular instruction updates a destination register, not every instruction does so. We want to control when a register value is updated in the register file.

            This control signal is called RegWrite and it's only 1 bit. If RegWrite = 1, then a write is performed on the register specified by DST Index, using the 32-bit data given by DST Data. If RegWrite = 0, then no write is performed. Both DST Index and DST Data are ignored.

            Which reminds me, we have to talk about a clock. The register file also has a clock. The diagram below is now complete.

            Why no RegRead?

            You may wonder why there's no RegRead to control when the register file outputs SRC 1 Data and SRC 2 Data.

            The reason is simple. SRC 1 Data and SRC 2 Data are sent to the outside world (i.e., to other parts of the CPU). Those parts can simply choose to ignore the data, if they don't need it.

            However, when you are performing a write on a register using DST Index and DST Data, you are updating the register file. The register file can't very well ignore that. To give it the option to ignore it, we must include RegWrite.

            Clocks

            The register file should be thought of as partly using the clock and partly not.

            SRC 1 Data and SRC 2 Data are output with a small delay given a change in SRC 1 Index and SRC 2 Index. If you're curious about the implementation (or, more precisely, if you're curious about an implementation), look at the MAR from the previous set of notes.

            You can see that it's hooked up to tri-state buffers. Once the tri-state buffers are enabled (which doesn't require a clock), the output is sent to the address bus.

            Similarly, SRC 1 Index and SRC 2 Index enable two 32-bit tri-state buffers. In particular, they enable the tri-state buffers to the registers specified by SRC 1 Index and SRC 2 Index.

            Again, this part does not need a clock. If SRC 1 Index and SRC 2 Index both change, then the tri-state buffers associated with the new registers are enabled (while the previous ones are disabled), and they are output after a small delay.

            Writing Requires a Clock

            However, when you want to write to a register, you are performing a parallel load on that register. This operation relies on a clock. We're going to assume that the register file, like MAR and MDR, is loaded on negative edges. This allows computations to be performed by the rest of the CPU before registers are loaded.

            Summary

            A register file is a black box that contains 32 32-bit registers. At any one time, you can specify up to two registers to "read" and one register to write, with the option to decide whether you want to write or not.

            Reading a value from the register file does not require a clock. Once you specify the registers you want to read (i.e., SRC 1 Index and SRC 2 Index), then there's only a small delay before the data comes out of the register file via SRC 1 Data and SRC 2 Data.

            Writing a value to the register file does require a clock. You can specify which register you want to write to (using DST Index), the data you want to write (using DST Data) and whether you really want to write to the register file or not (using RegWrite). This action takes place on the negative edge of the clocks. (Positive edges are used to transition in the finite state machine and set up control signals for ALU, MUX, tri-state buffers, etc).

            posted on 2007-01-24 09:25 Charles 閱讀(888) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): 拿來(lái)主義
            <2008年3月>
            2425262728291
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            決定開(kāi)始寫(xiě)工作日記,記錄一下自己的軌跡...

            常用鏈接

            留言簿(4)

            隨筆分類(lèi)(70)

            隨筆檔案(71)

            charles推薦訪(fǎng)問(wèn)

            搜索

            •  

            積分與排名

            • 積分 - 51390
            • 排名 - 449

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            日产精品久久久久久久| 亚洲精品高清国产一久久| 欧美一区二区精品久久| 浪潮AV色综合久久天堂| 久久精品国产亚洲AV影院| 一本大道久久东京热无码AV| 久久99久久无码毛片一区二区 | 国产成人久久777777| 久久久久久免费一区二区三区 | 亚洲国产欧美国产综合久久| 狠狠色丁香婷婷久久综合五月| 99久久免费国产精品特黄| 久久亚洲精品国产精品婷婷| 亚洲国产精品综合久久网络| 亚洲欧美国产日韩综合久久| 久久91精品国产91| 亚洲中文字幕久久精品无码APP| 99久久精品免费看国产一区二区三区| 亚洲AV无码久久精品狠狠爱浪潮 | 一本综合久久国产二区| 久久妇女高潮几次MBA| 亚洲AV无码久久精品成人 | 久久精品国产日本波多野结衣| 久久久久国产精品人妻| 亚洲αv久久久噜噜噜噜噜| 国产成人久久激情91| 久久无码精品一区二区三区| 97精品伊人久久久大香线蕉| 久久99精品国产99久久| 色偷偷88欧美精品久久久| 三上悠亚久久精品| 久久精品国产99久久丝袜| 天天躁日日躁狠狠久久| 国产综合免费精品久久久| 伊人久久综合精品无码AV专区| 久久香蕉一级毛片| 亚洲va中文字幕无码久久| 久久精品不卡| 99久久精品九九亚洲精品| 亚洲精品美女久久久久99| 久久久久久亚洲精品不卡|