<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Computation Strcture on MT&#39;s blog</title>
    <link>https://rmtt.github.io/zh/categories/computation-strcture/</link>
    <description>Recent content in Computation Strcture on MT&#39;s blog</description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Fri, 05 Nov 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://rmtt.github.io/zh/categories/computation-strcture/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Sequential Logic</title>
      <link>https://rmtt.github.io/zh/posts/computation-structure/computation-structure-05/</link>
      <pubDate>Fri, 05 Nov 2021 00:00:00 +0000</pubDate>
      <guid>https://rmtt.github.io/zh/posts/computation-structure/computation-structure-05/</guid>
      <description>&lt;h1 id=&#34;sequential-logic&#34;&gt;Sequential Logic&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;课程地址：https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2017/c5/c5s1/&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;
&lt;p&gt;用简单的逻辑门与/或/非可以实现很多逻辑函数，但有一种很简单的电路，却没办法用与/或/非直接实现，如下图所示的开关电路。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/simple-switch.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;普通的组合逻辑电路和开关电路最大的区别在于开关电路的输出还于当前的输出(状态)有关。&lt;/p&gt;
&lt;p&gt;为了用逻辑电路来实现相同的功能，首先得让电路能&lt;em&gt;记住&lt;/em&gt;上一次的状态。&lt;/p&gt;
&lt;h2 id=&#34;memory&#34;&gt;Memory&lt;/h2&gt;
&lt;h3 id=&#34;using-capacitors&#34;&gt;Using Capacitors&lt;/h3&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/memory-capacitor.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;如上图所示，电容是可以存储 ”电压“ 的装置，所以很容易想到用电容来实现存储电路。不过在现实环境中，电容没办法做到完全不漏电，所以用电容实现的存储电路每隔一段时间要充一次电。&lt;/p&gt;
&lt;p&gt;DRAM便是类似的原理，需要定时刷新电容上的电压，特点是体积小，便宜。&lt;/p&gt;
&lt;h3 id=&#34;using-feedback&#34;&gt;Using Feedback&lt;/h3&gt;
&lt;p&gt;另一个实现存储电路的思路便是正反馈，如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/memory-feedback.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;上图中用两个&lt;em&gt;invertor&lt;/em&gt;实现的正反馈电路可以使输出稳定保持，但除了高低两个状态，还有一个中间的状态，而且该电路也可能会永远保持在中间的状态，所以我们需要避免这种情况。&lt;/p&gt;
&lt;h3 id=&#34;settable-memory&#34;&gt;Settable Memory&lt;/h3&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/settable-memory-element.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;我们可以用一个两位的MUX来实现一个可设定的Memory.&lt;/p&gt;
&lt;p&gt;这样的元件叫做D-latch, 即D锁存器。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/d-latch.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;要理解D-latch输入输出和时间的关系，如下图。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/plea-for-lenience.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/little-displine-for-d-latch.png&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;try-it-out&#34;&gt;Try it out&lt;/h3&gt;
&lt;p&gt;虽然D-锁存器能够存储状态，但当有一连串的状态输入时，如果要保证每次只有一个状态能通过，然后被其余逻辑电路读取，然后下一个状态才能通过的话，需要对时间做非常严格的限制，但在实际环境中，各种干扰和噪声让这种限制变得几乎不太可能。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/try-it-out.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;move-to-register&#34;&gt;Move to Register&lt;/h2&gt;
&lt;h3 id=&#34;flaky-control-system&#34;&gt;Flaky Control System&lt;/h3&gt;
&lt;p&gt;为了解决上面&lt;em&gt;Try it out&lt;/em&gt;中提到的问题，这里先用一个现实中的例子来解释一下：&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/flaky-control-system-1.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/flaky-control-system-2.png&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;d-register&#34;&gt;D-Register&lt;/h3&gt;
&lt;p&gt;我们可以按如上的例子用D-latch来实现一个这样的系统。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/d-register.png&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;各种时序图&#34;&gt;各种时序图&lt;/h3&gt;
&lt;p&gt;理解D-Register的时序很重要！！！&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/D-Register-waveforms.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/D-Register-hold-time.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/D-Register-timeing-1.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://blog-img.rmtt.fun/posts/computation-structure-05/sequential-logic-summary.png&#34;&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
