Skip to content

Commit

Permalink
Site updated: 2024-07-30 17:12:10
Browse files Browse the repository at this point in the history
  • Loading branch information
sh10f committed Jul 30, 2024
1 parent 93f8520 commit db8b33b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions 2024/07/30/计算机组成与结构复习/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/img_blog/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BB%84%E6%88%90%E4%B8%8E%E7%BB%93%E6%9E%84_index.png">
<meta property="article:published_time" content="2024-07-30T08:30:34.000Z">
<meta property="article:modified_time" content="2024-07-30T09:02:45.555Z">
<meta property="article:modified_time" content="2024-07-30T09:11:43.777Z">
<meta property="article:author" content="ShihaoF">
<meta property="article:tag" content="大二下">
<meta property="article:tag" content="计算机组成与结构">
Expand Down Expand Up @@ -425,7 +425,7 @@ <h2 id="Power-and-Energy"><a href="#Power-and-Energy" class="headerlink" title="
<li><p>power(功耗):能量(Energy)消耗的速率</p>
<ul>
<li><p>动态power:由于晶体管切换产生</p>
<p><img src="imgs\\energ&power.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301627569.png" srcset="/img/loading.gif" lazyload width=50%></p>
</li>
<li><p>静态power:由于”漏电流”的流动产生,与晶体管规模相关</p>
</li>
Expand All @@ -440,9 +440,9 @@ <h2 id="Power-and-Energy"><a href="#Power-and-Energy" class="headerlink" title="
</ul>
</li>
</ul>
<h3 id="Example-Power"><a href="#Example-Power" class="headerlink" title="Example: Power"></a>Example: Power</h3><p><img src="imgs\\Example_Power.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="Cost"><a href="#Cost" class="headerlink" title="Cost"></a>Cost</h2><p><img src="imgs\\Cost.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="imgs\\Example_Cost.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-Power"><a href="#Example-Power" class="headerlink" title="Example: Power"></a>Example: Power</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301627016.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="Cost"><a href="#Cost" class="headerlink" title="Cost"></a>Cost</h2><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301627950.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301627540.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="两个关键性能指标"><a href="#两个关键性能指标" class="headerlink" title="两个关键性能指标"></a>两个关键性能指标</h2><ul>
<li>时延(latency):完成一个任务所需要的时间</li>
<li>吞吐率(throughput):单位时间内完成的任务数</li>
Expand Down Expand Up @@ -471,26 +471,26 @@ <h2 id="Amdahl-定律"><a href="#Amdahl-定律" class="headerlink" title="Amdahl
</li>
<li>$F_x\rightarrow 1, speedup \rightarrow S_x$</li>
</ul>
<h3 id="Example-Amdahl"><a href="#Example-Amdahl" class="headerlink" title="Example: Amdahl"></a>Example: Amdahl</h3><p><img src="imgs\\Example_Amdahl.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-Amdahl"><a href="#Example-Amdahl" class="headerlink" title="Example: Amdahl"></a>Example: Amdahl</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628940.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="CPU-time"><a href="#CPU-time" class="headerlink" title="CPU time"></a>CPU time</h2><p>$CPU \, time \,=\, IC \,\times\, CPI \,\times\, CCT $</p>
<p>$CPI \,=\, \sum_{i=1}^{n} (IF_i \,\times\, CPI_i)$</p>
<p>CPI类似吞吐率</p>
<p><img src="imgs\\CPUtime.png" srcset="/img/loading.gif" lazyload width=50%></p>
<h3 id="Example-CPU-time"><a href="#Example-CPU-time" class="headerlink" title="Example: CPU time"></a>Example: CPU time</h3><p><img src="imgs\\Example_CPUtime1.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="imgs\\Example_CPUtime2.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628860.png" srcset="/img/loading.gif" lazyload width=50%></p>
<h3 id="Example-CPU-time"><a href="#Example-CPU-time" class="headerlink" title="Example: CPU time"></a>Example: CPU time</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628811.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628008.png" srcset="/img/loading.gif" lazyload width=50%></p>
<h2 id="Homework-1"><a href="#Homework-1" class="headerlink" title="Homework 1"></a>Homework 1</h2><ul>
<li>未改进的部分在old和new的执行时间相同</li>
</ul>
<p><img src="imgs\\homework1_1.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="imgs\\homework1_2.png" srcset="/img/loading.gif" lazyload width=50%></p>
<h1 id="Chapter-3-Instruction-Set-Principles"><a href="#Chapter-3-Instruction-Set-Principles" class="headerlink" title="Chapter 3: Instruction Set Principles"></a>Chapter 3: Instruction Set Principles</h1><h2 id="通用寄存器结构优缺点"><a href="#通用寄存器结构优缺点" class="headerlink" title="通用寄存器结构优缺点"></a>通用寄存器结构优缺点</h2><p><img src="imgs\\GPR.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="imgs\\GPRcons.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628565.png" srcset="/img/loading.gif" lazyload width=50%></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628642.png" srcset="/img/loading.gif" lazyload width=50%></p>
<h1 id="Chapter-3-Instruction-Set-Principles"><a href="#Chapter-3-Instruction-Set-Principles" class="headerlink" title="Chapter 3: Instruction Set Principles"></a>Chapter 3: Instruction Set Principles</h1><h2 id="通用寄存器结构优缺点"><a href="#通用寄存器结构优缺点" class="headerlink" title="通用寄存器结构优缺点"></a>通用寄存器结构优缺点</h2><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628793.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628527.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h1 id="Chapter-4-Pipelining"><a href="#Chapter-4-Pipelining" class="headerlink" title="Chapter 4: Pipelining"></a>Chapter 4: Pipelining</h1><p>流水线概念:将指令的处理过程分解为若干可区分的段(stage),确保有足够的硬件资源使得在每个段能够处理不同的指令。</p>
<h2 id="流水线计算"><a href="#流水线计算" class="headerlink" title="流水线计算"></a>流水线计算</h2><h3 id="吞吐率"><a href="#吞吐率" class="headerlink" title="吞吐率"></a>吞吐率</h3><p><img src="imgs\\Pipeline_throughput.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="流水线计算"><a href="#流水线计算" class="headerlink" title="流水线计算"></a>流水线计算</h2><h3 id="吞吐率"><a href="#吞吐率" class="headerlink" title="吞吐率"></a>吞吐率</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628477.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<ul>
<li></li>
</ul>
<h3 id="Cost-1"><a href="#Cost-1" class="headerlink" title="Cost"></a>Cost</h3><p><img src="imgs\\Pipeline_cost.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Cost-1"><a href="#Cost-1" class="headerlink" title="Cost"></a>Cost</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628135.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="流水线注意点"><a href="#流水线注意点" class="headerlink" title="流水线注意点"></a>流水线注意点</h2><ul>
<li>流水线无助于单任务的时延,只是提高了整体的吞吐率<ul>
<li>甚至会增加单指令的执行时间,由于流水线额外开销</li>
Expand Down Expand Up @@ -544,23 +544,23 @@ <h3 id="控制冲突"><a href="#控制冲突" class="headerlink" title="控制
<h1 id="Chapter-5-Instruction-Level-Parallelism"><a href="#Chapter-5-Instruction-Level-Parallelism" class="headerlink" title="Chapter 5: Instruction Level Parallelism"></a>Chapter 5: Instruction Level Parallelism</h1><h2 id="动态分支预测"><a href="#动态分支预测" class="headerlink" title="动态分支预测"></a>动态分支预测</h2><h3 id="分支历史表-BHT"><a href="#分支历史表-BHT" class="headerlink" title="分支历史表(BHT)"></a>分支历史表(BHT)</h3><ul>
<li>一个指令一个表项,可能表项复用</li>
</ul>
<h3 id="Example-BHT"><a href="#Example-BHT" class="headerlink" title="Example: BHT"></a>Example: BHT</h3><p><img src="imgs\\Example_BHT.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-BHT"><a href="#Example-BHT" class="headerlink" title="Example: BHT"></a>Example: BHT</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301628049.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="相关分支预测(m-n-2-level-predictor"><a href="#相关分支预测(m-n-2-level-predictor" class="headerlink" title="相关分支预测(m,n) 2-level predictor"></a>相关分支预测(m,n) 2-level predictor</h3><ul>
<li>BHT只使用了单条指令过去的表现来预测未来的情况</li>
<li>相关分支预测使用 $m$ 条分支指令的 $2^m$ 个predictor,每个predictor占 $n$ bit来预测当前分支</li>
</ul>
<h3 id="Example-Correlation-Branch-Predict"><a href="#Example-Correlation-Branch-Predict" class="headerlink" title="Example: Correlation Branch Predict"></a>Example: Correlation Branch Predict</h3><p><img src="imgs\\CorrelationBranchPredict.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="imgs\\(2,2)CBP.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="分支目标缓冲-BTB"><a href="#分支目标缓冲-BTB" class="headerlink" title="分支目标缓冲(BTB)"></a>分支目标缓冲(BTB)</h3><p><img src="imgs\\BTB.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-BTB"><a href="#Example-BTB" class="headerlink" title="Example: BTB"></a>Example: BTB</h3><p><img src="imgs\\Example_BTB.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-Correlation-Branch-Predict"><a href="#Example-Correlation-Branch-Predict" class="headerlink" title="Example: Correlation Branch Predict"></a>Example: Correlation Branch Predict</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629988.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629358.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="分支目标缓冲-BTB"><a href="#分支目标缓冲-BTB" class="headerlink" title="分支目标缓冲(BTB)"></a>分支目标缓冲(BTB)</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629306.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-BTB"><a href="#Example-BTB" class="headerlink" title="Example: BTB"></a>Example: BTB</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629888.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="循环展开"><a href="#循环展开" class="headerlink" title="循环展开"></a>循环展开</h2><p>步骤:</p>
<ol>
<li>重复循环体多次</li>
<li>融合不必要的指令</li>
<li>消除名相关</li>
<li>调整指令顺序</li>
</ol>
<p><img src="imgs\\unroll.png" srcset="/img/loading.gif" lazyload width=40% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629482.png" srcset="/img/loading.gif" lazyload width=40% ></p>
<h1 id="Chapter-6-Memory-Hierarchy-Design"><a href="#Chapter-6-Memory-Hierarchy-Design" class="headerlink" title="Chapter 6: Memory Hierarchy Design"></a>Chapter 6: Memory Hierarchy Design</h1><h2 id="为什么内存层次设计是必要的"><a href="#为什么内存层次设计是必要的" class="headerlink" title="为什么内存层次设计是必要的?"></a>为什么内存层次设计是必要的?</h2><p>内存层次结构设计在计算机架构中至关重要,原因有几个,主要与性能、成本和能效有关。以下是详细解释:</p>
<ul>
<li><p>性能改进:</p>
Expand Down Expand Up @@ -600,11 +600,11 @@ <h3 id="全相联映射"><a href="#全相联映射" class="headerlink" title="
<h3 id="多路组相联映射"><a href="#多路组相联映射" class="headerlink" title="多路组相联映射"></a>多路组相联映射</h3><p>主存储器中的某块可以存放到Cache中的唯一set中的任意位置</p>
<p><strong>相联程度增加 -&gt; #Block in Set增加 -&gt; #Set减小 -&gt; 查找时间增加 -&gt; 不命中率减少</strong></p>
<h3 id="Example-Cache-Size"><a href="#Example-Cache-Size" class="headerlink" title="Example: Cache Size"></a>Example: Cache Size</h3><p><strong>注意有一个 1-bit 的 valid位</strong></p>
<p><img src="imgs\\Example_CacheSize.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629836.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="查找规则"><a href="#查找规则" class="headerlink" title="查找规则"></a>查找规则</h2><p><strong>先通过 Index 定位 Set; 再通过 Tag 定位 Block</strong></p>
<h3 id="Example-Cache-Search"><a href="#Example-Cache-Search" class="headerlink" title="Example: Cache Search"></a>Example: Cache Search</h3><p><img src="imgs\\Example_CacheSearch.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h3 id="Example-Cache-Search"><a href="#Example-Cache-Search" class="headerlink" title="Example: Cache Search"></a>Example: Cache Search</h3><p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629107.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<h2 id="Quiz-Cache"><a href="#Quiz-Cache" class="headerlink" title="Quiz: Cache"></a>Quiz: Cache</h2><p><strong>注意最后是 Tag comparison, 不用加上定位set的那一次</strong></p>
<p><img src="imgs\\Quiz_Cache.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p><img src="https://cdn.jsdelivr.net/gh/sh10f/images/img/202407301629478.png" srcset="/img/loading.gif" lazyload width=50% ></p>
<p></p>
<h2 id="写策略"><a href="#写策略" class="headerlink" title="写策略"></a>写策略</h2><p>写回 与 写直达——按写分配 与 不按写分配</p>
<ul>
Expand Down
Loading

0 comments on commit db8b33b

Please sign in to comment.