<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ali Khudiyev</title>
    <description>It takes one&apos;s curiosity to try and one&apos;s sheer will to try again. — Ali Khudiyev</description>
    <link>/</link>
    <atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 07 Aug 2026 10:05:01 +0000</pubDate>
    <lastBuildDate>Fri, 07 Aug 2026 10:05:01 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Brainstormed</title>
        <description>&lt;p&gt;Have you ever had a flood of ideas? By a FLOOD of ideas, I mean at least
3-4 ideas that are seemingly really interesting to you. Most of the
ideas that occur to you initially end up not working (or not being
worthy of spending time on); at least this is how it’s been for me.
There are certain moments that one idea leads to another, and that one
leads to another, and so on, until you land onto THE ONE. In certain
moments, you initially get multiple ideas, but then after some time they
merge to one idea. In other moments, you may have a single idea
initially, but it may branch to multiple ideas.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/blog/idea-tree.png&quot; width=&quot;70%&quot; style=&quot;margin: auto;&quot; /&gt;
&lt;/figure&gt;

&lt;p&gt;The image above illustrates &lt;em&gt;linear progression&lt;/em&gt; of ideas on the top
(first level) and bottom part (fourth level) of the &lt;em&gt;idea chain&lt;/em&gt;,
&lt;em&gt;branching&lt;/em&gt; from the first level to the second level, &lt;em&gt;merging&lt;/em&gt; from the
third to the fourth level, and both &lt;em&gt;branch&lt;/em&gt; and &lt;em&gt;merging&lt;/em&gt; from the
second level to the third level. Out of the 11 ideas that you have
thought of, it is highly likely that the 11th idea will be the one to
spend most of your time on, compared to all the others that came before
it. Of course there will be times when you will go back to previous
ideas and maybe you will bring some of your old ideas to the frontline,
but this is only after spending so much time on your last (version of)
idea.&lt;/p&gt;

&lt;p&gt;People call this &lt;em&gt;brainstorming&lt;/em&gt;. I would like to introduce new concept:
&lt;strong&gt;brainstormed&lt;/strong&gt;. This word is for people who are constantly in a
brainstorming mode. They just cannot help themselves. One thought after
another keeps them actually distracted from the good ideas that they get
once in a while. This sounds bad, but I guess we cannot help ourselves
sometimes. You know, now I write about this stuff, it reminded of so
many CS projects that I have started but not finished, as well as the
writing process of my two books that I have shared on this website: &lt;a href=&quot;https://alikhudiyev.github.io/courses/self-study/c/tutorial/book/2025/01/15/c-book-1.html&quot;&gt;&lt;em&gt;A
Student’s C Book
I&lt;/em&gt;&lt;/a&gt;
and &lt;a href=&quot;https://alikhudiyev.github.io/courses/self-study/computer-architecture/draft/book/2026/05/12/computer-architecture-1.html&quot;&gt;&lt;em&gt;A Student’s Computer Architecture Book
I&lt;/em&gt;&lt;/a&gt;.
I one-handedly wrote these two books in a “one sitting”: not too much
thought or time was poured to writing or polishing the contents of the
books. This obviously lowers the quality of the content that I produce,
meaning that they could be way better than they are now if I were to
just spend another couple of months on them at least.&lt;/p&gt;

&lt;p&gt;Some people are brainstorming for an hour, some people walk brainstormed
days or even weeks. It may seem like we are always after “quick wins”,
and maybe we are, but I think it might be deeper than this. It sometimes
feels like a joy of being able to prove to yourself that you can do it.
You rush in the process of doing whatever you are doing because you want
to get challenged by something in the process; you want to encounter
that part fast. Doing the things you know over and over again is very
boring. It is the kick of the challenge that gets you going sometimes.
Now that this post becomes too long and boring, I need to go do
something else.&lt;/p&gt;
</description>
        <pubDate>Fri, 17 Jul 2026 14:10:00 +0000</pubDate>
        <link>/blog/fun/2026/07/17/brainstormed.html</link>
        <guid isPermaLink="true">/blog/fun/2026/07/17/brainstormed.html</guid>
        
        
        <category>blog</category>
        
        <category>fun</category>
        
      </item>
    
      <item>
        <title>Building General Purpose AI II (highly personal approach)</title>
        <description>&lt;p&gt;In this blog post, I will not build a GPAI for the readers,
unfortunately. That day is not today. Instead, I will try to describe
the setting in which the so-called GPAI will have to operate… the
setting in which humans operate in the real world. It is important to be
able to describe such a setting as accurately as possible since without
it we may not build strong beliefs and intuitions for how an intelligent
agent ought to operate under the real-world conditions. Without further
ado, let me get right into it.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;strong&gt;Axis&lt;/strong&gt;&lt;/th&gt;
      &lt;th&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;em&gt;Learning&lt;/em&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Offline &amp;ndash; Online/Continual&lt;/td&gt;
      &lt;td&gt;Online/Continual Learning&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Supervised &amp;ndash; Semi-Supervised &amp;ndash; Unsupervised &amp;ndash; Reinforcement&lt;/td&gt;
      &lt;td&gt;Semi-Supervised (+ RL)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Passive &amp;ndash; Active&lt;/td&gt;
      &lt;td&gt;Active Learning&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Single-Objective &amp;ndash; Multi-Objective&lt;/td&gt;
      &lt;td&gt;Multi-Objective Learning&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Disembodied &amp;ndash; Embodied/Grounded&lt;/td&gt;
      &lt;td&gt;Embodied/Grounded Learning&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;em&gt;Environment&lt;/em&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Episodic &amp;ndash; Sequential&lt;/td&gt;
      &lt;td&gt;Sequential Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Fully &amp;ndash; Partially Observable&lt;/td&gt;
      &lt;td&gt;Partially Observable Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Known &amp;ndash; Unknown&lt;/td&gt;
      &lt;td&gt;Unknown Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Deterministic &amp;ndash; Stochastic&lt;/td&gt;
      &lt;td&gt;Stochastic Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Single-Agent &amp;ndash; Multi-Agent&lt;/td&gt;
      &lt;td&gt;Multi-Agent Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Stationary &amp;ndash; Dynamic/Non-stationary&lt;/td&gt;
      &lt;td&gt;Dynamic Environment&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Closed &amp;ndash; Open-ended&lt;/td&gt;
      &lt;td&gt;Open-ended Environment&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;To sum the table above, what I am trying to tell is, (breathing in…)
&lt;strong&gt;Continual Active Learning with Semi-Supervision for Multi-Objective
Optimization for an Embodied Agent Partially Observing in a Sequential
and Open-ended Unknown Environment with Stochastic and Non-Stationary Dynamics
in the presence of Multi-Agents and Sparse Explicit Rewards&lt;/strong&gt;
(gasping…)&lt;/p&gt;

&lt;p&gt;I know: it sounds mouthful, but sometimes there is no shortcut for
describing a thing that has become so messy by the process of evolution.
Even the smallest details may matter when the process has been running
for too long. Emergence is not inherent to the nature, it “emerges” out
of our computational limits and how far to the future we can actually
see/compute. Everything within our reach is imminent and anything beyond
our reach is emergent.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Multiple architectures and approaches for (building) intelligent systems
have been proposed by scientists such as Richard Sutton, Yann LeCun,
Jurgen Schmidhuber, Markus Hutter. Richard Sutton et al. have proposed
the Options and Knowledge (OaK) architecture in &lt;a href=&quot;https://arxiv.org/abs/2209.11173&quot;&gt;The Alberta Plan for AI
Research&lt;/a&gt;, Yann LeCun has proposed his
architecture for autonomous intelligent agents in &lt;a href=&quot;https://openreview.net/pdf?id=BZ5a1r-kVsf&quot;&gt;A Path Towards
Autonomous Machine
Intelligence&lt;/a&gt;, Jurgen
Schmidhuber has proposed RNNAI in &lt;a href=&quot;https://arxiv.org/abs/1511.09249&quot;&gt;On Learning to Think: Algorithmic
Information Theory for Novel Combinations of Reinforcement Learning
Controllers and Recurrent Neural World
Models&lt;/a&gt;, Markus Hutter has proposed
universal AI in &lt;a href=&quot;https://arxiv.org/abs/cs/0004001&quot;&gt;A Theory of Universal Artificial Intelligence based on
Algorithmic Complexity&lt;/a&gt;.&lt;/p&gt;

&lt;figure id=&quot;fig:oak-arch&quot; style=&quot;text-align:center;&quot;&gt;
&lt;div class=&quot;minipage&quot; style=&quot;text-align:center;&quot;&gt;
&lt;img src=&quot;/assets/blog/oak-arch.png&quot; width=&quot;50%&quot; /&gt;
&lt;/div&gt;
&lt;figcaption&gt;The OaK Architecture by Richard Sutton et al.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure id=&quot;fig:objective-driven-ai-arch&quot; style=&quot;text-align:center;&quot;&gt;
&lt;div class=&quot;minipage&quot; style=&quot;text-align:center;&quot;&gt;
&lt;img src=&quot;/assets/blog/object-driven-ai-arch.png&quot; width=&quot;40%&quot; /&gt;
&lt;/div&gt;
&lt;figcaption&gt;The Objective-Driven AI Architecture by Yann
LeCun&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure id=&quot;fig:rnnai-arch&quot; style=&quot;text-align:center;&quot;&gt;
&lt;div class=&quot;minipage&quot; style=&quot;text-align:center;&quot;&gt;
&lt;img src=&quot;/assets/blog/rnnai.png&quot; width=&quot;40%&quot; /&gt;
&lt;/div&gt;
&lt;figcaption&gt;The RNNAI by Jurgen Schmidhuber&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure id=&quot;fig:aixi-arch&quot; style=&quot;text-align:center;&quot;&gt;
&lt;div class=&quot;minipage&quot; style=&quot;text-align:center;&quot;&gt;
&lt;img src=&quot;/assets/blog/aixi.png&quot; width=&quot;80%&quot; /&gt;
&lt;/div&gt;
&lt;figcaption&gt;The Universal AI (AIXI) by Markus Hutter&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The Alberta plan consists of 12 steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Representation I: Continual supervised learning with given features.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Representation II: Supervised feature finding.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prediction I: Continual Generalized Value Function (GVF) prediction
learning.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Control I: Continual actor-critic control.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prediction II: Average-reward GVF learning.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Control II: Continuing control problems.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Planning I: Planning with average reward.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prototype-AI I: One-step model-based RL with continual function
approximation.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Planning II: Search control and exploration.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prototype-AI II: The STOMP progression.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prototype-AI III: Oak.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Prototype-IA: Intelligence amplification.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The objective-driven AI requires constructing &lt;em&gt;world models&lt;/em&gt; that
leverage &lt;em&gt;joint-embedding predictive architecture (JEPA)&lt;/em&gt;:&lt;/p&gt;

&lt;figure id=&quot;fig:jepa-world-model&quot; style=&quot;text-align:center;&quot;&gt;
&lt;div class=&quot;minipage&quot; style=&quot;text-align:center;&quot;&gt;
&lt;img src=&quot;/assets/blog/jepa-world-model.png&quot; width=&quot;40%&quot; /&gt;
&lt;/div&gt;
&lt;!-- &lt;figcaption&gt;The Universal AI (AIXI) by Markus Hutter&lt;/figcaption&gt; --&gt;
&lt;/figure&gt;

&lt;hr /&gt;

&lt;p&gt;So, what is the conclusion of all this? Alberta plan seems to tackle the
right problem, which is &lt;em&gt;continual learning&lt;/em&gt; (w/o catastrophic
forgetting). Objective-driven AI has several abstract components in the
architecture, but it is still unclear to me how the JEPA architecture
will be able to learn the model of the world while utilizing fixed
memory and staying non-continual. Non-fixed memory/runtime complexity is
important because we often (rightfully) assume that the world is always
more complex than what one system can model or learn about it. AIXI is a
big infinite for-loop brute-forcing through every possible
program/hypothesis out there, and, well, no surprises: it is
incomputable. However, there is another version, AIXItl (time- and
lenght-bound AIXI), that is computable but not really what I am looking
for, I guess &amp;ndash; it does not have the constructive flavor that I would
love to taste, meaning that it states the obvious without being really
helpful.&lt;/p&gt;
</description>
        <pubDate>Sat, 20 Jun 2026 18:15:00 +0000</pubDate>
        <link>/blog/draft/ai/opinion/2026/06/20/building-ai-2.html</link>
        <guid isPermaLink="true">/blog/draft/ai/opinion/2026/06/20/building-ai-2.html</guid>
        
        
        <category>blog</category>
        
        <category>draft</category>
        
        <category>AI</category>
        
        <category>opinion</category>
        
      </item>
    
      <item>
        <title>Building General Purpose AI (highly personal approach)</title>
        <description>&lt;p&gt;When it comes to deep A(G)I research, I have not yet found good roadmap
for building truly intelligent system that is capable of decision
making, searching and planning, problem solving, and more importantly,
learning as it goes. Let alone a roadmap for building such a system,
there is still no precise and clear understanding of what such a system
formally is and how it ought to operate algorithmically. The field of AI
is really big, so let me draw the rough picture for you first. Here are
the main research communities within AI:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Structuralists&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;p&gt;Symbolists &amp;ndash; using hard-coded rules for decision-making, infused
domain knowledge for learning&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Probabilists &amp;ndash; using Bayesian inference for both decision-making
and learning&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Enactivists &amp;ndash; arguing for the need for embodiment because language
alone is not enough&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Cognitists &amp;ndash; understanding the architecture of human brain as the
fastest way to get to human-like intelligence&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Emergentists&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;p&gt;Connectionists &amp;ndash; distributing knowledge over many little nodes,
updating relations among the nodes for learning&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Evolutionists &amp;ndash; mutating and cross-overing a population of
potential solutions&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Empricists &amp;ndash; scale is all you need&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Rewardists &amp;ndash; reward is all you need&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Synthesists&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Neuro-symbolists &amp;ndash; viewing emergence and structure as intertwined
strings of the same thread&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fundamental processes of intelligence is &lt;strong&gt;search&lt;/strong&gt; and
&lt;strong&gt;substitution&lt;/strong&gt;. Searching works based on a simple binary yes-or-no
question asked over every element being observed: Am I looking at an
element X right now? Substituting is the action of searching with an
overwrite upon matching: $f(x)\big|_{x=5} = f(5)$. Blind (brute-force)
search does not need a prediction at all &amp;ndash; you just iterate and
explore. Informed search uses prediction as a heuristic to halt faster.
To predict something, you are always obliged to use (some mixture of)
search and/or substitution. Abstraction emerges from the prediction used
as a heuristic to speed up the search process. Compression is a specific
form of abstraction. Abstraction discards at least one specificity
present in the data while keeping the invariants of the search process
untouched (this also implies that an abstraction is useless without a
proper substituion process that gives us back the original data when
applied to the abstraction with a certain initialization of abstract
variables), whereas (lossless) compression gives a shorter
representation of the data with the original invariants untouched. Since
any shorter representation of the data must discard at least one
character, every compression is a form of abstraction; however, an
abstraction may occupy more space than the original data, because
“f(0)=0” is an instance of $f(x)=\frac{3}{7}x^3-5x^2+3.14x$.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Search slowly for $f(?)=0$, $f(?)=1$, …&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Use prediction to search faster $\rightarrow$ abstraction $f^-(y)$
emerges.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;$f^-(y)$ happens to be a good compression of the exaustive
(infinite) tabular data of the $(x, f(x)$ pairs for every $x$.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Where am I getting with all this, you may ask. Well, all this is to say
that any “truly intelligent” system must probably be capable of
&lt;em&gt;searching&lt;/em&gt; and &lt;em&gt;substituting&lt;/em&gt;. I know, this sounded like a useless
tautology. Let me add to it a little more spice: Moreover, any
general-purpose AI (GPAI) must probably be capable of adapting to its
environment. Adaptation is the guarantee of reaching the goal/desired
state in a changing environment without getting stuck at (revisiting)
the same set of states ad infinitum.&lt;/p&gt;

&lt;p&gt;Why not use pure memorization as a learning algorithm and a table lookup
as an inference/prediction algorithm? Well, here is the problem: what
happens when the system needs to make a prediction for a previously
unseen input? Intelligence isn’t all about memorization, even though it
plays an important role, it is also about prediction (i.e., inferring
something never inferred previously). It is this the ability of
predicting something truly new that makes the system adaptive in the
first place &amp;ndash; whether it be a changing environment or having a new
observation for the first time, from the system’s point of view it is
all the same, i.e., the environment has changed. Remember? Adaptivity
plays a huge role in intelligence. If the system answered “I don’t know
the answer” every time it was given a truly new observation that was no
where to be found in its memorization table (crisp dataset of all exact
past observations), then it would be foolish for us to expect it to give
a different answer at any point in the future for another novel
observation. Any strategy or algorithm we might use to fill in the gaps
in the system’s observation table computationally is a good step toward
the adaptive intelligence. Such an algorithm is called an &lt;em&gt;inference
algorithm&lt;/em&gt; for the system.&lt;/p&gt;

&lt;p&gt;Now, here are the pitfalls that we should need to consider before
setting big and ambitious goals regarding what can be theoretically
and/or practically done to build the most intelligent system.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about adapting to a given task on the go and
less about getting everything right from the first shot. (No Free
Lunch)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about relativistic error of a learner compared
against other possible learners on a given task, and not the
absolute error regarding the task being solved.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about un/self-supervised learning and less about
supervised learning.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about continual or lifelong learning and less
about fixed-time learning.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about online regret minimization and less about
offline loss minimization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about scalability and less about scaling,
because whatever that needs scaling by humans manually is not truly
scalable.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about active learning (with imperfect oracle)
and less about passive learning.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We should care more about imperfect supervisor (oracle) and less
about perfect supervisor (i.e., implying the assumption of
partial-observability in an environment because the environment is
also an implicit oracle).&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In my current world view, GPAI looks and does almost exactly like
mentioned in the numbered list above. I might be wrong or I might be
right, obviously. The things I have described in this blog post probably
says more about my personal research taste than a truly intelligent
systems out there. You can find my taste sweet or bitter, but in any
case I try to keep my taste open to different delicacies as much as I
can.&lt;/p&gt;
</description>
        <pubDate>Wed, 10 Jun 2026 14:30:00 +0000</pubDate>
        <link>/blog/draft/ai/opinion/2026/06/10/building-ai.html</link>
        <guid isPermaLink="true">/blog/draft/ai/opinion/2026/06/10/building-ai.html</guid>
        
        
        <category>blog</category>
        
        <category>draft</category>
        
        <category>AI</category>
        
        <category>opinion</category>
        
      </item>
    
      <item>
        <title>Your Effort is Your Worth</title>
        <description>&lt;p&gt;You have a bachelor’s diploma? -Yes. Add master’s degree to get more
credibility. Now you have a master’s diploma? -Yes. Add a PhD degree to
get more credibility. You say you already got it? -Yes. Add a postdoc
degree for more credibility. You say you did that, too? -Yes. Become a
professor to get the most credibility. Wait, you are a professor now?
-Yes. Now, forget about the credibility and go get a life.&lt;/p&gt;

&lt;p&gt;Credibility…credible…You mean the thing that people “earn” by
showing off their fancy certificates? Times are changing. AI starts
exposing the fake credibilities already so much in academia. It also
does so in industry by being used everyday by software developers and
engineers to build online banking services and systems. In universities,
undergrads are asked to write a scientific report to be able to graduate
in their final year, and guess how the reports are written. By heavily
using AI. Everything seems so smooth and homogenous. Every student seems
equally-capable &amp;ndash; the differences fade away. There is no smartest kid
in the room, nor the dumbest one. There are only different bodies with
the same intelectual output.&lt;/p&gt;

&lt;p&gt;In this current era of AI, credibility is not earned, it is generated.
Everything becomes indistinguishably fake. Posts written in proper
English start to seem ugly, and the ones with imperfections like this
one start to become ancient artifacts. We need new ways of solving
“credibility-assignment” problem. Maybe we always had the wrong idea of
how credibility should be assigned. Maybe &lt;em&gt;&lt;strong&gt;having&lt;/strong&gt; a good (scientific
or non-scientific) output&lt;/em&gt; shouldn’t have led to getting more
credibility in the first place. Instead, maybe &lt;em&gt;&lt;strong&gt;producing&lt;/strong&gt; a good
output&lt;/em&gt; should lead to more credibility. Or, even further than that:
maybe &lt;em&gt;it should be your effort that purely defines your credibility&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;What if it was the amount of effort that mattered, not whether the
output was or was not desirable in terms of the goals and milestones set
initially? &lt;em&gt;Genuinely high-effort works cannot be of low quality.&lt;/em&gt; Not
all long-worked scientific papers or software systems may reach the
desired goals of the person doing the work or the people waiting to
consume them. However, I would argue that it certainly does not
necessarily mean that the work carried has low value regarding the doors
it may open up in the future. The value of the work carried by a person
or a group of people is not in its outcomes solely, but also in its
rigor and insights discovered along the way. For what it’s worth, a
paper with unsatisfactory outcomes might have prevented others to fall
in the same path, or allow other to carve new paths out of the others’
(previous) deadends.&lt;/p&gt;

&lt;p&gt;To conclude, maybe we need a new systematic way of measuring the effort
and not the output. Your effort defines who you are more than your final
output. Cheating in universities has become easier, because universities
do not tend to measure students’ effort and the ones that do is more
AI-prone when it comes to cheating.&lt;/p&gt;
</description>
        <pubDate>Tue, 09 Jun 2026 13:40:00 +0000</pubDate>
        <link>/blog/opinion/2026/06/09/your-effort-is-your-worth.html</link>
        <guid isPermaLink="true">/blog/opinion/2026/06/09/your-effort-is-your-worth.html</guid>
        
        
        <category>blog</category>
        
        <category>opinion</category>
        
      </item>
    
      <item>
        <title>A Student&apos;s Computer Architecture Book I</title>
        <description>&lt;!-- &lt;!DOCTYPE html&gt; --&gt;
&lt;html lang=&quot;en&quot; xml:lang=&quot;en&quot;&gt; 
&lt;head&gt;&lt;title&gt;&lt;/title&gt; 
&lt;meta charset=&quot;utf-8&quot; /&gt; 
&lt;meta content=&quot;TeX4ht (https://tug.org/tex4ht/)&quot; name=&quot;generator&quot; /&gt; 
&lt;meta content=&quot;width=device-width,initial-scale=1&quot; name=&quot;viewport&quot; /&gt; 
&lt;link href=&quot;/assets/css/2026-05-12-computer-architecture-1.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt; 
&lt;meta content=&quot;2026-05-12-computer-architecture-1.tex&quot; name=&quot;src&quot; /&gt; 
&lt;script&gt;window.MathJax = { tex: { tags: &quot;ams&quot;, }, }; &lt;/script&gt; 
&lt;script async=&quot;async&quot; id=&quot;MathJax-script&quot; src=&quot;https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;  
&lt;/head&gt;&lt;body&gt;
                                                                          

                                                                          
&lt;!-- l. 31 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;/p&gt;&lt;!-- l. 31 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;!-- &lt;/p&gt;&lt;!-1- l. 33 -1-&gt;&lt;p class=&apos;noindent&apos;&gt;&lt;span class=&apos;cmr-17&apos;&gt;A Student’s Computer Architecture Book I&lt;/span&gt; --&gt;
&lt;!-- &lt;/p&gt;&lt;!-1- l. 34 -1-&gt;&lt;p class=&apos;noindent&apos;&gt;&lt;span class=&apos;cmr-12x-x-120&apos;&gt;Level 1. Introduction to Computer Architecture&lt;/span&gt; --&gt;
&lt;!-- &lt;/p&gt;&lt;!-1- l. 36 -1-&gt;&lt;p class=&apos;noindent&apos;&gt;&lt;span class=&apos;cmr-12x-x-120&apos;&gt;Ali Khudiyev&lt;/span&gt; --&gt;
                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- &lt;/p&gt; --&gt;
   &lt;h2 class=&quot;likechapterHead&quot; id=&quot;contents&quot;&gt;&lt;a id=&quot;x1-1000&quot;&gt;&lt;/a&gt;Contents&lt;/h2&gt;
   &lt;div class=&quot;tableofcontents&quot;&gt;
   &lt;span class=&quot;chapterToc&quot;&gt;1 &lt;a href=&quot;#the-essence-of-computing&quot; id=&quot;QQ2-1-2&quot;&gt;The Essence of Computing&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;1.1 &lt;a href=&quot;#outline-of-the-book&quot; id=&quot;QQ2-1-5&quot;&gt;Outline of the book&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;2 &lt;a href=&quot;#foundations-boolean-algebra&quot; id=&quot;QQ2-1-6&quot;&gt;Foundations &amp;amp; Boolean Algebra&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;2.1 &lt;a href=&quot;#numeral-systems&quot; id=&quot;QQ2-1-7&quot;&gt;Numeral Systems&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;2.2 &lt;a href=&quot;#boolean-algebra&quot; id=&quot;QQ2-1-8&quot;&gt;Boolean Algebra&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;2.2.1 &lt;a href=&quot;#laws&quot; id=&quot;QQ2-1-9&quot;&gt;Laws&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;2.2.2 &lt;a href=&quot;#theorems&quot; id=&quot;QQ2-1-10&quot;&gt;Theorems&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;2.3 &lt;a href=&quot;#boolean-functions&quot; id=&quot;QQ2-1-11&quot;&gt;Boolean Functions&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;2.3.1 &lt;a href=&quot;#canonical-representations&quot; id=&quot;QQ2-1-13&quot;&gt;Canonical Representations&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;2.3.2 &lt;a href=&quot;#boolean-function-simplification-with-karnaugh-maps&quot; id=&quot;QQ2-1-18&quot;&gt;Boolean Function Simplification with Karnaugh Maps&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;3 &lt;a href=&quot;#logic-gates-circuits&quot; id=&quot;QQ2-1-19&quot;&gt;Logic Gates &amp;amp; Circuits&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;3.1 &lt;a href=&quot;#not-and-or-xor-nor-xnor&quot; id=&quot;QQ2-1-20&quot;&gt;NOT, AND, OR, XOR, NOR, XNOR&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;3.2 &lt;a href=&quot;#universal-logic-gates&quot; id=&quot;QQ2-1-21&quot;&gt;Universal Logic Gates&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;4 &lt;a href=&quot;#combinational-logic&quot; id=&quot;QQ2-1-22&quot;&gt;Combinational Logic&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;4.1 &lt;a href=&quot;#foundational-combinational-circuits&quot; id=&quot;QQ2-1-23&quot;&gt;Foundational Combinational Circuits&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;4.1.1 &lt;a href=&quot;#multiplexer-mux&quot; id=&quot;QQ2-1-24&quot;&gt;Multiplexer (MUX)&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;4.1.2 &lt;a href=&quot;#demultiplexer-demux&quot; id=&quot;QQ2-1-30&quot;&gt;Demultiplexer (DEMUX)&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;4.1.3 &lt;a href=&quot;#encoder&quot; id=&quot;QQ2-1-33&quot;&gt;Encoder&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;4.1.4 &lt;a href=&quot;#decoder&quot; id=&quot;QQ2-1-34&quot;&gt;Decoder&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;4.2 &lt;a href=&quot;#timing&quot; id=&quot;QQ2-1-36&quot;&gt;Timing&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;5 &lt;a href=&quot;#sequential-logic&quot; id=&quot;QQ2-1-40&quot;&gt;Sequential Logic&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;5.1 &lt;a href=&quot;#finite-state-machine-fsm&quot; id=&quot;QQ2-1-42&quot;&gt;Finite State Machine (FSM)&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.1.1 &lt;a href=&quot;#moore-and-mealy-fsms&quot; id=&quot;QQ2-1-47&quot;&gt;Moore and Mealy FSMs&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.1.2 &lt;a href=&quot;#fsm-simplification&quot; id=&quot;QQ2-1-50&quot;&gt;FSM Simplification&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;5.2 &lt;a href=&quot;#clock&quot; id=&quot;QQ2-1-57&quot;&gt;Clock&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;5.3 &lt;a href=&quot;#memory&quot; id=&quot;QQ2-1-61&quot;&gt;Memory&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.3.1 &lt;a href=&quot;#sr-latch&quot; id=&quot;QQ2-1-64&quot;&gt;SR Latch&lt;/a&gt;&lt;/span&gt;
                                                                          

                                                                          
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.3.2 &lt;a href=&quot;#d-latch&quot; id=&quot;QQ2-1-66&quot;&gt;D Latch&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.3.3 &lt;a href=&quot;#d-flipflop&quot; id=&quot;QQ2-1-68&quot;&gt;D Flip-Flop&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.3.4 &lt;a href=&quot;#t-flipflop&quot; id=&quot;QQ2-1-73&quot;&gt;T Flip-Flop&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.3.5 &lt;a href=&quot;#jk-flipflop&quot; id=&quot;QQ2-1-74&quot;&gt;JK Flip-Flop&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;5.4 &lt;a href=&quot;#counter&quot; id=&quot;QQ2-1-76&quot;&gt;Counter&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.4.1 &lt;a href=&quot;#synchronous-up-counter&quot; id=&quot;QQ2-1-78&quot;&gt;Synchronous Up Counter&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.4.2 &lt;a href=&quot;#asynchronous-ripple-counter&quot; id=&quot;QQ2-1-79&quot;&gt;Asynchronous Ripple Counter&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;5.5 &lt;a href=&quot;#timing1&quot; id=&quot;QQ2-1-81&quot;&gt;Timing&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.5.1 &lt;a href=&quot;#setup-time-constraint&quot; id=&quot;QQ2-1-85&quot;&gt;Setup Time Constraint&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;5.5.2 &lt;a href=&quot;#hold-time-constraint&quot; id=&quot;QQ2-1-87&quot;&gt;Hold Time Constraint&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;6 &lt;a href=&quot;#lets-build-a-computer&quot; id=&quot;QQ2-1-89&quot;&gt;Let’s Build a Computer!&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.1 &lt;a href=&quot;#instruction-set-architecture&quot; id=&quot;QQ2-1-91&quot;&gt;Instruction Set Architecture&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.2 &lt;a href=&quot;#arithmetic&quot; id=&quot;QQ2-1-95&quot;&gt;Arithmetic&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.3 &lt;a href=&quot;#logic&quot; id=&quot;QQ2-1-98&quot;&gt;Logic&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.4 &lt;a href=&quot;#arithmetic-logic-unit-alu&quot; id=&quot;QQ2-1-100&quot;&gt;Arithmetic Logic Unit (ALU)&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.5 &lt;a href=&quot;#random-access-memory-ram&quot; id=&quot;QQ2-1-101&quot;&gt;Random Access Memory (RAM)&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;sectionToc&quot;&gt;6.6 &lt;a href=&quot;#the-dx-computer&quot; id=&quot;QQ2-1-102&quot;&gt;The DX8 Computer&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;6.6.1 &lt;a href=&quot;#singlecycle-multicycle-pipelined-design&quot; id=&quot;QQ2-1-103&quot;&gt;Single-cycle, Multi-cycle, Pipelined Design&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;6.6.2 &lt;a href=&quot;#stepper&quot; id=&quot;QQ2-1-106&quot;&gt;Stepper&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;6.6.3 &lt;a href=&quot;#controller&quot; id=&quot;QQ2-1-110&quot;&gt;Controller&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;subsectionToc&quot;&gt;6.6.4 &lt;a href=&quot;#putting-everything-together&quot; id=&quot;QQ2-1-116&quot;&gt;Putting everything together!&lt;/a&gt;&lt;/span&gt;
&lt;br /&gt;   &lt;span class=&quot;chapterToc&quot;&gt;7 &lt;a href=&quot;#epilogue&quot; id=&quot;QQ2-1-118&quot;&gt;Epilogue&lt;/a&gt;&lt;/span&gt;
   &lt;/div&gt;
                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 41 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;the-essence-of-computing&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 1&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-20001&quot;&gt;&lt;/a&gt;The Essence of Computing&lt;/h2&gt;
&lt;!-- l. 42 --&gt;&lt;p class=&quot;noindent&quot;&gt;You may have heard of Babbage’s machine. Yes, Charles Babbage’s Analytical
Engine. Well, there was actually his Difference Engine, too, for automated
polynomial calculations. Many consider his machine(s) very first computing
devices created by human species. However, I would say that the history of
computing goes way earlier than that. You’ll say, “of course, there is the Abacus
invented somwhere in between 1000-500 BC”. You would be right, but apparently
there is this 8 cm-long bone tool made of a baboon fibula that has been used by
humans of the Earth as early as 35,000 BCE. “What was its purpose?”, you
ask. There are some debates around its purpose, but it is believed to
be for counting days and tracking time. But of course, it would not be
correct to say the essence of computing started from 35,000 BCE. The
tools for computing may have started from that time, but the &lt;span class=&quot;cmbx-12&quot;&gt;essence of
computing &lt;/span&gt;was there way before the tools – when humans used their brains to
count or calculate stuff. Computing is not solely about the tools, but
about the process that can be carried, by using a computer, a simple
calculator, a pen and paper, 8 cm-long bone, human figers, or a human
imagination produced by its brain. You see, it can be very abstract to define
what really &lt;span class=&quot;cmbx-12&quot;&gt;computation &lt;/span&gt;is. The tools we invent and use help to achieve
&lt;span class=&quot;cmbx-12&quot;&gt;efficiency &lt;/span&gt;in our computations, that is how fast or energy-saving we
are when something is computed. However, the tools do not dictate the
absolute rules of computation, and in fact, one could argue that it is
the essence of computation that dictates the rules under which the tools
need to be operating. Even if there was no human population living on
the Earth, the essence of computation would still be there if one looked
upon the Earth from the dark cosmos. It is because you would still see
the planet moving, animals fighting, trees growing, bees flying, weather
changing, waves colliding, and other natural processes that cause the world to
move from one state into another. This change of states require spending
some energy: in computer science, we see this evergy as the computation
itself.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-2001r1&quot;&gt;&lt;span id=&quot;charles-babbages-machine-dating-back-to-s&quot;&gt;&lt;/span&gt;&lt;span id=&quot;lebonbo-bone-dating-back-to-around-bce&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          
&lt;a id=&quot;x1-2002r2&quot;&gt;&lt;/a&gt;
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;!-- l. 47 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/lebombo_bone.jpeg&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 1.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Lebonbo bone dating
back to around 35,000 BCE.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-2001r1  --&gt;      &lt;/div&gt; &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/babbage_machine.jpeg&quot; width=&quot;50%&quot; /&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 1.2:   &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Charles   Babbage’s
machine dating back to 1800s.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-2002r2  --&gt;     &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 58 --&gt;&lt;p class=&quot;indent&quot;&gt;   Surely you may think that we have come a long way. Right now, you
may be reading this from your personal computer (PC), or your phone,
or even from your smart watch. Just imagine how crazy this would be
for people living back in the days… They would probably declare you
as a witch and try to kill you, or as their technological god and try to
protect you. Who knows how the events would have turned up actually?!
What’s important for people living in these so-called modern times is
to realize the long history of computing and push it even further than
where it is standing currently. Doing that is surely a hard task, but if you
dedicate yourself enough, you may achieve something significant in your
lifespan.
&lt;/p&gt;&lt;!-- l. 60 --&gt;&lt;p class=&quot;indent&quot;&gt;   This book is for the beginners who got curious about computers and wondered
how they really work at some point in their lives. If you are one of those
people trying to get a good grasp of the things that happen inside your
computer, I hope that this book will be a friendly mentor that will help you
to learn this stuff by yourself. The book will guide you to build your
own computer piece by piece. Ideally I would want the reader to gain
confidence and be able to build series of computing devices as he/she wishes in
the future. You don’t need to be afraid of this seemingly complex and
magical-looking devices that we call computers or tablets or phones or smart
watches or calculators. Once you understand the foundational principles
and basic building blocks that stand behind these devices, you will gain
more confidence in building your own – your truly personal computer
(TPC).
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;outline-of-the-book&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;1.1   &lt;/span&gt; &lt;a id=&quot;x1-30001.1&quot;&gt;&lt;/a&gt;Outline of the book&lt;/h3&gt;
&lt;!-- l. 63 --&gt;&lt;p class=&quot;noindent&quot;&gt;”So, what does it take to build a computer?” you may ask. Well, it takes
readding the first &lt;span class=&quot;mathjax-inline&quot;&gt;\(\approx 70\)&lt;/span&gt; pages of this book to understand the fundamentals
first:
&lt;/p&gt;&lt;!-- l. 65 --&gt;&lt;p class=&quot;indent&quot;&gt;
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
                                                                          

                                                                          
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3002x1&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Foundations  &amp;amp;  Boolean  Algebra &lt;/span&gt;–  this  chapter  will  introduce
      mathematical context that is needed to work with formal boolean logic;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3004x2&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Logic Gates &amp;amp; Circuits &lt;/span&gt;– this chapter will introduce the physical
      logic components (gates) that can be connected to one another to build
      real electrical circuits that do something meaningful;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3006x3&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Combinational Logic &lt;/span&gt;– this chapter will show basic but essential
      circuits that are going to be used quite often in computer building
      process later on;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3008x4&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Sequential Logic &lt;/span&gt;– this chapter will generalize from the previous types
      of circuits you know and build more complex circuitry that are very
      foundational in building many components of a computer;&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 72 --&gt;&lt;p class=&quot;indent&quot;&gt;   Then it takes reading the rest &lt;span class=&quot;mathjax-inline&quot;&gt;\(\approx 15\)&lt;/span&gt; pages to put everything together and finally
build a custom 8-bit computer:
&lt;/p&gt;&lt;!-- l. 74 --&gt;&lt;p class=&quot;indent&quot;&gt;
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3010x1&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Let’s Build a Computer! &lt;/span&gt;– finally, this chapter will walk you through
      the “putting everything together” part, and by the end of it, you will
      first-hand experience building a computer from scratch;
      &lt;/li&gt;
                                                                          

                                                                          
&lt;li class=&quot;enumerate&quot; id=&quot;x1-3012x2&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Epilogue &lt;/span&gt;– the ending chapter will be chill and relax; because you
      will then be cheered for understanding so much stuff that you didn’t
      know before and for having the knowledge and courage now to build a
      computer by yourself if you wanted to do it.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 79 --&gt;&lt;p class=&quot;indent&quot;&gt;   What are you waiting for? Let’s get to it!
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;foundations-boolean-algebra&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 2&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-40002&quot;&gt;&lt;/a&gt;Foundations &amp;amp; Boolean Algebra&lt;/h2&gt;
   
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;numeral-systems&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.1   &lt;/span&gt; &lt;a id=&quot;x1-50002.1&quot;&gt;&lt;/a&gt;Numeral Systems&lt;/h3&gt;
&lt;!-- l. 83 --&gt;&lt;p class=&quot;noindent&quot;&gt;Counting is an important and unavoidable part of human life. It is so unavoidable
that people have invented multiple different ways of counting things. We put all of
these different ways of counting under the name of &lt;span class=&quot;cmti-12&quot;&gt;numeral systems&lt;/span&gt;. Let me
describe a few of numeral systems. First of all, there is additive numeral systems
and then there is positional systems. One example of an additive numeral system
is Roman numerals (e.g., VI means 5+1, which is 6). In additive numeral
systems, the position of each digit does not affect its magnitude (e.g., even
in number IV the calculation goes like -1+5, which is 4; the numbers
that are added have the magnitudes 1 and 5). In contrast, in positional
numeral systems, the place of each digit affects its magnitude (e.g., 123 in
decimal is 100 + 20 + 3 whereas 321 in decimal is 1 + 20 + 300). Since
positional systems have been more useful to work with in almost all areas of
mathematics and digital logic design, we are going to focus on them from now
on.
&lt;/p&gt;&lt;!-- l. 85 --&gt;&lt;p class=&quot;indent&quot;&gt;   You see, there are also different positional numeral systems. The difference
among positional numeral systems comes from the radix or the base used. The
radix (or the base) is the number of elementary symbols that all the numbers of
the numeral system are made of. These elementary symbols are also known as the
digits. For example, our beloved decimal system uses 10 digits (0, 1, 2, 3,
4, 5, 6, 7, 8, 9), and therefore, the radix is 10. In order to compute the
magnitude of the number, each digit in a decimal number is first multiplied
by the power of 10 according to the position in which the underlying
digit appears within the number and then the results are added, i.e.,
&lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {d_n, d_{n-1}, \dots , d_0}_{10} = 10^n \cdot d_n + 10^{n-1} \cdot d_{n-1} + \dots + 10^0 \cdot d_0\)&lt;/span&gt;.
&lt;/p&gt;&lt;!-- l. 87 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s now talk about other radices. There is this numeral systems known as
&lt;span class=&quot;cmbx-12&quot;&gt;hexadecimal&lt;/span&gt;, &lt;span class=&quot;cmbx-12&quot;&gt;octal&lt;/span&gt;, and &lt;span class=&quot;cmbx-12&quot;&gt;binary&lt;/span&gt;. The base used in hexadecimal is 16 (i.e.,
the digits from 0 to 15, inclusively), the base used in octal is 8 (i.e., the
digits from 0 to 7, inclusively), and the base used in binary is 2 (i.e.,
the digits 0 and 1). Similar to the magnitude calculation in the decimal
system, here is how the magnitudes are computed (in decimal) for these
systems:
&lt;/p&gt;
                                                                          

                                                                          
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \overline {h_n h_{n-1} \dots h_0}_{16} &amp;amp;= 16^n \cdot h_n + 16^{n-1} \cdot h_{n-1} + \dots + h_0 \\ \overline {o_n o_{n-1} \dots o_0}_{8} &amp;amp;= 8^n \cdot o_n + 8^{n-1} \cdot o_{n-1} + \dots + o_0 \\ \overline {b_n b_{n-1} \dots b_0}_{2} &amp;amp;= 2^n \cdot b_n + 2^{n-1} \cdot b_{n-1} + \dots + b_0 \end{align*}&lt;/div&gt;
   
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;boolean-algebra&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.2   &lt;/span&gt; &lt;a id=&quot;x1-60002.2&quot;&gt;&lt;/a&gt;Boolean Algebra&lt;/h3&gt;
&lt;!-- l. 96 --&gt;&lt;p class=&quot;noindent&quot;&gt;You already probably know what algebra is about. It is about working with
expressions that may have numbers, unknowns (or variables), and operators (such
as addition, subtraction, multiplication, division, and so on). The algebra that you
may have learned in high school is a general kind of algebra than the one we are
going to see in this chapter. The algebra you have learned may have an expression
as follows: &lt;span class=&quot;mathjax-inline&quot;&gt;\(3x^2 - \frac {4y}{z} + \frac {2}{7}xz^3\)&lt;/span&gt;. You may substitute &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt; with different numbers from
the real line &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbb {R}\)&lt;/span&gt; and then calculate the result of the expression as usual. In
boolean algebra we are going to restrict the operations only to addition (&lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {+}\)&lt;/span&gt;),
multiplication (&lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {\cdot }\)&lt;/span&gt;), and negation (&lt;span class=&quot;mathjax-inline&quot;&gt;\(\lnot \)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(&apos;\)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {\ }\)&lt;/span&gt;); and we restrict the numbers that can be
picked/used to a set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{0 ,1\}\)&lt;/span&gt;. This kind of algebra (with the restrictions we introduce) is
called &lt;span class=&quot;cmbx-12&quot;&gt;boolean algebra&lt;/span&gt;. Moreover, we will see all the laws that boolean
algebra uses. Although some of the laws are going to overlap with the ones
that the ones we used in the high school algebra, there are going to be
different laws as well. For example, we have learned in the high school
that if we say &lt;span class=&quot;mathjax-inline&quot;&gt;\(x=1\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y=1\)&lt;/span&gt; then the expression &lt;span class=&quot;mathjax-inline&quot;&gt;\(x + y\)&lt;/span&gt; evaluates to 2, but in boolean
algebra since there is no number 2 in our set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{0, 1\}\)&lt;/span&gt; the same expression &lt;span class=&quot;mathjax-inline&quot;&gt;\(x + y\)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 + 1\)&lt;/span&gt; will
evaluate to 1. This is very hand-wavy explanation, but we do not need to
understand the philosophical reasons behind every law described in this
chapter: these laws are the axioms of the boolean algebra, and hence need to
be accepted as they are stated. Now, let’s see all the 7 laws of boolean
algebra.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;laws&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.2.1   &lt;/span&gt; &lt;a id=&quot;x1-70002.2.1&quot;&gt;&lt;/a&gt;Laws&lt;/h4&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 99 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7001r1&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.1 &lt;/span&gt;(Commutativity)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;The order of operands does not affect the result.&lt;/span&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + b &amp;amp;= b + a \\ a \cdot b &amp;amp;= b \cdot a \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 108 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 110 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7002r2&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.2 &lt;/span&gt;(Associativity)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;The grouping of operands does not affect the result.&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} (a + b) + c &amp;amp;= a + (b + c) \\ (a \cdot b) \cdot c &amp;amp;= a \cdot (b \cdot c) \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 119 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 121 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7003r3&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.3 &lt;/span&gt;(Distributivity)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;Operations can be factored or expanded.&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a \cdot (b + c) &amp;amp;= a \cdot b + a \cdot c \\ a + (b \cdot c) &amp;amp;= (a + b) \cdot (a + c) \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 130 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 132 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7004r4&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.4 &lt;/span&gt;(Identity)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;0  is  additive  identity  –  it  means  that  &lt;/span&gt;&lt;span class=&quot;cmbxti-10x-x-120&quot;&gt;adding  with
zero &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;does not give us a different result than the other operand added. 1 is
multiplicative identity – it means that &lt;/span&gt;&lt;span class=&quot;cmbxti-10x-x-120&quot;&gt;multiplying with one &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;does not give
us a different result than the other multiplicant multiplied.&lt;/span&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + 0 = a \\ a \cdot 1 = a \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 141 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 143 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7005r5&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.5 &lt;/span&gt;(Idempotent)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;A different result cannot be obtained by adding or
multiplying the same operand with itself. (Just remember that the possible
numbers that we can use in binary is 0 and 1; therefore, 0 + 0 = 0 &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\cdot \) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;0 = 0
and 1 + 1 = 1 &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\cdot \) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;1 = 1 is true according to the laws of boolean algebra.)&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + a = a \\ a \cdot a = a \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 152 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 154 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7006r6&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.6 &lt;/span&gt;(Complement)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;Addition with a complement always results in 1.
Multiplying with a complement always results in 0.&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + a&apos; = 1 \\ a \cdot a&apos; = 0 \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 163 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 165 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-7007r7&quot;&gt;&lt;/a&gt;
                                                                          

                                                                          
&lt;span class=&quot;cmbx-12&quot;&gt;Law 2.7 &lt;/span&gt;(Domination)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;Adding with 1 always results in 1. Multiplying with
0 always results in 0.&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + 1 = 1 \\ a \cdot 0 = 0 \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 174 --&gt;&lt;p class=&quot;indent&quot;&gt;
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;theorems&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.2.2   &lt;/span&gt; &lt;a id=&quot;x1-80002.2.2&quot;&gt;&lt;/a&gt;Theorems&lt;/h4&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 177 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-8001r1&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 2.1 &lt;/span&gt;(De Morgan)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;Complement of a sum is equal to the product
of the individual complements, and complement of a product is equal to the
sum of the individual complements.&lt;/span&gt;
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} (a + b)&apos; &amp;amp;= a&apos; \cdot b&apos; \\ (a \cdot b)&apos; &amp;amp;= a&apos; + b&apos; \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 186 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 189 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;Let’s proceed with &lt;span class=&quot;cmbx-12&quot;&gt;proof by exhaustion &lt;/span&gt;where we will compute the
left-hand side (LHS) and right-hand side (RHS) of the equalities by going
through all the possible &lt;span class=&quot;mathjax-inline&quot;&gt;\(a\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(b\)&lt;/span&gt; choices from the set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{0, 1\}\)&lt;/span&gt;.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 191 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt; &lt;!-- tex4ht:inline --&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-1&quot;&gt;&lt;colgroup id=&quot;TBL-1-1g&quot;&gt;&lt;col id=&quot;TBL-1-1&quot; /&gt;&lt;col id=&quot;TBL-1-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-1-3g&quot;&gt;&lt;col id=&quot;TBL-1-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-1-4g&quot;&gt;&lt;col id=&quot;TBL-1-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-1-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; b  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((a+b)&apos;\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(a&apos; \cdot b&apos;\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-1-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((0 + 0)&apos; = 0&apos; = 1\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0&apos; \cdot 0&apos; = 1 \cdot 1 = 1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-1-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((0 + 1)&apos; = 1&apos; = 0\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0&apos; \cdot 1&apos; = 1 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-1-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((1 + 0)&apos; = 1&apos; = 0\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-1-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1&apos; \cdot 0&apos; = 0 \cdot 1 = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-1-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((1 + 1)&apos; = 1&apos; = 0\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-1-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1&apos; \cdot 1&apos; = 0 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                             &lt;/div&gt;
&lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 205 --&gt;&lt;p class=&quot;indent&quot;&gt;   Since the third column (LHS of De Morgan equation) and the fourth column
(RHS of De Morgan equation) match with each other at every row, we conclude
that the theorem is proven to be correct.                                            □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 208 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-8002r2&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 2.2 &lt;/span&gt;(Absorbtion)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a + a \cdot b &amp;amp;= a \\ a \cdot (a + b) &amp;amp;= a \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 215 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 218 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;By using proof by exhaustion,
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
&lt;!-- l. 220 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt; &lt;!-- tex4ht:inline --&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-2&quot;&gt;&lt;colgroup id=&quot;TBL-2-1g&quot;&gt;&lt;col id=&quot;TBL-2-1&quot; /&gt;&lt;col id=&quot;TBL-2-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-2-3g&quot;&gt;&lt;col id=&quot;TBL-2-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-2-4g&quot;&gt;&lt;col id=&quot;TBL-2-4&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-2-5g&quot;&gt;&lt;col id=&quot;TBL-2-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-2-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; b  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(a + a \cdot b\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot (a + b)\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-2-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 + 0 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot (0 + 0) = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-2-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 + 0 \cdot 1 = 0 + 0 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot (0 + 1) = 0 \cdot 1 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-2-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 + 1 \cdot 0 = 1 + 0 = 1\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-2-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot (1 + 0) = 1 \cdot 1 = 1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-2-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 + 1 \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-2-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot (1 + 1) = 1\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                        &lt;/div&gt;
&lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 234 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, the theorem has been proven.                                        □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 237 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-8003r3&quot;&gt;&lt;/a&gt;
                                                                          

                                                                          
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 2.3 &lt;/span&gt;(Consensus)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} a \cdot b + a&apos; \cdot c + b \cdot c = a \cdot b + a&apos; \cdot c \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 243 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 246 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;By using proof by exhaustion,
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
&lt;!-- l. 248 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt; &lt;!-- tex4ht:inline --&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-3&quot;&gt;&lt;colgroup id=&quot;TBL-3-1g&quot;&gt;&lt;col id=&quot;TBL-3-1&quot; /&gt;&lt;col id=&quot;TBL-3-2&quot; /&gt;&lt;col id=&quot;TBL-3-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-3-4g&quot;&gt;&lt;col id=&quot;TBL-3-4&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-3-5g&quot;&gt;&lt;col id=&quot;TBL-3-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-3-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; b  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; c  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot b + a&apos; \cdot c + b \cdot c\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot b + a&apos; \cdot c\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-3-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 0 + 0&apos; \cdot 0 + 0 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 0 + 0&apos; \cdot 0 = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-3-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 0 + 0&apos; \cdot 1 + 0 \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 0 + 0&apos; \cdot 1 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-3-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 1 + 0&apos; \cdot 0 + 1 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 1 + 0&apos; \cdot 0 = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-3-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 1 + 0&apos; \cdot 1 + 1 \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \cdot 1 + 0&apos; \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-3-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 0 + 1&apos; \cdot 0 + 0 \cdot 0 = 0\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 0 + 1&apos; \cdot 0 = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-3-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 0 + 1&apos; \cdot 1 + 0 \cdot 1 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 0 + 1&apos; \cdot 1 = 0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-3-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 1 + 1&apos; \cdot 0 + 1 \cdot 0 = 1\)&lt;/span&gt; &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-3-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 1 + 1&apos; \cdot 0 = 1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-3-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 1 + 1&apos; \cdot 1 + 1 \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-3-9-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1 \cdot 1 + 1&apos; \cdot 1 = 1\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                        &lt;/div&gt;
&lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 268 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, the theorem has been proven.                                        □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 271 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-8004r4&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 2.4 &lt;/span&gt;(Transposition)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} (a + b) \cdot (a&apos; + c) = a \cdot c + a&apos; \cdot b \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 277 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 280 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
                                                                          

                                                                          
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;By using the distributivity, commutativity, and complement laws,
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} (a + b) \cdot (a&apos; + c) &amp;amp;= (a + b) \cdot a&apos; + (a + b) \cdot c = \\ &amp;amp;= a&apos; \cdot (a + b) + c \cdot (a + b) = \\ &amp;amp;= a&apos; \cdot a + a&apos; \cdot b + c \cdot a + c \cdot b = \\ &amp;amp;= 0 + a&apos; \cdot b + a \cdot c + c \cdot b = \\ &amp;amp;= a \cdot c + a&apos; \cdot b + b \cdot c. \end{align*}&lt;/div&gt;
&lt;!-- l. 290 --&gt;&lt;p class=&quot;indent&quot;&gt;   By case analysis on &lt;span class=&quot;mathjax-inline&quot;&gt;\(b \cdot c\)&lt;/span&gt;,
&lt;/p&gt;&lt;!-- l. 292 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;cmbx-12&quot;&gt;Case 1: &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(b \cdot c = 0\)&lt;/span&gt; leads the original expression of the theorem to be equal to
&lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot c + a&apos; \cdot b + 0 = a \cdot c + a&apos; \cdot b\)&lt;/span&gt;. &lt;span class=&quot;cmbx-12&quot;&gt;Case 2: &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(b \cdot c = 1\)&lt;/span&gt; leads the original expression to be evaluated to &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot c + a&apos; \cdot b + 1 = 1\)&lt;/span&gt;. However,
since &lt;span class=&quot;mathjax-inline&quot;&gt;\(b \cdot c = 1\)&lt;/span&gt; also implies that &lt;span class=&quot;mathjax-inline&quot;&gt;\(b = c = 1\)&lt;/span&gt;, the previous form in case 1, &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot c + a&apos; \cdot b = a \cdot 1 + a&apos; \cdot 1 = a + a&apos;\)&lt;/span&gt; also evaluates to
1.
&lt;/p&gt;&lt;!-- l. 295 --&gt;&lt;p class=&quot;indent&quot;&gt;   From the both cases above, the original expression results in the same boolean
values yielded from the expression &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \cdot c + a&apos; \cdot b\)&lt;/span&gt;. Therefore, the theorem has been
proven.                                                                                        □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 298 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-8005r5&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 2.5 &lt;/span&gt;(Involution)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} (a&apos;)&apos; = a \end{align*}&lt;/div&gt;
   &lt;/div&gt;
&lt;!-- l. 304 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 307 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;By using proof by exhaustion,
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
&lt;!-- l. 309 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt; &lt;!-- tex4ht:inline --&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-4&quot;&gt;&lt;colgroup id=&quot;TBL-4-1g&quot;&gt;&lt;col id=&quot;TBL-4-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-4-2g&quot;&gt;&lt;col id=&quot;TBL-4-2&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-4-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-4-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-4-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((a&apos;)&apos;\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-4-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-4-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt; &lt;td class=&quot;td11&quot; id=&quot;TBL-4-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((0&apos;)&apos; = 1&apos; = 0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-4-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-4-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-4-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\((1&apos;)&apos; = 0&apos; = 1\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                      &lt;/div&gt;
&lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 321 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, the theorem has been proven.                                        □
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/div&gt;
   
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;boolean-functions&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.3   &lt;/span&gt; &lt;a id=&quot;x1-90002.3&quot;&gt;&lt;/a&gt;Boolean Functions&lt;/h3&gt;
&lt;!-- l. 325 --&gt;&lt;p class=&quot;noindent&quot;&gt;A boolean function is a regular mathematical function whose domain is the
Boolean space &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{0, 1\}\)&lt;/span&gt; and uses only Boolean operations upon the elements of the
domain. Another way of looking at it is, anything that takes one or more 0/1
inputs and gives one 0/1 output is a boolean function. So, according to this view,
a lookup table with all possible binary patterns on the left-hand-side (LHS) and
binary digits on the right-hand-side (RHS) could be considered a boolean
function. Just take a look at the lookup table below for a moment. I mean, at the
end of the day, this table defines the outputs of ternary function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f: \{0, 1\}^3 \rightarrow \{0, 1\}\)&lt;/span&gt; for all possible
3-bit inputs.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 327 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-boolean-function-fx-y-z-xy-z&quot;&gt;   &lt;a id=&quot;x1-9001r1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-5&quot;&gt;&lt;colgroup id=&quot;TBL-5-1g&quot;&gt;&lt;col id=&quot;TBL-5-1&quot; /&gt;&lt;col id=&quot;TBL-5-2&quot; /&gt;&lt;col id=&quot;TBL-5-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-5-4g&quot;&gt;&lt;col id=&quot;TBL-5-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-5-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; z  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; f(x, y, z)  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-5-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-5-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-5-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-5-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-5-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-5-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-5-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-5-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-5-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                    &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 2.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy + z\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-9001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 346 --&gt;&lt;p class=&quot;indent&quot;&gt;   The table &lt;a href=&quot;#truth-table-for-boolean-function-fx-y-z-xy-z&quot;&gt;2.1&lt;!-- tex4ht:ref: tab:truth-table-example  --&gt;&lt;/a&gt; is a representation of a boolean function. It is an exhaustive
lookup table essentially, and we call such representation &lt;span class=&quot;cmbx-12&quot;&gt;truth table &lt;/span&gt;of a boolean
function. To state a couple of facts about truth tables, (1) this representation
is tabular and not algebraic, (2) it is declarative (i.e., the table states
which binary value can be used to substitute &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z)\)&lt;/span&gt; for some &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt;) and not
imperative (i.e., the table does not state how the outputs are computed by
using Boolean logic). Tabular representation is cool, but we would also
like to have algebraic representations that are imperative, because we
are not planning to use Boolean functions on paper all day long and we
actually need to build something in real life that behaves the same as the
described boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;. Moreover, there is another disadvantage when it
comes to representing a boolean function by drawing out its truth table
representation: it is exhaustive, i.e., all the possible inputs must be there in
the table, making some of even the simple functions with 10 or more
binary inputs unskethcable (i.e., practially very painful to sketch because
the table needs to have &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^10 = 1024\)&lt;/span&gt; rows). All this being said, now we will see how
algebraic representations can be constructed for our beautiful boolean
functions.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;canonical-representations&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.3.1   &lt;/span&gt; &lt;a id=&quot;x1-100002.3.1&quot;&gt;&lt;/a&gt;Canonical Representations&lt;/h4&gt;
&lt;!-- l. 349 --&gt;&lt;p class=&quot;noindent&quot;&gt;Let’s take a look at our beloved truth table &lt;a href=&quot;#truth-table-for-boolean-function-fx-y-z-xy-z&quot;&gt;2.1&lt;!-- tex4ht:ref: tab:truth-table-example  --&gt;&lt;/a&gt; for the ternary function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f : x, y , z \mapsto 0/1\)&lt;/span&gt;. There
are two standartized (canonical) way of representing truth tables: (1) &lt;span class=&quot;cmbx-12&quot;&gt;sum of
products (SoP) &lt;/span&gt;and (2) &lt;span class=&quot;cmbx-12&quot;&gt;product of sums (PoS)&lt;/span&gt;. Let’s see what they are all
about…
   
&lt;/p&gt;
   &lt;h5 class=&quot;subsubsectionHead&quot; id=&quot;sum-of-products-sop&quot;&gt;&lt;a id=&quot;x1-11000&quot;&gt;&lt;/a&gt;Sum of Products (SoP)&lt;/h5&gt;
&lt;!-- l. 352 --&gt;&lt;p class=&quot;noindent&quot;&gt;Sum of products approach to constructing a representation for a given boolean
function is all about building a detection mechanism for the inputs for which the
function outputs 1. Such detection mechanism can be built out of multiple simpler
                                                                          

                                                                          
detection mechanisms that only detect one row. What do I mean by that? Well,
imagine that you needed to build a mechanism (that is, essentially another
boolean function) that will take an input &lt;span class=&quot;mathjax-inline&quot;&gt;\((x, y, z)\)&lt;/span&gt;, and then will output 1 if the input is
the one on the third row of the truth table &lt;a href=&quot;#truth-table-for-boolean-function-fx-y-z-xy-z&quot;&gt;2.1&lt;!-- tex4ht:ref: tab:truth-table-example  --&gt;&lt;/a&gt; and 0 otherwise. For example, I
would like to detect the input to the function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt; is the one the third row of its
truth table, i.e., &lt;span class=&quot;mathjax-inline&quot;&gt;\(x=0\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y=1\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z=0\)&lt;/span&gt;. Let’s construct a function &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_3(x, y, z) = \begin {cases} 1, &amp;amp;\text {if } x=0 \text { AND } y=1 \text { AND } z=0 \\ 0, &amp;amp;\text {otherwise} \end {cases}\)&lt;/span&gt;. I think it must be
pretty obvious that &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_3(x, y, z) = x&apos; y z&apos;\)&lt;/span&gt;, since to make the condition &lt;span class=&quot;mathjax-inline&quot;&gt;\(\left [(x=0) \text { AND } (y=1) \text { AND } (z=0)\right ]\)&lt;/span&gt; hold, we need to make
three subconditions – &lt;span class=&quot;mathjax-inline&quot;&gt;\(x&apos; = \begin {cases} 1, \text {if } x=0 \\ 0, \text {otherwise} \end {cases}\)&lt;/span&gt; for &lt;span class=&quot;mathjax-inline&quot;&gt;\(x=0\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y = \begin {cases} 1, \text {if } y=1 \\ 0, \text {otherwise} \end {cases}\)&lt;/span&gt; for &lt;span class=&quot;mathjax-inline&quot;&gt;\(y=1\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z&apos; = \begin {cases} 1, \text {if } z=0 \\ 0, \text {otherwise} \end {cases}\)&lt;/span&gt; for &lt;span class=&quot;mathjax-inline&quot;&gt;\(z=0\)&lt;/span&gt; – hold. Now that we know
how to construct a mechanism/function to detect individual rows, it is
time to compose these smaller detectors to represent our final function
&lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;.
&lt;/p&gt;&lt;!-- l. 366 --&gt;&lt;p class=&quot;indent&quot;&gt;   The logic for constructing the detector for the rows for which our function
outputs 1 is as follows: we define
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} f(\text {input}) = \begin {cases} 1, \text {\makecell {if input is given on \\ the \textbf {second row} OR \\ the \textbf {fourth row} OR \\ the \textbf {sixth row} OR \\ the \textbf {seventh row} OR \\ the \textbf {eighth row} \\ of the truth table}} \\ 0, \text {otherwise} \end {cases}. \end{align*}&lt;/div&gt;
&lt;!-- l. 376 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, we can combine 5 detectors to construct a representation for &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt; as
follows: &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = r_2(x, y, z) + r_4(x, y, z) + r_6(x, y, z) + r_7(x, y, z) + r_8(x, y, z)\)&lt;/span&gt;. In other words, we may write &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = \sum m(1, 3, 5, 6, 7)\)&lt;/span&gt; – sum of &lt;span class=&quot;cmbx-12&quot;&gt;minterms &lt;/span&gt;(products).
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-11001r1&quot;&gt;&lt;span id=&quot;andor-circuit-for-fx-y-z-m-&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 380 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c2s3_sop_example.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 2.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;AND-OR circuit for &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = \sum m(1, 3, 5, 6, 7)\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-11001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 385 --&gt;&lt;p class=&quot;indent&quot;&gt;   The diagram above illustrates visual representation of the construction of our
boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt; by using ANDs, ORs, and NOTs. To explain the diagram, the
inputs &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt; are shown on the leftmost side. Then each of them are
connected to a triangle and another triangle with a circle on its tip: a regular
triangle’s output is the same as its input (for example, &lt;span class=&quot;mathjax-inline&quot;&gt;\(x {\relbar \vartriangleright \rightarrow } x\)&lt;/span&gt;) – this is called
&lt;span class=&quot;cmbx-12&quot;&gt;buffer&lt;/span&gt;, the other type of triangle with a circle on its tip outputs its input
complement (for example, &lt;span class=&quot;mathjax-inline&quot;&gt;\(x {\relbar \vartriangleright \hspace {-0.15cm} \circ \hspace {-0.15cm} \rightarrow } x&apos;\)&lt;/span&gt;) – this is called &lt;span class=&quot;cmbx-12&quot;&gt;negation &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;complement&lt;/span&gt;. The
D-shaped drawings, also called &lt;span class=&quot;cmbx-12&quot;&gt;AND &lt;/span&gt;gates, in the middle column represent
logical AND of three inputs that are coming from previous buffers and
negations. For example, the D-shaped drawing on the bottom labeled &lt;span class=&quot;cmtt-12&quot;&gt;xyz &lt;/span&gt;are
connected to buffers of x, y, z, and it outputs “x AND y AND z” representing
the 8th row from the the function’s truth table where x = y = z = 1.
The top AND gate takes its 3 inputs from negatex x, negated y, and z
itself (or buffered z), and hence the label “xcycz” – &lt;span class=&quot;cmbx-12&quot;&gt;x c&lt;/span&gt;omplement, &lt;span class=&quot;cmbx-12&quot;&gt;y
c&lt;/span&gt;omplement, &lt;span class=&quot;cmbx-12&quot;&gt;z&lt;/span&gt;. The last gate on the right side of the diagram that takes 5 inputs
from 5 AND gates on its left side and outputs to a wire connected to
a circle labeled “f” on its right is called &lt;span class=&quot;cmbx-12&quot;&gt;OR &lt;/span&gt;gate. It basically adds all
of its inputs and outputs the result as the final value of our function
&lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;.
&lt;/p&gt;&lt;!-- l. 387 --&gt;&lt;p class=&quot;indent&quot;&gt;   Notice that how we have sometimes used complements of variables as an input
to AND gate because we cannot really represent “(x = 0) AND (y = 0) AND (z =
1)” by connecting x, y, z to an AND gate on the top: that would have meant that
the AND gate outputs 1 when it observes “(x = 1) AND (y = 1) AND (z = 1)”
for its inputs and 0 when this observation does not hold. In other words, in order
for an AND gate to output 1, it must see that all of its inputs are 1s. Therefore,
we used complements x’ and y’ instead to mean that “(x’ = 1) AND (y’ =
1) AND (z = 1)”, which translates to the same “(x = 0) AND (y = 0)
AND (z = 1)”. Similarly, the OR gate outputs 0 when it observes all of
its inputs as 0s – even if one of the inputs is 1 then it outputs 1, which
intuitively makes sense if you think about how the “or” relation in English
works.
   
&lt;/p&gt;
   &lt;h5 class=&quot;subsubsectionHead&quot; id=&quot;product-of-sums-pos&quot;&gt;&lt;a id=&quot;x1-12000&quot;&gt;&lt;/a&gt;Product of Sums (PoS)&lt;/h5&gt;
                                                                          

                                                                          
&lt;!-- l. 390 --&gt;&lt;p class=&quot;noindent&quot;&gt;As opposed to the SoP representation, product-of-sums (PoS) is about
constructing detection mechanism that recognizes inputs for which the
output is 0 in the truth table. With the same logic used in PoS, we could
construct three such boolean functions that output 1 only when their
input is the one given on the first, third, and fifth rows, respectively. Here
are such three functions: &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_0(x, y, z) = x&apos;y&apos;z&apos;\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_2(x, y, z) = x&apos;yz&apos;\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_4(x, y, z) = xy&apos;z&apos;\)&lt;/span&gt;. Now, we could rewrite &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;’s definition as
follows:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-block&quot;&gt;\[ f(\text {input}) = \begin {cases} 0, \text {\makecell {if input appears on \\ the \textbf {first row} OR \\ the \textbf {third row} OR \\ the \textbf {fifth row}}} \\ 1, \text {otherwise} \end {cases} \]&lt;/div&gt;
&lt;!-- l. 398 --&gt;&lt;p class=&quot;indent&quot;&gt;   To implement this definition of &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;, we could first try to detect whether the input
appears on one of the rows that make &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;’s output 0 by combining three previously
built detectors by summing them (SoP): &lt;span class=&quot;mathjax-inline&quot;&gt;\(r_0(x, y, z) + r_2(x, y, z) + r_4(x, y, z)\)&lt;/span&gt;. Now this SoP formula has the following
definition:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-block&quot;&gt;\[ r_0(\text {input}) + r_2(\text {input}) + r_4(\text {input}) = \begin {cases} 1, \text {\makecell {if input appears on \\ the \textbf {first row} OR \\ the \textbf {third row} OR \\ the \textbf {fifth row}}} \\ 0, \text {otherwise} \end {cases} \]&lt;/div&gt;
&lt;!-- l. 407 --&gt;&lt;p class=&quot;indent&quot;&gt;   Realize how this definition is the complete opposite of the &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;’s definition.
Therefore, we could just conclude that
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} f(x, y, z) &amp;amp;= \left (r_0(x, y, z) + r_2(x, y, z) + r_4(x, y, z)\right )&apos; = \\ &amp;amp;= \left (r_0(x, y, z)\right )&apos; \cdot \left (r_2(x, y, z)\right )&apos; \cdot \left (r_4(x, y, z)\right )&apos; = \\ &amp;amp;= (x + y + z)(x + y&apos; + z)(x&apos; + y + z) \end{align*}&lt;/div&gt;
&lt;!-- l. 415 --&gt;&lt;p class=&quot;indent&quot;&gt;   The PoS formula for our function is also written as &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = \prod M(0, 2, 4)\)&lt;/span&gt; in short – product of
&lt;span class=&quot;cmbx-12&quot;&gt;Maxterms &lt;/span&gt;(sums).
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-12001r2&quot;&gt;&lt;span id=&quot;orand-circuit-for-fx-y-z-m-&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 419 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c2s3_pos_example.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 2.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;OR-AND circuit for &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = \prod M(0, 2, 4)\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-12001r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;boolean-function-simplification-with-karnaugh-maps&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;2.3.2   &lt;/span&gt; &lt;a id=&quot;x1-130002.3.2&quot;&gt;&lt;/a&gt;Boolean Function Simplification with Karnaugh Maps&lt;/h4&gt;
&lt;!-- l. 426 --&gt;&lt;p class=&quot;noindent&quot;&gt;We want the circuits to be minimal and compact, because the less redundant logic
(gates) we use in our circuit, the more speed we gain in the propogation of input
signals (0s and 1s) in the circuit. Here is one simple example: suppose you build a
circuit out of three NOT gates as follows:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 430 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c2s2_not_not_not_x.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 435 --&gt;&lt;p class=&quot;indent&quot;&gt;   If you represent this circuit as a boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x) = x&apos;&apos;&apos;\)&lt;/span&gt;, you can quickly deduce
that &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x) = x&apos;\)&lt;/span&gt; (recall that &lt;span class=&quot;mathjax-inline&quot;&gt;\(x&apos;&apos; = x\)&lt;/span&gt;). Although two representations are semantically the same (they
give you the same final output in real life), one is practically slower and more
resource-demanding than the other. The first representation &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x) = x&apos;&apos;&apos;\)&lt;/span&gt; requires buying 3
NOT gates from the store (not budget friendly) and runs slower than &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x) = x&apos;\)&lt;/span&gt;, which only
requires buying a single NOT gate. All this is to say that &lt;span class=&quot;cmbx-12&quot;&gt;minimization of
boolean logic &lt;/span&gt;is useful and good.
&lt;/p&gt;&lt;!-- l. 437 --&gt;&lt;p class=&quot;indent&quot;&gt;   You may wonder if there are other techniques to minimize a given
boolean function. There are indeed other techniques beyond the use of
boolean algebra laws and theorems (e.g., &lt;span class=&quot;mathjax-inline&quot;&gt;\(x&apos;&apos;=x\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(x+1=1\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(x \cdot x = x\)&lt;/span&gt;, etc.), and one of them is
by using so-called Karnaugh maps or K-maps. A K-map is essentially a
two-dimensional Euclidean grid that represents all the outputs of a given function
to be minimized in a way that neighbouring output values on the grid are
the outputs of the function when given very similar inputs. Here’s an
example: suppose we have a ternary function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = (x+y+z)(x+y&apos;+z)(x&apos;+y&apos;+z)(x&apos;+y&apos;+z&apos;)\)&lt;/span&gt;. For input 110 (&lt;span class=&quot;mathjax-inline&quot;&gt;\(x=1,\ y=1,\ z=0\)&lt;/span&gt;), &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(1,1,0) = 0\)&lt;/span&gt;. So, we say
the cell at coordinate &lt;span class=&quot;mathjax-inline&quot;&gt;\((1,0,1)\)&lt;/span&gt; of the 2D K-map grid is &lt;span class=&quot;mathjax-inline&quot;&gt;\(0\)&lt;/span&gt; (output of &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt; at &lt;span class=&quot;mathjax-inline&quot;&gt;\((1, 1, 0)\)&lt;/span&gt;). Then
we are interested in the neigbouring cells located at &lt;span class=&quot;mathjax-inline&quot;&gt;\((0, 1, 0)\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\((1, 0, 0)\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\((1, 1, 1)\)&lt;/span&gt;. &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;’s outputs
at these locations are, &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(0,1,0)=0\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(1,0,0)=1\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(1,1,1)=0\)&lt;/span&gt;. This is how we visually represent the grid
with the cell locations (inputs to our boolean function) and the function
outputs:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 440 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-6&quot;&gt;&lt;colgroup id=&quot;TBL-6-1g&quot;&gt;&lt;col id=&quot;TBL-6-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-6-2g&quot;&gt;&lt;col id=&quot;TBL-6-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-6-3g&quot;&gt;&lt;col id=&quot;TBL-6-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-6-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-1-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 443 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\vcenter {\hbox {\diagbox@pict }}\)&lt;/span&gt;      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-6-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;0          1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-6-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-3-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 445 --&gt;&lt;p class=&quot;noindent&quot;&gt;00       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-3-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 445 --&gt;&lt;p class=&quot;noindent&quot;&gt;
      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-3-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 446 --&gt;&lt;p class=&quot;noindent&quot;&gt;
      &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-6-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-5-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 447 --&gt;&lt;p class=&quot;noindent&quot;&gt;01       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-5-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 447 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-5-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 448 --&gt;&lt;p class=&quot;noindent&quot;&gt;
      &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-6-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-7-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 449 --&gt;&lt;p class=&quot;noindent&quot;&gt;11       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-7-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 449 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-7-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 449 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-6-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-9-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 451 --&gt;&lt;p class=&quot;noindent&quot;&gt;10       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-9-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 451 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-6-9-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 452 --&gt;&lt;p class=&quot;noindent&quot;&gt;
      &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 459 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, we fill the rest of the empty cells of this grid. Notice that how
rows are indexed with location/inputs 00, 01, 11, 10 and not 00, 01, 10,
11. This is because we want the neighbouring locations/inputs to be as
similar to one another as possible. If you look carefully, going from 00 to 01
makes only a single bit flip, as well as going from 01 to 11, from 11 to
10, and from 10 to 00 back again. However, if the rows were indexed
with the “00, 01, 10, 11” order, going from 01 to 10 would make two
bits flipped (this is also true for going from 11 to 00 back again), and
therefore, the neighbouring locations would not be as close as they are
with the “00, 01, 11, 10” indexding. This is called (2-bit) &lt;span class=&quot;cmbx-12&quot;&gt;gray codes &lt;/span&gt;–
&lt;span class=&quot;cmti-12&quot;&gt;(2-bit) binary numbers ordered in a number line such that each consecutive
number on the line is only single bit-flip away from the other&lt;/span&gt;. For the
columns of K-map, we also need to use gray codes. Since there is only
single bit &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt; represented as the column values, any ordering (“0, 1” or “1,
0”) is a valid and gray code compliant; in our table we have used “0, 1”
ordering.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 462 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-9&quot;&gt;&lt;colgroup id=&quot;TBL-9-1g&quot;&gt;&lt;col id=&quot;TBL-9-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-9-2g&quot;&gt;&lt;col id=&quot;TBL-9-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-9-3g&quot;&gt;&lt;col id=&quot;TBL-9-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-9-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-1-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 465 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\vcenter {\hbox {\diagbox@pict }}\)&lt;/span&gt;      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-9-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;0          1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-9-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-3-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 467 --&gt;&lt;p class=&quot;noindent&quot;&gt;00       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-3-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 467 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-3-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 467 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-9-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-5-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 469 --&gt;&lt;p class=&quot;noindent&quot;&gt;01       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-5-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 469 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-5-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 469 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-9-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-7-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 471 --&gt;&lt;p class=&quot;noindent&quot;&gt;11       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-7-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 471 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-7-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 471 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-9-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-9-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 473 --&gt;&lt;p class=&quot;noindent&quot;&gt;10       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-9-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 473 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-9-9-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 473 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 481 --&gt;&lt;p class=&quot;indent&quot;&gt;   What now, you ask? The last step after filling the grid is to look for &lt;span class=&quot;cmbx-12&quot;&gt;prime
implicants &lt;/span&gt;– &lt;span class=&quot;cmti-12&quot;&gt;a rectangular selection of &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(2^{i \in \mathbb {N}}\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;number of cells filled with 1s only&lt;/span&gt;. Notice
that the K-map grid wraps around both horizontally and vertically, so
a rectangular selection wrapping over horizontally or vertically is also
valid.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 484 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-12&quot;&gt;&lt;colgroup id=&quot;TBL-12-1g&quot;&gt;&lt;col id=&quot;TBL-12-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-12-2g&quot;&gt;&lt;col id=&quot;TBL-12-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-12-3g&quot;&gt;&lt;col id=&quot;TBL-12-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-12-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-1-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 487 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\vcenter {\hbox {\diagbox@pict }}\)&lt;/span&gt;      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-12-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;0          1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-12-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-3-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 489 --&gt;&lt;p class=&quot;noindent&quot;&gt;00       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-3-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 489 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-3-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 489 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-12-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-5-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 491 --&gt;&lt;p class=&quot;noindent&quot;&gt;01       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-5-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 491 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-5-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 491 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-12-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-7-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 493 --&gt;&lt;p class=&quot;noindent&quot;&gt;11       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-7-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 493 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-7-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 493 --&gt;&lt;p class=&quot;noindent&quot;&gt;0        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-12-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-9-1&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 495 --&gt;&lt;p class=&quot;noindent&quot;&gt;10       &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-9-2&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 495 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-12-9-3&quot; style=&quot;white-space:normal; text-align:left; vertical-align:middle;&quot;&gt;&lt;!-- l. 495 --&gt;&lt;p class=&quot;noindent&quot;&gt;1        &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;cline&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border-top:1px solid #000;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 503 --&gt;&lt;p class=&quot;indent&quot;&gt;   While we do our group selections, we always try to make the largest groups of
size &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^i\)&lt;/span&gt; possible. Groups may possible overlap and there is no problem with that.
In fact, sometimes we deliberately pick overlapping groups to maximize
their sizes as much as possible. The higher &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^i\)&lt;/span&gt; number of 1s we have in our
groups, the more compressed our final algebraic representation for the given
function will become. Having the two final groups (also known as &lt;span class=&quot;cmbx-12&quot;&gt;essential
prime implicants&lt;/span&gt;) in our K-map example means that we will have two
&lt;span class=&quot;cmbx-12&quot;&gt;minterms &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;products &lt;/span&gt;in our minimized representation. To construct a
product from any given group on the grid, you just need to find the input
variables that do not change across the cells within the same group. In
our case, for the yellow essential prime implicant, &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt; do not change,
so the product for this group is the multiplication of these &lt;span class=&quot;cmbx-12&quot;&gt;invariants&lt;/span&gt;
converted to boolean value of 1 (by using negations when necessary), &lt;span class=&quot;mathjax-inline&quot;&gt;\(x&apos;z\)&lt;/span&gt;. For the
green essential prime implicant, the invariants are &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y&apos;\)&lt;/span&gt;: therefore, the
product is &lt;span class=&quot;mathjax-inline&quot;&gt;\(xy\)&lt;/span&gt;. Finally, the minimized representation for the function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy&apos; + x&apos;z\)&lt;/span&gt; will be
&lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy&apos; + x&apos;z\)&lt;/span&gt;.
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;logic-gates-circuits&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 3&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-140003&quot;&gt;&lt;/a&gt;Logic Gates &amp;amp; Circuits&lt;/h2&gt;
&lt;!-- l. 508 --&gt;&lt;p class=&quot;noindent&quot;&gt;A &lt;span class=&quot;cmbx-12&quot;&gt;logic gate &lt;/span&gt;is a piece of hardware that computes one of basic functions from the
boolean logic algebra such as &lt;span class=&quot;cmti-12&quot;&gt;boolean addition&lt;/span&gt;, or &lt;span class=&quot;cmti-12&quot;&gt;boolean multiplication&lt;/span&gt;, or,
&lt;span class=&quot;cmti-12&quot;&gt;boolean negation&lt;/span&gt;, or some simple combination of these. Hardware people use these
logic gates to construct circuits. First, we’ll see what logic gates there are and
then we’ll use these gates in order to build more circuits that have high-level
capabilities. Here, you are going to see some basic logic gates that are
going to be useful in building many other high-level essential computer
components.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;not-and-or-xor-nor-xnor&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;3.1   &lt;/span&gt; &lt;a id=&quot;x1-150003.1&quot;&gt;&lt;/a&gt;NOT, AND, OR, XOR, NOR, XNOR&lt;/h3&gt;
&lt;!-- l. 512 --&gt;&lt;p class=&quot;noindent&quot;&gt;The first logic gate is called the &lt;span class=&quot;cmbx-12&quot;&gt;NOT &lt;/span&gt;gate. NOT gate is to compute a unary
boolean negation function, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NOT}(x) := x&apos;\)&lt;/span&gt;. Note that we may use &lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {x}\)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(\lnot x\)&lt;/span&gt; in exchange with &lt;span class=&quot;mathjax-inline&quot;&gt;\(x&apos;\)&lt;/span&gt; from
time to time; all of these notations mean the same thing in this book.
The truth table and visual representation for the NOT gate are given
below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-15&quot;&gt;&lt;colgroup id=&quot;TBL-15-1g&quot;&gt;&lt;col id=&quot;TBL-15-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-15-2g&quot;&gt;&lt;col id=&quot;TBL-15-2&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-15-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NOT}(x) := x&apos; = \overline {x} = \lnot x\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-15-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-15-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-15-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_not_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 531 --&gt;&lt;p class=&quot;indent&quot;&gt;   The second logic gate is the &lt;span class=&quot;cmbx-12&quot;&gt;AND &lt;/span&gt;gate. The AND gate is used to compute
binary multiplication in boolean algebra, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {AND}(x, y) := x \cdot y\)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(xy\)&lt;/span&gt; in short. Here’s its truth table on
the left and its diagramatic representation on the right:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-16&quot;&gt;&lt;colgroup id=&quot;TBL-16-1g&quot;&gt;&lt;col id=&quot;TBL-16-1&quot; /&gt;&lt;col id=&quot;TBL-16-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-16-3g&quot;&gt;&lt;col id=&quot;TBL-16-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-16-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {AND}(x,y) := x \cdot y\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-16-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-16-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-16-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-16-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-16-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_and_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 552 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;cmbx-12&quot;&gt;OR &lt;/span&gt;is another logic gate that computes binary addition in boolean algebra, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {OR}(x, y) := x + y\)&lt;/span&gt;.
Its truth table and diagramatic representation is given below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-17&quot;&gt;&lt;colgroup id=&quot;TBL-17-1g&quot;&gt;&lt;col id=&quot;TBL-17-1&quot; /&gt;&lt;col id=&quot;TBL-17-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-17-3g&quot;&gt;&lt;col id=&quot;TBL-17-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-17-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {OR}(x,y) := x + y\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-17-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-17-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-17-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-17-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-17-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_or_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 575 --&gt;&lt;p class=&quot;indent&quot;&gt;   Believe me when I say this: we can already built a lot by using the
NOT gate and the AND gate. By a lot, I actually mean everything that
can be built by using all the logic gates described in this chapter. Yes,
these two gates combined are really &lt;span class=&quot;cmti-12&quot;&gt;universally &lt;/span&gt;powerful. But this is the
next section’s subject, so let’s keep going on with the different logic gates
for now. Engineers have made another dedicate physical gate for this as
well: it’s called the &lt;span class=&quot;cmbx-12&quot;&gt;NAND &lt;/span&gt;gate or the “NOT AND” gate. By combining
NOT and AND gates into a single hardware component, one can spend
their money only on tons of the NAND gates and then sleep at nights
knowing that anything can be built by using this single type of logic gate in
his/her basement. Here’s NAND’s truth table and how it looks on the
circuittry:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-18&quot;&gt;&lt;colgroup id=&quot;TBL-18-1g&quot;&gt;&lt;col id=&quot;TBL-18-1&quot; /&gt;&lt;col id=&quot;TBL-18-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-18-3g&quot;&gt;&lt;col id=&quot;TBL-18-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-18-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NAND}(x,y) \text { or } \operatorname {NOT}(\operatorname {AND}(x, y)) := (xy)&apos; = x&apos; + y&apos;\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-18-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-18-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-18-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-18-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-18-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_nand_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 600 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, it is time to explore other logic gates that are essentially composition of
the ones that we have seen already. The first one we are going to see is the &lt;span class=&quot;cmbx-12&quot;&gt;NOR&lt;/span&gt;
gate that first ORs (addition in boolean algebra) two inputs or operands and then
NOTs (negation in boolean algebration) the result. Its name is the abbreviation
for NOT-OR: &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NOR}(x, y) = (x + y)&apos;\)&lt;/span&gt;. Keep in mind that we will prove the universality of the
NOR gate later, as well. Below is given its truth table and diagramatic
representation:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-19&quot;&gt;&lt;colgroup id=&quot;TBL-19-1g&quot;&gt;&lt;col id=&quot;TBL-19-1&quot; /&gt;&lt;col id=&quot;TBL-19-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-19-3g&quot;&gt;&lt;col id=&quot;TBL-19-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-19-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NOR}(x,y) \text { or } \operatorname {NOT}(\operatorname {OR}(x, y)) := (x+y)&apos; = x&apos;y&apos;\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-19-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-19-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-19-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-19-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-19-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_nor_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 622 --&gt;&lt;p class=&quot;indent&quot;&gt;   Another type of “OR-ing” two numbers is by using &lt;span class=&quot;cmbx-12&quot;&gt;XOR &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;eXclusive OR&lt;/span&gt;.
While how the OR gate functions can be translated into the word “or” in English
directly, and NOR gate’s behavior can be described by using the words “not or”
in English, XOR’s behavior can be translated to “either…or…” wording. XOR is a
binary function, so it takes two numbers as inputs: &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;, let’s say. We say, it
outputs 1 if and only if either &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; is 1 or &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt; is 1, but not both. So, here’s its truth table
and diagramatic representation:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-20&quot;&gt;&lt;colgroup id=&quot;TBL-20-1g&quot;&gt;&lt;col id=&quot;TBL-20-1&quot; /&gt;&lt;col id=&quot;TBL-20-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-20-3g&quot;&gt;&lt;col id=&quot;TBL-20-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-20-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {XOR}(x,y) \text { or } x \oplus y := x&apos;y + xy&apos;\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-20-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-20-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-20-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-20-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-20-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_xor_gate.png&quot; width=&quot;50%&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 644 --&gt;&lt;p class=&quot;indent&quot;&gt;   Lastly, we have the &lt;span class=&quot;cmbx-12&quot;&gt;XNOR &lt;/span&gt;gate that computes “NOT XOR” of two given
numbers, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {XNOR}(x, y) := xy + x&apos;y&apos;\)&lt;/span&gt;. Here’s its truth table and diagramatic representation:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-21&quot;&gt;&lt;colgroup id=&quot;TBL-21-1g&quot;&gt;&lt;col id=&quot;TBL-21-1&quot; /&gt;&lt;col id=&quot;TBL-21-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-21-3g&quot;&gt;&lt;col id=&quot;TBL-21-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-21-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; y  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {XNOR}(x,y) := \operatorname {NOT}(\operatorname {XOR}(x, y)) = x&apos;y&apos; + xy\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-21-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-21-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-21-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-21-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-21-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                       &lt;/div&gt;&lt;/div&gt;               &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; width=&quot;50%&quot; src=&quot;/assets/courses/comp-arch/figures/c3s1_xnor_gate.png&quot; /&gt;                                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 668 --&gt;&lt;p class=&quot;indent&quot;&gt;   These are all the logic gates that we are going to use to build more complex
circuitry later on. In fact, we are mostly going to use NOT, AND, and OR gates.
The others won’t be used much in this book, but it is still good to know about
them. Now, let’s see the &lt;span class=&quot;cmbx-12&quot;&gt;universality &lt;/span&gt;claims about some of these gates as I
promised earlier.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;universal-logic-gates&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;3.2   &lt;/span&gt; &lt;a id=&quot;x1-160003.2&quot;&gt;&lt;/a&gt;Universal Logic Gates&lt;/h3&gt;
&lt;!-- l. 671 --&gt;&lt;p class=&quot;noindent&quot;&gt;We need to ask the following question before we begin: What does it mean for a
set of logic gates to be universal all together? The answer is the definition of
universality, and here is how it is defined:
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 673 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-16001r1&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Definition 3.1 &lt;/span&gt;(Universality of a set of logic gates)&lt;span class=&quot;cmbx-12&quot;&gt;.&lt;/span&gt;  &lt;/span&gt;A set of logic gates &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{G_1, G_2, \dots , G_n\}\)&lt;/span&gt; is
&lt;span class=&quot;cmbx-12&quot;&gt;universal                                   &lt;/span&gt;if                                        and
only if any boolean function can be constructed/implemented only by using
the logic gates within this set.
&lt;/p&gt;
   &lt;/div&gt;
&lt;!-- l. 676 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;&lt;!-- l. 678 --&gt;&lt;p class=&quot;indent&quot;&gt;   We have already learned about the SoP canonical representation for all
boolean functions in the previous chapter. Well, it is already obvious that SoP or
Sum-of-Products representation uses &lt;span class=&quot;cmbx-12&quot;&gt;Sum &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;Product &lt;/span&gt;among the &lt;span class=&quot;cmbx-12&quot;&gt;literals &lt;/span&gt;to
represent a boolean function. Lastly, a literal can be an input variable or its
&lt;span class=&quot;cmbx-12&quot;&gt;complement&lt;/span&gt;. So, we can conclude that all we need to construct SoP for a
given truth table that represents arbitrary boolean function is &lt;span class=&quot;cmbx-12&quot;&gt;OR &lt;/span&gt;(for
construction of Sum), &lt;span class=&quot;cmbx-12&quot;&gt;AND &lt;/span&gt;(fro construction of Product), and &lt;span class=&quot;cmbx-12&quot;&gt;NOT &lt;/span&gt;(for
construction of complement or negated variable). Therefore, the set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}, \operatorname {OR}\}\)&lt;/span&gt; is universal.
□
                                                                          

                                                                          
&lt;/p&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 680 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-16002r1&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 3.1.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}\}\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;is universal.&lt;/span&gt;
&lt;/p&gt;
   &lt;/div&gt;
&lt;!-- l. 682 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 685 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;To prove that &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}\}\)&lt;/span&gt; is a universal set we need to prove that the NAND
gate can be used to construct all the gates from another universal set, such
as the set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}, \operatorname {OR}\}\)&lt;/span&gt; that we saw earlier. We already have the NOT and AND gates
in our candidate set, which are the same with the NOT and AND gates in
&lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}, \operatorname {OR}\}\)&lt;/span&gt;. All we need to show that the OR gate in the universal set is constructible
by using only NOT and AND gates from our candidate set. Let’s proceed to
the construction.
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \operatorname {OR}(x, y) &amp;amp;= x + y \\ &amp;amp;= (xy)&apos; \quad \text {De Morgan&apos;s law} \\ &amp;amp;= \operatorname {NOT}\left (\operatorname {AND}(x, y)\right ) \end{align*}&lt;/div&gt;
&lt;!-- l. 693 --&gt;&lt;p class=&quot;indent&quot;&gt;   Since only NOT and AND gates can be used to construct all the gates in a
universal set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}, \operatorname {OR}\}\)&lt;/span&gt; that we already know of, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}\}\)&lt;/span&gt; is universal.                              □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 696 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-16003r2&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 3.2.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NAND}\}\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;is universal.&lt;/span&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/div&gt;
&lt;!-- l. 699 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 702 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;To prove that &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NAND}\}\)&lt;/span&gt; is a universal set we need to prove that the NAND
gate can be used to construct all the gates from another universal set, such
as the set &lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOT}, \operatorname {AND}\}\)&lt;/span&gt; that we saw earlier. Let’s proceed to the constructions.
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \operatorname {NOT}(x) &amp;amp;= x&apos; = \\ &amp;amp;= \operatorname {NAND}(x, x) = (x \cdot x)&apos; = x&apos; \end{align*}&lt;/div&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \operatorname {AND}(x, y) &amp;amp;= xy = \\ &amp;amp;= \operatorname {NAND}(\operatorname {NAND}(x, y), \operatorname {NAND}(x, y)) = \operatorname {NAND}\left ((xy)&apos;, (xy)&apos;\right ) = \\ &amp;amp;= \operatorname {NOT}\left ((xy)&apos;\right ) = xy \end{align*}&lt;/div&gt;
&lt;!-- l. 716 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, the NAND gate by itself is a universal gate.                     □
&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class=&quot;newtheorem&quot;&gt;
&lt;!-- l. 719 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;head&quot;&gt;
&lt;a id=&quot;x1-16004r3&quot;&gt;&lt;/a&gt;
&lt;span class=&quot;cmbx-12&quot;&gt;Theorem 3.3.&lt;/span&gt;  &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\{\operatorname {NOR}\}\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;is universal.&lt;/span&gt;
&lt;/p&gt;
   &lt;/div&gt;
&lt;!-- l. 721 --&gt;&lt;p class=&quot;indent&quot;&gt;
&lt;/p&gt;
   &lt;div class=&quot;proof&quot;&gt;
&lt;!-- l. 724 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;head&quot;&gt;
&lt;span class=&quot;cmti-12&quot;&gt;Proof.&lt;/span&gt; &lt;/span&gt;We will build the NAND gate only by using NOR gate(s) to prove
the universality of NOR.
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \operatorname {NAND}(x, y) &amp;amp;= \operatorname {NOR}(xy, xy) = \\ &amp;amp;= \operatorname {NOR}\left ( \operatorname {NOR}(x&apos;, y&apos;), \operatorname {NOR}(x&apos;, y&apos;) \right ) = \\ &amp;amp;= \operatorname {NOR}\left ( \operatorname {NOR}\left ( \operatorname {NOR}(x, x), \operatorname {NOR}(y, y) \right ), \operatorname {NOR}\left ( \operatorname {NOR}(x, x), \operatorname {NOR}(y, y) \right ) \right ) \end{align*}&lt;/div&gt;
&lt;!-- l. 742 --&gt;&lt;p class=&quot;indent&quot;&gt;   Therefore, NOR gate is a universal gate by itself.                             □
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/div&gt;
                                                                          

                                                                          
&lt;!-- l. 745 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;combinational-logic&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 4&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-170004&quot;&gt;&lt;/a&gt;Combinational Logic&lt;/h2&gt;
&lt;!-- l. 746 --&gt;&lt;p class=&quot;noindent&quot;&gt;This chapter makes use of boolean circuits/functions with no “memory” of the
past, which is known as &lt;span class=&quot;cmbx-12&quot;&gt;combinational circuits&lt;/span&gt;. Combinational circuit is a
circuit whose output(s) is determined only based on the explicitly given inputs. In
other words, the output of a combinational circuit always stays the same as the
long as the same input signal is provided. One important concept to be careful
about here is the concept of &lt;span class=&quot;cmbx-12&quot;&gt;time&lt;/span&gt;. Up until now, I did not explitly mention the
timing aspect in boolean cirucits, and hence also in boolean functions.
For example, take a boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy&apos; + x&apos;z\)&lt;/span&gt;. In this level of abstraction of the
representation of &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;, there is no notion of time: we just say given any &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z\)&lt;/span&gt;, the
function evaluates to &lt;span class=&quot;mathjax-inline&quot;&gt;\(xy&apos; + x&apos;z\)&lt;/span&gt;. In reality, when you build a physical circuit that
implements this function, obviously there is the notion of time as well.
Therefore, it would be more realistic to write this function as &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x_t, y_t, z_t) = x_t y&apos;_t + x&apos;_t z_t\)&lt;/span&gt; where &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_t, y_t, z_t\)&lt;/span&gt;
are the inputs provided at time (step) &lt;span class=&quot;mathjax-inline&quot;&gt;\(t\)&lt;/span&gt;. Functions of this nature – that
is, &lt;span class=&quot;cmti-12&quot;&gt;the output(s) at time step &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(t\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;only depending on some combination of
the inputs provided at the same time step &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(t\) &lt;/span&gt;&lt;span class=&quot;cmti-12&quot;&gt;– are called combinational&lt;/span&gt;
functions.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;foundational-combinational-circuits&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.1   &lt;/span&gt; &lt;a id=&quot;x1-180004.1&quot;&gt;&lt;/a&gt;Foundational Combinational Circuits&lt;/h3&gt;
&lt;!-- l. 749 --&gt;&lt;p class=&quot;noindent&quot;&gt;This section introduces several combinational circuits that are used quite often
while building a typical general-purpose and programmable computer. By general
purpose, we mean that any computable function can be programmed into the
computer. That is essentially our goal: making a computer to compute our
functions for us. I know, sounds exciting, but we have more things to learn first
before building our own computer. Now, let’s see about these foundational
combinational building blocks of computers.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;multiplexer-mux&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.1.1   &lt;/span&gt; &lt;a id=&quot;x1-190004.1.1&quot;&gt;&lt;/a&gt;Multiplexer (MUX)&lt;/h4&gt;
&lt;!-- l. 752 --&gt;&lt;p class=&quot;noindent&quot;&gt;What is a multiplexer? It is a circuit that acts like a switch… like a railroad switch
lever. You know the one that decides which train gets to continue with the main
railway.
                                                                          

                                                                          
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-19001r1&quot;&gt;&lt;span id=&quot;railroad-switch&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 756 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/railroad_switch.jpg&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Railroad switch&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-19001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 761 --&gt;&lt;p class=&quot;indent&quot;&gt;   To be more concrete with the multiplexers’ use case, imagine that we have two
independent cirucits that do some useful calculations for us. For example,
let one circuit take two 1-bit inputs (&lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_2\)&lt;/span&gt;) and compute their logical
AND (&lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1 \land x_2\)&lt;/span&gt;), and let the other circuit take the same 1-bit inputs (&lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_2\)&lt;/span&gt;) and
compute their logical OR (&lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1 \lor x_2\)&lt;/span&gt;); the first circuit is simply made of a single
AND gate and the second one is made of a single OR gate, obviously.
Now, we would like to somehow select one of the outputs depending on
whether we want to compute logical AND or logical OR. In other words, we
would like to create a circuit that computes the following mathematical
function:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-block&quot;&gt;\[ f(x_1, x_2, \texttt {computeOR}_{\in \{0, 1\}} = \begin {cases} x_1 \land x_2, \text {if } \texttt {computerOR} = 0 \\ x_1 \lor x_2, \text {if } \texttt {computerOR} = 1 \\ \end {cases} \]&lt;/div&gt;
&lt;!-- l. 771 --&gt;&lt;p class=&quot;indent&quot;&gt;   So, if &lt;span class=&quot;cmtt-12&quot;&gt;computeOR &lt;/span&gt;is 0, we want to get the output of AND gate, and if
&lt;span class=&quot;cmtt-12&quot;&gt;computeOR &lt;/span&gt;is 1, we want to get the output of OR gate. Here is how our unfinished
circuit looks right now:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-19002r2&quot;&gt;&lt;span id=&quot;trying-to-compute-fx-x-computeor-function&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 775 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mux_intro.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Trying to compute &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x_1, x_2, \texttt {computeOR}\)&lt;/span&gt; function.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-19002r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 780 --&gt;&lt;p class=&quot;indent&quot;&gt;   A carefull reader should have felt that something if off about the picture
shown above: There is no &lt;span class=&quot;cmtt-12&quot;&gt;computeOR &lt;/span&gt;input, which was one of the arguments to
our function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;. So, let’s add that also to our circuit, and now it looks like
this:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-19003r3&quot;&gt;&lt;span id=&quot;trying-to-compute-fx-x-computeor-function1&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 784 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mux_intro2.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Trying to compute &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x_1, x_2, \texttt {computeOR}\)&lt;/span&gt; function.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-19003r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 789 --&gt;&lt;p class=&quot;indent&quot;&gt;   How do we find out a way to connect AND’s and OR’s outputs to the main
output wire (connected to &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt;)? To solve this problem, we use a multiplexer or MUX.
Here’s how a simple MUX behaves mathematically:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-block&quot;&gt;\[ \operatorname {MUX}(x_1, x_2, s) = \begin {cases} x_1, \text {if } s = 0 \\ x_2, \text {if } s = 1 \\ \end {cases} \]&lt;/div&gt;
&lt;!-- l. 799 --&gt;&lt;p class=&quot;indent&quot;&gt;   Knowing how MUX behaves mathematically allows us to represent our
previous function by using a single MUX as follows: &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x_1, x_2, \texttt {computeOR}) = \operatorname {MUX}(x_1 x_2, x_1 + x_2, \texttt {computeOR})\)&lt;/span&gt;. Figure shown below shows
what such a MUX looks like on the left side.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;!-- l. 804 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_mux.png&quot; width=&quot;50%&quot; /&gt;                          &lt;/p&gt;&lt;/div&gt; &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_mux_impl.png&quot; width=&quot;50%&quot; /&gt;                                            &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 814 --&gt;&lt;p class=&quot;indent&quot;&gt;   But MUX can be made out of a bunch of AND, OR, NOT gates.
All we have to do is to figure out the truth table of the MUX and then
find a boolean function for it. This way, we can build the circuit that
computes this boolean function. This is what MUX’s truth table looks
like:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 817 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-x-mux&quot;&gt;   &lt;a id=&quot;x1-19004r1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-22&quot;&gt;&lt;colgroup id=&quot;TBL-22-1g&quot;&gt;&lt;col id=&quot;TBL-22-1&quot; /&gt;&lt;col id=&quot;TBL-22-2&quot; /&gt;&lt;col id=&quot;TBL-22-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-22-4g&quot;&gt;&lt;col id=&quot;TBL-22-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-22-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_2\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(s\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {MUX}(x_1, x_2, s)\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-22-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-22-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-22-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-22-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                     &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 4.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 2x1 MUX&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-19004r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 836 --&gt;&lt;p class=&quot;indent&quot;&gt;   By using the canonical SoP representation, we could easily deduce that &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {MUX}(x_1, x_2, s) = x_1&apos; x_2 s + x_1 x_2&apos; s&apos; + x_1 x_2 s&apos; + x_1 x_2 s\)&lt;/span&gt;.
Either by using laws/theorems from boolean algebra that we have learnt or the
K-map, we could simply this function further. Let’s try simple algebraic
manipulation and see if it takes us somewhere:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \operatorname {MUX}(x_1, x_2, s) &amp;amp;= x_1&apos; x_2 s + x_1 x_2&apos; s&apos; + x_1 x_2 s&apos; + x_1 s_2 s = \\ &amp;amp;= x_1&apos; x_2 s + x_1 x_2&apos; s&apos; + x_1 x_2 (s&apos; + s) \\ &amp;amp;= x_1&apos; x_2 s + x_1 x_2&apos; s&apos; + x_1 x_2 \\ &amp;amp;= x_1&apos; x_2 s + x_1 (x_2&apos; s&apos; + x_2) \\ &amp;amp;= x_1&apos; x_2 s + x_1 (s&apos; + x_2) \\ &amp;amp;= x_1&apos; x_2 s + x_1 s&apos; + x_1 x_2 \\ &amp;amp;= x_1 s&apos; + x_2 (x_1 + x_1&apos; s) \\ &amp;amp;= x_1 s&apos; + x_2 (x_1 + s) \\ &amp;amp;= x_1 s&apos; + x_2 s + x_1 x_2 \\ &amp;amp;= x_1 s&apos; + x_2 s \\ \end{align*}&lt;/div&gt;
&lt;!-- l. 851 --&gt;&lt;p class=&quot;indent&quot;&gt;   The last reduction was done by following the case analysis below:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} \text {case 1. } &amp;amp; x_1 x_2 = 0 \\ &amp;amp; \operatorname {MUX}(x_1, x_2, s) = x_1 s&apos; + x_2 s \\ \text {case 2. } &amp;amp; x_1 x_2 = 1 \implies \begin {cases} \operatorname {MUX}(x_1, x_2, s) = 1 \\ x_1 = 1 \text { and } x_2 = 1 \end {cases} \\ &amp;amp; \operatorname {MUX}(x_1, x_2, s) = x_1 s&apos; + x_2 s = s&apos; + s = 1 \end{align*}&lt;/div&gt;
&lt;!-- l. 864 --&gt;&lt;p class=&quot;indent&quot;&gt;   Since we now know that &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {MUX}(x_1, x_2, s) = x_1 s&apos; + x_2 s\)&lt;/span&gt;, it is easy to understand the MUX’s circuit
implemented by using a bunch of AND, OR, NOT gates, as depicted on the
figure given previously. Finally, here is what our infamous &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x_1, x_2, \texttt {computeOR})\)&lt;/span&gt; function looks
like:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 868 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mux_2x1_intro_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 873 --&gt;&lt;p class=&quot;indent&quot;&gt;   The last thing about the MUX is how many potential inputs there are, only
one of which to be forwareded to the final output wire. Up until now, we
have only seen MUX with two potential inputs that can be forwarded
depending on the &lt;span class=&quot;cmbx-12&quot;&gt;select &lt;/span&gt;bit &lt;span class=&quot;mathjax-inline&quot;&gt;\(s\)&lt;/span&gt;. We are going to call the MUX we have seen
&lt;span class=&quot;cmti-12&quot;&gt;2x1 MUX&lt;/span&gt;; where “2x1” means it has 2 non-select inputs (these are the
inputs that can potentially be forwarded to the output) and 1 output.
But can we have 4x1 MUX? The answer is yes, and it will necessarily
have 2 select bits (because one select bit is not enough to select among 4
different input values). One way of building 4x1 MUX is to write out
its truth table and come up with boolean function, as we did for 2x1
MUX. Another way of building it is by using several 2x1 MUXs as shown
below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 877 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mux_4x1_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 882 --&gt;&lt;p class=&quot;indent&quot;&gt;   The truth table for this 4x1 MUX is given below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 884 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-x-mux1&quot;&gt;   &lt;a id=&quot;x1-19005r2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-23&quot;&gt;&lt;colgroup id=&quot;TBL-23-1g&quot;&gt;&lt;col id=&quot;TBL-23-1&quot; /&gt;&lt;col id=&quot;TBL-23-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-23-3g&quot;&gt;&lt;col id=&quot;TBL-23-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-23-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(s_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(s_2\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {MUX}(x_1, x_2, x_3, x_4, s_1, s_2)\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-23-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-23-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_2\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-23-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_3\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-23-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-23-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_4\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                     &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 4.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 4x1 MUX&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-19005r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 900 --&gt;&lt;p class=&quot;indent&quot;&gt;   So, use your imagination and try to build 3x1 MUX (also write out its truth
table for clear understanding), and 8x1 MUX. It is an easy pattern to build any
&lt;span class=&quot;mathjax-inline&quot;&gt;\(2^n\)&lt;/span&gt;x1 MUX (for any &lt;span class=&quot;mathjax-inline&quot;&gt;\(n \in \mathbb {N^+}\)&lt;/span&gt;) once you get the intuition; this is also where it becomes
obvious that a &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^n\)&lt;/span&gt;x1 MUX must have &lt;span class=&quot;mathjax-inline&quot;&gt;\(n\)&lt;/span&gt; select bits.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;demultiplexer-demux&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.1.2   &lt;/span&gt; &lt;a id=&quot;x1-200004.1.2&quot;&gt;&lt;/a&gt;Demultiplexer (DEMUX)&lt;/h4&gt;
&lt;!-- l. 903 --&gt;&lt;p class=&quot;noindent&quot;&gt;We know what MUX is and what it is useful for. It is re-routes only one of its
many inputs to the final output wire. Now, what if we have only one input
that needs to be routed to only one of many output wires? As 2x1 MUX
routes one of 2 inputs to the single output, a 1x2 DEMUX routes single
input to one of 2 outputs. Hopefully, you get the naming convention by
now.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;!-- l. 908 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_demux.png&quot; width=&quot;50%&quot; /&gt;                          &lt;/p&gt;&lt;/div&gt; &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_demux_impl.png&quot; width=&quot;50%&quot; /&gt;                                            &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 918 --&gt;&lt;p class=&quot;indent&quot;&gt;   The circuit element for 1x2 DEMUX is depicted on the left side of the picture
given above. If you do not understand why 1x2 DEMUX implementation shown
on the right side of the same picture works, keep reading; and if you do
understand it, you can skip to the next section.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 922 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/demux_intro.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 927 --&gt;&lt;p class=&quot;indent&quot;&gt;   Well, let’s first write out the truth table:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 930 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-x-demux&quot;&gt;   &lt;a id=&quot;x1-20001r3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-24&quot;&gt;&lt;colgroup id=&quot;TBL-24-1g&quot;&gt;&lt;col id=&quot;TBL-24-1&quot; /&gt;&lt;col id=&quot;TBL-24-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-24-3g&quot;&gt;&lt;col id=&quot;TBL-24-3&quot; /&gt;&lt;col id=&quot;TBL-24-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-24-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(s\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-24-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-24-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-24-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-24-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-24-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                     &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 4.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 1x2 DEMUX&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-20001r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 945 --&gt;&lt;p class=&quot;indent&quot;&gt;   In other words,
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 948 --&gt;&lt;p class=&quot;indent&quot; id=&quot;compact-truth-table-for-x-demux&quot;&gt;   &lt;a id=&quot;x1-20002r4&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-25&quot;&gt;&lt;colgroup id=&quot;TBL-25-1g&quot;&gt;&lt;col id=&quot;TBL-25-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-25-2g&quot;&gt;&lt;col id=&quot;TBL-25-2&quot; /&gt;&lt;col id=&quot;TBL-25-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-25-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(s\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-25-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-25-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-25-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                    &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 4.4: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Compact truth table for 1x2 DEMUX&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-20002r4  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 961 --&gt;&lt;p class=&quot;indent&quot;&gt;   By looking at these truth tables, we can conclude that &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1 = x s&apos;\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2 = x s\)&lt;/span&gt;. Therefore, the
implementation shown below shoud make sense now.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 965 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/demux_1x2_intro_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 970 --&gt;&lt;p class=&quot;indent&quot;&gt;   It should be straight forward to see how 1xN DEMUX can be built by using a
bunch of 1x2 DEMUXs. In addition, it should also be obvious by now that a 1xN
DEMUX must have &lt;span class=&quot;mathjax-inline&quot;&gt;\(log_2 N\)&lt;/span&gt; select bits.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;encoder&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.1.3   &lt;/span&gt; &lt;a id=&quot;x1-210004.1.3&quot;&gt;&lt;/a&gt;Encoder&lt;/h4&gt;
&lt;!-- l. 973 --&gt;&lt;p class=&quot;noindent&quot;&gt;Imagine you have a number 3, which you would like to represent in binary.
Obviously, a common way would be &lt;span class=&quot;mathjax-inline&quot;&gt;\(3_{10} = 11_{2}\)&lt;/span&gt; or 0011 by using 4 bits. There is another way
to represent 3 by using bits: it’s called &lt;span class=&quot;cmbx-12&quot;&gt;one-hot encoding &lt;/span&gt;and here is how it
works:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 975 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-26&quot;&gt;&lt;colgroup id=&quot;TBL-26-1g&quot;&gt;&lt;col id=&quot;TBL-26-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-26-2g&quot;&gt;&lt;col id=&quot;TBL-26-2&quot; /&gt;&lt;col id=&quot;TBL-26-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-26-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Base-10  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Base-2 (using 4 bits)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; One-hot  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-26-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        0000            &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0001    &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-26-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0001 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0010&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-26-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    2      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        0010            &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0100    &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-26-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    3      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        0011            &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-26-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1000    &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                             &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 991 --&gt;&lt;p class=&quot;indent&quot;&gt;   In n-bit one-hot encoding representation of numbers, a number is
represented by only one turned on (hot bit) and n-1 bits turned off (cold bits).
That’s why it is called one-hot encoding and not two-hot encoding. To
represent number &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; by using one-hot encoding, the hot bit must be at
index &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; bits left to the rightmost bit in the one-hot representation. For
example, 7 is represented as “0010000000” in 10-bit one-hot encoding
system.
&lt;/p&gt;&lt;!-- l. 993 --&gt;&lt;p class=&quot;indent&quot;&gt;   A &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\)&lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;xN encoder &lt;/span&gt;is essentially a converter from &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\)&lt;/span&gt;-bit one-hot encodings to &lt;span class=&quot;mathjax-inline&quot;&gt;\(N\)&lt;/span&gt;-bit
binary numbers. Implementing 2x1 encoder is straight forward. This is how a
typical 4x2 encoder could be implemented naively:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 997 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_naive_encoder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1002 --&gt;&lt;p class=&quot;indent&quot;&gt;   It is a naive implementation in some sense because even though all input bits
can be 0 and the output would still be 00, which is not the correct conversion, we
have no way of knowing that 0000 input was actually invalid in the first
place.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1006 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_encoder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1011 --&gt;&lt;p class=&quot;indent&quot;&gt;   The implementation above still have a problem: it will output 11 for all of the
following inputs: input 1000, input 1001, input 1010, input 1011, input 1100, and
so on. Now, this behevior is not something that was in a typical encoder’s truth
table. That’s why there is another type of encoder that formally accepts this
behavior.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1015 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_priority_encoder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1020 --&gt;&lt;p class=&quot;indent&quot;&gt;   The implementation shown above is called &lt;span class=&quot;cmbx-12&quot;&gt;priority encoder &lt;/span&gt;because it
eliminates the previous problem by converting one-hot encoding to its binary
number representation only by using the &lt;span class=&quot;cmti-12&quot;&gt;most significant hot bit&lt;/span&gt;. Therefore, even
if there are multiple hot bits in the input, it will assume that only the hot MSB
is correct and the rest is to be neglected while converting into binary
representation.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;decoder&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.1.4   &lt;/span&gt; &lt;a id=&quot;x1-220004.1.4&quot;&gt;&lt;/a&gt;Decoder&lt;/h4&gt;
&lt;!-- l. 1023 --&gt;&lt;p class=&quot;noindent&quot;&gt;We know what a &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\)&lt;/span&gt;xN encoder is and how it works. It translates one-hot
encodded representation into a binary representation. What if we wanted to
go in the opposite direction, that is, translating a binary representation
into one-hot encoded representation? This is exactly what a Nx&lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\) &lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;decoder&lt;/span&gt;
does.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1027 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c4s1_decoder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1032 --&gt;&lt;p class=&quot;indent&quot;&gt;   A picture given above is an implementation for a 2x4 decoder. Implementing a
Nx&lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\)&lt;/span&gt; decoder is more straight forward than implementing a &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^N\)&lt;/span&gt;xN encoder because all
we have to do is to come up with a single product term for each output of the
decoder. For 2x4 decoder, 4 boolean functions can be inferred from the truth table
given below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-22001r4&quot;&gt;&lt;span id=&quot;truth-table-for-x-decoder&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-27&quot;&gt;&lt;colgroup id=&quot;TBL-27-1g&quot;&gt;&lt;col id=&quot;TBL-27-1&quot; /&gt;&lt;col id=&quot;TBL-27-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-27-3g&quot;&gt;&lt;col id=&quot;TBL-27-3&quot; /&gt;&lt;col id=&quot;TBL-27-4&quot; /&gt;&lt;col id=&quot;TBL-27-5&quot; /&gt;&lt;col id=&quot;TBL-27-6&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-27-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_2\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_3\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-1-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_0\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-27-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-27-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-27-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-4-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-27-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-27-5-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                             &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.4: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 2x4
decoder.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-22001r4  --&gt;                      &lt;/div&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\implies \)&lt;/span&gt; &lt;div class=&quot;minipage&quot;&gt;&lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} y_0 &amp;amp;= x_1&apos; x_0&apos; \\ y_1 &amp;amp;= x_1&apos; x_0 \\ y_2 &amp;amp;= x_1 x_0&apos; \\ y_3 &amp;amp;= x_1 x_0 \\ \end{align*}&lt;/div&gt;                                        &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1060 --&gt;&lt;p class=&quot;indent&quot;&gt;   Each &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_i\)&lt;/span&gt; is represented in terms of a single product term because there is only
one row where each &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_i = 1\)&lt;/span&gt;.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;timing&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;4.2   &lt;/span&gt; &lt;a id=&quot;x1-230004.2&quot;&gt;&lt;/a&gt;Timing&lt;/h3&gt;
&lt;!-- l. 1063 --&gt;&lt;p class=&quot;noindent&quot;&gt;When we work with boolean logic there is essentially no notion of time in our
calculus. It means that we do not take into account the flow of time as we
compute boolean functions on paper. It is because there is no meaning to talk
about how much second it took us to compute boolean function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy&apos; + x&apos;yz + z&apos;\)&lt;/span&gt;. It is because
even though I may need 5 seconds to compute the function’s output, when I tell
you that the function’s output for the input &lt;span class=&quot;mathjax-inline&quot;&gt;\((x=1, y=1, z=0)\)&lt;/span&gt; is 1, you know that I have finished
my calculation (after 5 seconds). However, within the initial 5 seconds, I could not
possibly give you the answer because I wasn’t finished calculating ANDs,
ORs, and NOTs. So, you know that the answer I give you is going to be
right because you also know that I wouldn’t have given it to you in the
first place if I wasn’t done calculating. But this is not how machinery
works…
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-23001r5&quot;&gt;&lt;span id=&quot;circuit-for-fx-y-z-xy-xyz-z&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1067 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_intro.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.5: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Circuit for &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x, y, z) = xy&apos; + x&apos;yz + z&apos;\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-23001r5  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1072 --&gt;&lt;p class=&quot;indent&quot;&gt;   The circuit above is the implementation of the function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;. Now, suppose that
we would like to compute &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(1, 1, 0)\)&lt;/span&gt; first: so, we need to constantly feed the electrical
signals &lt;span class=&quot;mathjax-inline&quot;&gt;\(5V\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(5V\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(0V\)&lt;/span&gt;, respectively. As long as we keep feeding these signals to the circuit
the answer is going to come out as &lt;span class=&quot;mathjax-inline&quot;&gt;\(5V\)&lt;/span&gt;, which is equivalent to the boolean value of 1.
Then, the next second we change the voltages accross the input channels so the
the input now represents &lt;span class=&quot;mathjax-inline&quot;&gt;\(x=0\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y=1\)&lt;/span&gt;, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(z=1\)&lt;/span&gt;. What do we expect to see at the output?
Obviously, still &lt;span class=&quot;mathjax-inline&quot;&gt;\(5V\)&lt;/span&gt; or boolean 1. Is it going to appear immediatly, though? No, not
at all. Let’s see why.
&lt;/p&gt;&lt;!-- l. 1074 --&gt;&lt;p class=&quot;indent&quot;&gt;   It takes some time for the electricity to travel accross wire. The longer the
wire, the more time it needs to reach the destination. This is called a &lt;span class=&quot;cmbx-12&quot;&gt;delay&lt;/span&gt;. I
think, this is pretty intuitive thing to think about. For simplicity, let’s assume
that for the electricity to flow past the wires and transistors inside each logic gate
is fixed at 1ns. We can conclude three things now from this information
alone:
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-23003x1&quot;&gt;It must have taken ?ns to compute &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(1, 1, 0)\)&lt;/span&gt; in the first place; so, within the
      ?ns the value at the output wire must have been unreliably because the
      calculation was not actually done by the circuit.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-23005x2&quot;&gt;After the first ?ns, the output must have been 0 for the new input (0,
      1, 1). (oh-ooh! we were expecting to see 1…)
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-23007x3&quot;&gt;It was only after the first ?ns, that the circuit’s output must have
      stabilized at boolean value 1.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 1082 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here is the timing diagram to illustrate this process more clearly:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-23008r6&quot;&gt;&lt;span id=&quot;timing-diagram-for-the-function-f&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;!-- l. 1087 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_intro2.png&quot; width=&quot;95%&quot; /&gt;                                &lt;/p&gt;&lt;/div&gt; &lt;div class=&quot;minipage&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_intro2_diagram.png&quot; width=&quot;95%&quot; /&gt;                                           &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.6: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Timing diagram for the function &lt;span class=&quot;mathjax-inline&quot;&gt;\(f\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-23008r6  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1097 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, you may get the intuition why timing is important for circuitry. It is
because the circuitry does not have a way to be silent until it finished the
calculations completely. Instead, it always outputs something: 0 or 1 (this is not
completely true, but for the sake of simplicity let’s assume that it is for a moment;
thank you). Moreover, if we did not know the least amoung of time it needed to
fully calculate &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(0, 1, 1)\)&lt;/span&gt; (that is ?ns in our example), we could have probed the output
sooner (for example, after ?ns) and got the wrong result. Such short-term
oscillating behavior of circuits is called a &lt;span class=&quot;cmbx-12&quot;&gt;glitch&lt;/span&gt;, and for us to avoid circuit
glitches, we need to know how much we should wait for the circuit’s output to
stabilize so that we do not probe the output wire while the circuit is still glitching
potentially.
&lt;/p&gt;&lt;!-- l. 1099 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here I am going to talk about only two types of delays: (1) propagation delay
and (2) contamination delay. &lt;span class=&quot;cmbx-12&quot;&gt;Propagation delay &lt;/span&gt;is the maximum amount of
time that electicity needs to travel from input to output. In our example, the
propagation delay is &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {(AND)} = \)&lt;/span&gt;ns &lt;span class=&quot;cmbx-12&quot;&gt;Contamination delay &lt;/span&gt;is the minimum amount of time
that electricity needs to travel from input to output of the circuit. In our example,
the contamination delay is &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {OR} = \)&lt;/span&gt;ns. The longest and shortest paths are shown with red
and green colors below to indicate propagation and contamination delays,
respectively:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-23009r7&quot;&gt;&lt;span id=&quot;the-red-path-for-propagation-delay-green-path-for-contamination-delay&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1103 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_intro3.png&quot; width=&quot;85%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 4.7: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;The red path for propagation delay, green path for contamination
delay&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-23009r7  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1108 --&gt;&lt;p class=&quot;indent&quot;&gt;   The notion of delays will become more important as we move forward in the
book toward building a real functional computer from scratch&lt;span class=&quot;mathjax-inline&quot;&gt;\({}^*\)&lt;/span&gt;.
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;sequential-logic&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 5&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-240005&quot;&gt;&lt;/a&gt;Sequential Logic&lt;/h2&gt;
&lt;!-- l. 1111 --&gt;&lt;p class=&quot;noindent&quot;&gt;We have learned about the combinational logic: it is a logic to compute output
only by using current inputs without taking into account knowledge of
the past. In contrast, &lt;span class=&quot;cmbx-12&quot;&gt;Sequential logic &lt;/span&gt;is a logic that also (may) takes
the knowledge of the past into account as well while computing the final
output. In this sense, it is more general kind of logic than the combinational
logic.
&lt;/p&gt;&lt;!-- l. 1113 --&gt;&lt;p class=&quot;indent&quot;&gt;   Essential sequential circuits for building a computer are:
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-24002x1&quot;&gt;Clock
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-24004x2&quot;&gt;Memory
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-24006x3&quot;&gt;Counter&lt;/li&gt;&lt;/ol&gt;
   
&lt;!-- l. 1121 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;paragraphHead&quot; id=&quot;synchronous-and-asynchronous-circuits&quot;&gt;&lt;a id=&quot;x1-25000&quot;&gt;&lt;/a&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Synchronous and Asynchronous circuits.&lt;/span&gt;&lt;/span&gt;
   There are two subtypes of sequential circuits: (1) &lt;span class=&quot;cmti-12&quot;&gt;synchronous &lt;/span&gt;and
(2) &lt;span class=&quot;cmti-12&quot;&gt;asynchronous &lt;/span&gt;circuit. Their definitions and differences between them
will become more obvious as you learn about the notion of &lt;span class=&quot;cmti-12&quot;&gt;clock &lt;/span&gt;and
&lt;span class=&quot;cmti-12&quot;&gt;memory&lt;/span&gt;.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;finite-state-machine-fsm&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.1   &lt;/span&gt; &lt;a id=&quot;x1-260005.1&quot;&gt;&lt;/a&gt;Finite State Machine (FSM)&lt;/h3&gt;
                                                                          

                                                                          
&lt;!-- l. 1125 --&gt;&lt;p class=&quot;noindent&quot;&gt;Not all processes are combinational inherently. It means that there are processes
that require taking into account some information from the past while computing
an output. For example, you can never use solely combinational logic to decide
whether a turnstile would have allowed a person to pass through or hold them by
knowing person’s current action/input on the turnstile. The set of all
possible actions/inputs on the turnstile system is: &lt;span class=&quot;cmti-12&quot;&gt;using-turnstile-pass &lt;/span&gt;and
&lt;span class=&quot;cmti-12&quot;&gt;turning-turnstile-arm&lt;/span&gt;. Well, if I asked you what would happen if the person tried
&lt;span class=&quot;cmti-12&quot;&gt;turning-turnstile-arm&lt;/span&gt;, you would not be able to answer this questions since there
is simply not enough information to be able to answer correctly: you should know
whether the person took the &lt;span class=&quot;cmti-12&quot;&gt;using-turnstile-pass&lt;/span&gt;, which means buying a pass
tiket and then activating/unlocking the turnstile with it, action on the
turnstile before trying to turn its arm. Therefore, information about the
current time is not enough to determine the future (simply because we do
not know if the person paid for the turnstile pass or not). If we tried
to build a digital circuit with a single-bit input (that is, if person tried
turning-turnstile-arm (input bit 1) or they did not (input bit 0)) and
a single output that decided the answer of our question (input bit 1 if
the arms turned, and output bit 0, otherwise), we would not be able to
make it purely combinational. This is where the notion of &lt;span class=&quot;cmbx-12&quot;&gt;states &lt;/span&gt;emerge
naturally. A &lt;span class=&quot;cmbx-12&quot;&gt;state &lt;/span&gt;is the abstraction of a persistent storage that keeps track
of knowledge of the past. The picture below illustrates what I mean to
say:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-26001r1&quot;&gt;&lt;span id=&quot;state-diagram-for-a-state-turnstile&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1129 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/turnstile_state_diagram.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;State diagram for a 2-state turnstile.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-26001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1134 --&gt;&lt;p class=&quot;indent&quot;&gt;   The two circles shown on the diagram above represent the two distinct (and
&lt;span class=&quot;cmti-12&quot;&gt;hidden &lt;/span&gt;since we do not know whether the turnstile is unlocked or locked just by
looking at it without any past knowledge) states of the turnstile: &lt;span class=&quot;cmti-12&quot;&gt;locked &lt;/span&gt;or
&lt;span class=&quot;cmti-12&quot;&gt;unlocked&lt;/span&gt;. The arrows between the states are called &lt;span class=&quot;cmbx-12&quot;&gt;state transitions&lt;/span&gt;; they
represent the current input/action of the person using the turnstile. The
turnstile becomes &lt;span class=&quot;cmti-12&quot;&gt;unlocked &lt;/span&gt;after purchasing and &lt;span class=&quot;cmti-12&quot;&gt;using-turnstile-pass&lt;/span&gt;, and
becomes &lt;span class=&quot;cmti-12&quot;&gt;locked &lt;/span&gt;after &lt;span class=&quot;cmti-12&quot;&gt;turning-turnstile-arm&lt;/span&gt;. If it is already locked and the
person insists &lt;span class=&quot;cmti-12&quot;&gt;turning-turnstile-arm&lt;/span&gt;, it is obvious that it will keep being in
the same locked state. Likewise, if it is already unlocked and the person
insists &lt;span class=&quot;cmti-12&quot;&gt;using-turnstile-pass&lt;/span&gt;, it will keep being in the same unlocked state.
What is more important now is that this &lt;span class=&quot;cmbx-12&quot;&gt;state diagram &lt;/span&gt;is capable of
answering our questions: it is capable of answering the question of “whether
the turnstile arm would have turned or not depending on the person’s
current action on it” is now within the reach because there are these
states that are permenantly embedded in the diagram (as well as in the
digital circuit that we are going to build later), and we get to access the
hidden information about the past (whether person has used its pass
for the turnstile in the most recent past) by keeping track of a single
active state in the diagram throughout time. Note that having multiple
states are different than having multiple actions because actions need to
be provided explicitly while the states are tracked automatically by the
circuit.
&lt;/p&gt;&lt;!-- l. 1136 --&gt;&lt;p class=&quot;indent&quot;&gt;   Understanding the notion of states are really important, so I will give another
intuitive example. Imagine you wanted to build a box with 2 buttons, On and Off.
Each button is connected to the circuit inside the box through their own wires.
Pressing each button would send an electric (high or 1) signal to the circuit inside
the box through their corresponding wires as long as the button is pressed,
and releasing them would send 0 signal to the circuit as long as they are
released.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-26002r2&quot;&gt;&lt;span id=&quot;a-mystical-box-with-the-wisdom-of-the-past&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1140 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mystic_box.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;A mystical box with the wisdom of the past.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-26002r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1145 --&gt;&lt;p class=&quot;indent&quot;&gt;   This is how you would like the box to operate:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1147 --&gt;&lt;p class=&quot;indent&quot; id=&quot;analysis-of-the-mystic-boxs-behavior&quot;&gt;   &lt;a id=&quot;x1-26003r1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-28&quot;&gt;&lt;colgroup id=&quot;TBL-28-1g&quot;&gt;&lt;col id=&quot;TBL-28-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-28-2g&quot;&gt;&lt;col id=&quot;TBL-28-2&quot; /&gt;&lt;col id=&quot;TBL-28-3&quot; /&gt;&lt;col id=&quot;TBL-28-4&quot; /&gt;&lt;col id=&quot;TBL-28-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-28-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Time    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      0          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      1          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      2          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      3          &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-28-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” released  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-28-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green      &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-28-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Time &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 4 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 5 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 6 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 7&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-28-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” released  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” pressed  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-28-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-28-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   Time    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      8          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      9          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      10         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      11         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-28-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On released”  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-28-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-28-9-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Analysis of the mystic box’s behavior.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-26003r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1172 --&gt;&lt;p class=&quot;indent&quot;&gt;   When a button is released, it no longer sends the high signal (input bit 1) to
the circuit, and therefore, its input becomes low (input bit 0). Taking no
action after releasing a button also performs the same thing since both
buttons are in a released state or “0 state”. Since any combinational logic is
capable of representing pure mathemetical functions (that is, a mapping is a
mathematical function if and only if there exists a single unique &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt; value
for each &lt;span class=&quot;mathjax-inline&quot;&gt;\(x\)&lt;/span&gt; such that &lt;span class=&quot;mathjax-inline&quot;&gt;\(f(x) = y\)&lt;/span&gt;). Due to this “past-independent” behavior, the best
combinational circuit we could have made for this box would behave as shown
below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1174 --&gt;&lt;p class=&quot;indent&quot; id=&quot;limitation-of-any-combinational-circuit-compared-to-the-mystical-box&quot;&gt;   &lt;a id=&quot;x1-26004r2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-29&quot;&gt;&lt;colgroup id=&quot;TBL-29-1g&quot;&gt;&lt;col id=&quot;TBL-29-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-29-2g&quot;&gt;&lt;col id=&quot;TBL-29-2&quot; /&gt;&lt;col id=&quot;TBL-29-3&quot; /&gt;&lt;col id=&quot;TBL-29-4&quot; /&gt;&lt;col id=&quot;TBL-29-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-29-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Time    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      0          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      1          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     2        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      3          &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-29-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” released  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (no action)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-29-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      X          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     X        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      X         &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-29-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Time &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 4 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 5 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 6 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 7&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-29-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” pressed  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” released  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (no action)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On” pressed  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-29-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      X          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     X        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    Green      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-29-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   Time    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      8          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      9          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     10       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      11         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-29-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  Action   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “On released”  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  (no action)   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (no action)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; “Off” pressed  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-29-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Box color  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      X          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      X          &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     X        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-29-9-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     Red        &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Limitation of any combinational circuit compared to the mystical
box.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-26004r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1199 --&gt;&lt;p class=&quot;indent&quot;&gt;   The &lt;span class=&quot;cmti-12&quot;&gt;“On” pressed &lt;/span&gt;action represents input (1, 0) and the &lt;span class=&quot;cmti-12&quot;&gt;“Off” pressed &lt;/span&gt;action
represents input (0, 1); &lt;span class=&quot;cmti-12&quot;&gt;“On” released&lt;/span&gt;, &lt;span class=&quot;cmti-12&quot;&gt;“Off” released&lt;/span&gt;, &lt;span class=&quot;cmti-12&quot;&gt;(no action) &lt;/span&gt;actions
represent input (0, 0), and we do not allow pressing both buttons simultaneously,
making (1, 1) input impossible. Since releasing each button, as well as performing
no action after the release, send the input (0, 0) to the circuit inside the box
through the wires connected to the “On” and “Off” buttons respectively, we
would not be allowed to map these inputs to different outputs under the law of
combinational logic (recall that there must be exactly one &lt;span class=&quot;mathjax-inline&quot;&gt;\(y\)&lt;/span&gt; value for input (0, 0)
for any pure combinational function). This is shown in the table above by marking
the output for (0, 0) input with &lt;span class=&quot;cmbx-12&quot;&gt;X &lt;/span&gt;symbol. So, if we say let &lt;span class=&quot;cmbx-12&quot;&gt;X &lt;/span&gt;be the &lt;span class=&quot;cmbx-12&quot;&gt;Red &lt;/span&gt;light,
then time steps 1, 2, 3, 8 would not produce the expected behavior of
this mystical box that we wanted to build; and if we say let &lt;span class=&quot;cmbx-12&quot;&gt;X &lt;/span&gt;be the
&lt;span class=&quot;cmbx-12&quot;&gt;Green &lt;/span&gt;light, then time steps 5, 6, 11 would not match with the expected
behavior.
&lt;/p&gt;&lt;!-- l. 1201 --&gt;&lt;p class=&quot;indent&quot;&gt;   By going through the two examples provided above, one can understand the
problem: using combinational logic for certain types of tasks is just not
going to cut it! We need something more powerful, and that is obviously
&lt;span class=&quot;cmbx-12&quot;&gt;sequential logic&lt;/span&gt;. &lt;span class=&quot;cmbx-12&quot;&gt;Finite state machine &lt;/span&gt;or (FSM) is a machine that performs
sequential logic by using its sequential circuitry. The reason we call it “finite
state” is because any FSM’s state diagram must consists of a finite set of
states. There are two main types of FSMs: &lt;span class=&quot;cmbx-12&quot;&gt;Moore &lt;/span&gt;FSM and &lt;span class=&quot;cmbx-12&quot;&gt;Mealy&lt;/span&gt;
FSM. We are going to learn more about them through our mystical box
example.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;moore-and-mealy-fsms&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.1.1   &lt;/span&gt; &lt;a id=&quot;x1-270005.1.1&quot;&gt;&lt;/a&gt;Moore and Mealy FSMs&lt;/h4&gt;
&lt;!-- l. 1204 --&gt;&lt;p class=&quot;noindent&quot;&gt;There are two main types of FSMs as mentioned previously. Both types (Moore
and Mealy) of FSMs are pretty much the same: they use nodes to represent states
and arrows to represent transitions between the states. The main difference
between them is how they output something. Moore FSMs output a value from
the next active state, but Mealy FSM output upon transitioning to the next state.
Let’s see what this really means.
&lt;/p&gt;
                                                                          

                                                                          
   &lt;figure class=&quot;figure&quot; id=&quot;x1-27001r3&quot;&gt;&lt;span id=&quot;moore-fsm-for-the-mystic-box&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1208 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mystic_box_moore.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Moore FSM for the mystic box.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-27001r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1213 --&gt;&lt;p class=&quot;indent&quot;&gt;   The state diagram shown above is a Moore FSM for our mystical box example.
Each node contains two pieces of information in it: (1) state’s name and (2)
output value. Since this is a Moore machine, output values are written inside the
states with the following convention: [STATE NAME] / [&lt;span class=&quot;cmbx-12&quot;&gt;STATE OUTPUT&lt;/span&gt;].
One important thing here is that we also must know the initial state that is
active. Let’s suppose that the initial state was the “Green state”, and the input
was (0, 1) - that is, “On” released and “Off” pressed. The system will
transition to the next active state upon receiving this input, and the
active state will be the “Red state” with “&lt;span class=&quot;cmbx-12&quot;&gt;Red&lt;/span&gt;” output. After the Moore
machine transitions from the “Green state” to the “Red state”, it will
output “&lt;span class=&quot;cmbx-12&quot;&gt;Red&lt;/span&gt;”, meaning that the box’s color will be red. While it is in the
“Red state”, performing (0, 0) – &lt;span class=&quot;cmti-12&quot;&gt;“Off” released&lt;/span&gt;, &lt;span class=&quot;cmti-12&quot;&gt;(no action)&lt;/span&gt;, or &lt;span class=&quot;cmti-12&quot;&gt;“On”
released &lt;/span&gt;– will transition back to the same “Red state”, resulting with
the same “&lt;span class=&quot;cmbx-12&quot;&gt;Red&lt;/span&gt;” color output. Now, let’s see the Mealy version of this
machine.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-27002r4&quot;&gt;&lt;span id=&quot;mealy-fsm-for-the-mystic-box&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1217 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/mystic_box_mealy.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.4: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Mealy FSM for the mystic box.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-27002r4  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1222 --&gt;&lt;p class=&quot;indent&quot;&gt;   The state diagram above is the Mealy version of our mystic box. The only
difference is that it is not the states that output “Green” or “Red”, but
rather the transitions/arrows. In the Mealy FSM representation, if the
currently active state is the “Red state” and the input is (1, 0) – “On”
pressed, “Off” released“ – the machine will output ”Green“ first and then
transition to the ”Green state“. Hopefully, these examples made it easier for
the readers to informally understand the difference between Moore and
Mealy machines. Even though in this simple mystic box example, the
difference was pretty much in the written representation of the state diagrams
for these two types of FSMs, there are cases where switching from one
type of FSM to another reduces or increases the number of states, and
therefore, simplifies or complicates the state transitioning logic. Now, we
will see how we can simplify unnecessarily complicated state diagrams,
resulting in easier and cheaper construction of Moore/Mealy FSMs in
practice.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;fsm-simplification&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.1.2   &lt;/span&gt; &lt;a id=&quot;x1-280005.1.2&quot;&gt;&lt;/a&gt;FSM Simplification&lt;/h4&gt;
&lt;!-- l. 1225 --&gt;&lt;p class=&quot;noindent&quot;&gt;For simplifying FSMs, we will use tabular representation instead of the
diagramatic ones given as examples previously. Let’s consider the following Moore
FSM below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1227 --&gt;&lt;p class=&quot;indent&quot; id=&quot;tabular-representation-for-a-moore-fsm&quot;&gt;   &lt;a id=&quot;x1-28001r3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-30&quot;&gt;&lt;colgroup id=&quot;TBL-30-1g&quot;&gt;&lt;col id=&quot;TBL-30-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-30-2g&quot;&gt;&lt;col id=&quot;TBL-30-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-30-3g&quot;&gt;&lt;col id=&quot;TBL-30-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-30-4g&quot;&gt;&lt;col id=&quot;TBL-30-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; c &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
c&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-30-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      c         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-30-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      c         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-30-10-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-10-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
e&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-10-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-10-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-10-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-30-11-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-11-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-11-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-11-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-30-11-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Tabular representation for a Moore FSM.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28001r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1254 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here are the rules to simplify Moore machine:
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28003x1&quot;&gt;Find two states &lt;span class=&quot;cmbx-12&quot;&gt;p &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;such that &lt;span class=&quot;cmbx-12&quot;&gt;output of p = output of q&lt;/span&gt;, and
      &lt;span class=&quot;cmbx-12&quot;&gt;p &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\xrightarrow {x}\) &lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;s &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\xrightarrow {x}\) &lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;s &lt;/span&gt;for all (x, s) pairs.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28005x2&quot;&gt;When such two states exist, they are equivalent – remove &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;and replace
      all of its occurances in the table with &lt;span class=&quot;cmbx-12&quot;&gt;p&lt;/span&gt;.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28007x3&quot;&gt;Repeat the same process from start until no two equivalent states are
      found.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 1262 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s now try to simplify the Moore FSM. The first thing you may notice that
the states &lt;span class=&quot;cmbx-12&quot;&gt;a&lt;/span&gt;, &lt;span class=&quot;cmbx-12&quot;&gt;c&lt;/span&gt;, and &lt;span class=&quot;cmbx-12&quot;&gt;e &lt;/span&gt;have the same output value, which is 1. However, only &lt;span class=&quot;cmbx-12&quot;&gt;a&lt;/span&gt;
and &lt;span class=&quot;cmbx-12&quot;&gt;c &lt;/span&gt;transitions to &lt;span class=&quot;cmbx-12&quot;&gt;b &lt;/span&gt;on input 0 and &lt;span class=&quot;cmbx-12&quot;&gt;c &lt;/span&gt;on input 1. Therefore, these two
states are (semantically) equivalent. Let’s remove the third row from
the table and replace all occurances of &lt;span class=&quot;cmbx-12&quot;&gt;c &lt;/span&gt;with &lt;span class=&quot;cmbx-12&quot;&gt;a &lt;/span&gt;as shown in the table
below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1264 --&gt;&lt;p class=&quot;indent&quot; id=&quot;tabular-representation-for-a-moore-fsm-after-one-step-of-simplification&quot;&gt;   &lt;a id=&quot;x1-28008r4&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-31&quot;&gt;&lt;colgroup id=&quot;TBL-31-1g&quot;&gt;&lt;col id=&quot;TBL-31-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-31-2g&quot;&gt;&lt;col id=&quot;TBL-31-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-31-3g&quot;&gt;&lt;col id=&quot;TBL-31-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-31-4g&quot;&gt;&lt;col id=&quot;TBL-31-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-31-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-31-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
e&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-31-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-31-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.4:  &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Tabular  representation  for  a  Moore  FSM  after  one  step  of
simplification.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28008r4  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1288 --&gt;&lt;p class=&quot;indent&quot;&gt;   From the table above you may notice that the states &lt;span class=&quot;cmbx-12&quot;&gt;a&lt;/span&gt;, &lt;span class=&quot;cmbx-12&quot;&gt;d&lt;/span&gt;, and &lt;span class=&quot;cmbx-12&quot;&gt;e &lt;/span&gt;transition to
&lt;span class=&quot;cmbx-12&quot;&gt;b &lt;/span&gt;on input 0 and to &lt;span class=&quot;cmbx-12&quot;&gt;a &lt;/span&gt;on input 1. However, only &lt;span class=&quot;cmbx-12&quot;&gt;a &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;e &lt;/span&gt;output the same value,
which is 1. Therefore, these two states are equivalent. Finally, the simplified
Moore FSM, which still has the same input-output behavior, is given on the table
below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1290 --&gt;&lt;p class=&quot;indent&quot; id=&quot;simplified-moore-fsm&quot;&gt;   &lt;a id=&quot;x1-28009r5&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-32&quot;&gt;&lt;colgroup id=&quot;TBL-32-1g&quot;&gt;&lt;col id=&quot;TBL-32-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-32-2g&quot;&gt;&lt;col id=&quot;TBL-32-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-32-3g&quot;&gt;&lt;col id=&quot;TBL-32-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-32-4g&quot;&gt;&lt;col id=&quot;TBL-32-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-32-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-32-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
1&lt;/div&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-32-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-32-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-32-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     d         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-32-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
0&lt;/div&gt;      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-32-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-32-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;         &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.5: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Simplified Moore FSM.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28009r5  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1311 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, let’s consider the following Mealy FSM below (different than previous
Moore machine):
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1313 --&gt;&lt;p class=&quot;indent&quot; id=&quot;tabular-representation-for-a-mealy-fsm&quot;&gt;   &lt;a id=&quot;x1-28010r6&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-33&quot;&gt;&lt;colgroup id=&quot;TBL-33-1g&quot;&gt;&lt;col id=&quot;TBL-33-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-33-2g&quot;&gt;&lt;col id=&quot;TBL-33-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-33-3g&quot;&gt;&lt;col id=&quot;TBL-33-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-33-4g&quot;&gt;&lt;col id=&quot;TBL-33-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-33-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-33-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-33-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; c &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-33-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
c&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      c         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      e         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      c         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-10-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-10-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
e&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-10-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-10-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      e         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-10-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-33-11-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-11-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-11-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-11-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-33-11-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.6: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Tabular representation for a Mealy FSM.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28010r6  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1335 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here are the rules to simplify Mealy machine:
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28012x1&quot;&gt;Find two states &lt;span class=&quot;cmbx-12&quot;&gt;p &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;such that &lt;span class=&quot;cmbx-12&quot;&gt;p &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\xrightarrow {x/y}\) &lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;s &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\xrightarrow {x/y}\) &lt;/span&gt;&lt;span class=&quot;cmbx-12&quot;&gt;s &lt;/span&gt;for all (x, s, y) pairs.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28014x2&quot;&gt;When such two states exist, they are equivalent – remove &lt;span class=&quot;cmbx-12&quot;&gt;q &lt;/span&gt;and replace
      all of its occurances in the table with &lt;span class=&quot;cmbx-12&quot;&gt;p&lt;/span&gt;.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-28016x3&quot;&gt;Repeat the same process from start until no two equivalent states are
      found.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 1343 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s start simplifying. Look at the states &lt;span class=&quot;cmbx-12&quot;&gt;a &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;c&lt;/span&gt;. Both of them have the
same (0, b, 1) and (1, c, 1) pairs. Since they are equivalent, let’s remove the state
&lt;span class=&quot;cmbx-12&quot;&gt;c &lt;/span&gt;and replace all of its other occurences in the table with &lt;span class=&quot;cmbx-12&quot;&gt;a&lt;/span&gt;. Now we get the table
shown below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1345 --&gt;&lt;p class=&quot;indent&quot; id=&quot;tabular-representation-for-a-mealy-fsm-after-one-step-of-simplification&quot;&gt;   &lt;a id=&quot;x1-28017r7&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-34&quot;&gt;&lt;colgroup id=&quot;TBL-34-1g&quot;&gt;&lt;col id=&quot;TBL-34-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-34-2g&quot;&gt;&lt;col id=&quot;TBL-34-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-34-3g&quot;&gt;&lt;col id=&quot;TBL-34-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-34-4g&quot;&gt;&lt;col id=&quot;TBL-34-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-34-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-34-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-34-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-34-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-34-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-34-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      e         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-34-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-34-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
e&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      e         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-34-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-34-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.7:  &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Tabular  representation  for  a  Mealy  FSM  after  one  step  of
simplification.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28017r7  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1365 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s now look at the states &lt;span class=&quot;cmbx-12&quot;&gt;d &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;e&lt;/span&gt;. They have the same (0, e, 0) and (1, a, 1)
pairs. So, let’s replace the state &lt;span class=&quot;cmbx-12&quot;&gt;e &lt;/span&gt;with the state &lt;span class=&quot;cmbx-12&quot;&gt;d&lt;/span&gt;.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1367 --&gt;&lt;p class=&quot;indent&quot; id=&quot;simplified-mealy-fsm&quot;&gt;   &lt;a id=&quot;x1-28018r8&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-35&quot;&gt;&lt;colgroup id=&quot;TBL-35-1g&quot;&gt;&lt;col id=&quot;TBL-35-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-35-2g&quot;&gt;&lt;col id=&quot;TBL-35-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-35-3g&quot;&gt;&lt;col id=&quot;TBL-35-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-35-4g&quot;&gt;&lt;col id=&quot;TBL-35-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-35-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;State &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Input &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Next state &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Output &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-35-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
a&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-35-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; a &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-35-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
b&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     b         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-35-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     d         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-35-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
d&lt;/div&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     d         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-35-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;      a         &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-35-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.8: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Simplified Mealy FSM.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-28018r8  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1385 --&gt;&lt;p class=&quot;indent&quot;&gt;   The table given above is the final compressed and simplified version of our
original Mealy FSM. Both FSMs (original one and the minimized one) have the
same input-output behavior for all possible input sequences. This is important for
ensuring that the reductions and simplifications we do in an FSM do not alter its
behavior semantically.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;clock&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.2   &lt;/span&gt; &lt;a id=&quot;x1-290005.2&quot;&gt;&lt;/a&gt;Clock&lt;/h3&gt;
&lt;!-- l. 1388 --&gt;&lt;p class=&quot;noindent&quot;&gt;This section will be about something that we all use in our everyday lives. It
orchestrates all of us, all at once. It is called &lt;span class=&quot;cmbx-12&quot;&gt;clock&lt;/span&gt;. Clock is also an important
part of the computer architecture: it orchastrates the different components within
the computer. However, a clock inside a computer looks very different than the
clock we have used to use.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-29001r5&quot;&gt;&lt;span id=&quot;good-old-clock-that-we-all-love&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1392 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/good_old_clock.jpeg&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.5: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Good old clock that we all love.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-29001r5  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1397 --&gt;&lt;p class=&quot;indent&quot;&gt;   Humans use 12-hour or 24-hour format clocks. For example, in 12-hour wall
clock, there are 12 numbers from 1 to 12, and the clock head spins “clockwise”
from 1 to 12 and then starts from 1, hypothetically in a never ending infinite
loop… Computers use 2-hour format, instead: the clock has two numbers 0 and 1;
the clock oscillates between these two numbers. In contrast to the fanciness of the
good old clock that we all know and love, the clock used in a computer
architecture looks like this:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-29002r6&quot;&gt;&lt;span id=&quot;simple-clock-implementation-by-using-an-odd-number-of-not-gates&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1401 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/clock_intro_impl.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.6: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Simple clock implementation by using an odd number of NOT
gates.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-29002r6  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1406 --&gt;&lt;p class=&quot;indent&quot;&gt;   Simple and easy, right? I hope it automatically makes sense for the reader why
having a single self-wired NOT gate gives us what we want. It gives us the
oscillating OFF-ON-OFF-ON-OFF-ON-… signal. Here is what its timing diagram
looks like:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-29003r7&quot;&gt;&lt;span id=&quot;timing-diagram-for-clock&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1410 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/clock_intro.png&quot; width=&quot;85%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.7: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Timing diagram for clock.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-29003r7  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1415 --&gt;&lt;p class=&quot;indent&quot;&gt;   This particular timing diagram given above illustrates the oscillations of a 1
&lt;span class=&quot;mathjax-inline&quot;&gt;\(\mu \)&lt;/span&gt;Hz (&lt;span class=&quot;cmbx-12&quot;&gt;frequency&lt;/span&gt;) clock, meaning that the &lt;span class=&quot;cmbx-12&quot;&gt;clock period &lt;/span&gt;is 10 &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mu \)&lt;/span&gt;s.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;memory&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3   &lt;/span&gt; &lt;a id=&quot;x1-300005.3&quot;&gt;&lt;/a&gt;Memory&lt;/h3&gt;
&lt;!-- l. 1418 --&gt;&lt;p class=&quot;noindent&quot;&gt;Up until now you have learned about building digital circuits that output some
boolean value given an n-bit input. What if we wanted to store the output of a
circuit inside somewhere so that we can look it up later when we need it? Well,
you guessed it right: it is for this purpose that we need to build a memory
component. But… what is memory anyway? Without going to far into the rabbit
holes of philosophy, memory is kind of a thing that just persists over time even
when the environment around that thing changes. It sounds intuitive to
believe, isn’t it? Now, bare with me: if we were able to build a circuit that
preserves its output no matter what the inputs are then this piece of circuit
may be used as a memory. If we think with a little more care, we can
already understand the problem with this circuit: it never allows us to put
something in its output through the inputs somehow; it just memorized
whatever the random garbage values in its output upon construction. So, we
better update our view of the memory systems. Okay, let me try one
more time: A memory… a memory is something that gets updated only on
certain contexts and gets preserved on all other contexts. With this view of
the memory, we can now imagine a circuit that changes its 1-bit output
to
&lt;/p&gt;
      &lt;ul class=&quot;itemize1&quot;&gt;
      &lt;li class=&quot;itemize&quot;&gt;LOW when the input is (0, 1),
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;HIGH when the input is (1, 0),
                                                                          

                                                                          
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;retains its previous output when the input is (0, 0).&lt;/li&gt;&lt;/ul&gt;
&lt;!-- l. 1426 --&gt;&lt;p class=&quot;indent&quot;&gt;   So, we may naturally agree on the convention that the input signal
semantically represents (memorize-1, memorize-0): (1, 0) means the circuit must
memrize and remember boolean value 1, (0, 1) means the circuit must memorize
and preserve boolean value 0, and (0, 0) means nothing new needs to be
memorized and therefore the old memorized value must be kept as it is. The input
(1, 1) is special. It is special in a sense that it does not make any sense logically in
our convention: we cannot expect the circuit to memorize both boolean value 1
and 0 at the same time since it has only a single-bit memory. Here is how this
hypothetical circuit would behave over the valid inputs (0, 0), (0, 1), (1,
0):
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1428 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-a-simple-memory-circuit&quot;&gt;   &lt;a id=&quot;x1-30001r9&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-36&quot;&gt;&lt;colgroup id=&quot;TBL-36-1g&quot;&gt;&lt;col id=&quot;TBL-36-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-36-2g&quot;&gt;&lt;col id=&quot;TBL-36-2&quot; /&gt;&lt;col id=&quot;TBL-36-3&quot; /&gt;&lt;col id=&quot;TBL-36-4&quot; /&gt;&lt;col id=&quot;TBL-36-5&quot; /&gt;&lt;col id=&quot;TBL-36-6&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-36-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Time step &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   2    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   3    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-1-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   4    &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-36-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;cmbx-12&quot;&gt;Input     &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (1, 0)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (0, 0)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (0, 0)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (0, 1)  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; (0, 0)  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-36-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;cmbx-12&quot;&gt;Output    &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-36-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0    &lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;                                                          &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.9: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for a simple memory circuit.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-30001r9  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1440 --&gt;&lt;p class=&quot;indent&quot;&gt;   But wait! This looks like the mystic box’s behavior from the first section where
FSMs were introduced. It turns out that this is exactly the behavior of that
mystic box with two buttons; except that here “On” button stands for
“memorize-1” and “Off” button stands for “memorize-0”, and “Green” output is
represented by boolean value 1 and “Red” output is represented by boolean value
0. Recall that for the mystic box, it also didn’t make any sense to press both
“On” and “Off” buttons simultaneously since the box could output only
one color (“Green” or “Red”) at a time. Having said this, we now know
that the mystic box we saw can actually be used as a simple memory
component. Let’s write down the truth table for this mystic memory
box:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1442 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-the-simple-memory-circuit&quot;&gt;   &lt;a id=&quot;x1-30002r10&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-37&quot;&gt;&lt;colgroup id=&quot;TBL-37-1g&quot;&gt;&lt;col id=&quot;TBL-37-1&quot; /&gt;&lt;col id=&quot;TBL-37-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-37-3g&quot;&gt;&lt;col id=&quot;TBL-37-3&quot; /&gt;&lt;col id=&quot;TBL-37-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-37-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-37-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-38&quot;&gt;&lt;colgroup id=&quot;TBL-38-1g&quot;&gt;&lt;col id=&quot;TBL-38-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-38-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-38-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;memorize-1&lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-38-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-38-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Set&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                       &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-39&quot;&gt;&lt;colgroup id=&quot;TBL-39-1g&quot;&gt;&lt;col id=&quot;TBL-39-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-39-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-39-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;memorize-0&lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-39-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-39-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Reset&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                       &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-40&quot;&gt;&lt;colgroup id=&quot;TBL-40-1g&quot;&gt;&lt;col id=&quot;TBL-40-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-40-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-40-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;output at time &lt;span class=&quot;mathjax-inline&quot;&gt;\(t+1\)&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-40-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-40-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1}}\)&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                 &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q&apos;_{t+1}}\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-37-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                 &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_t}\)&lt;/span&gt;                                 &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q&apos;_t}\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-37-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-37-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-37-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                -                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-37-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; -  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                                                                                                                    &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.10: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for the simple memory circuit.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-30002r10  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1458 --&gt;&lt;p class=&quot;indent&quot;&gt;   From the truth table above we can clearly see that the output of this circuit,
which seems to possess one-bit memory, the output &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1}}\)&lt;/span&gt; may be equal to the output
value from the past &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_t}\)&lt;/span&gt; when the input is (0, 0). This implies that the circuit cannot
be purely combinational because at certain moment in the future, say &lt;span class=&quot;mathjax-inline&quot;&gt;\(t+100\)&lt;/span&gt;, the input
(0, 0) may be mapped to the output &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{99} = 0\)&lt;/span&gt; and in others, say &lt;span class=&quot;mathjax-inline&quot;&gt;\(t+200\)&lt;/span&gt;, the same input (0, 0)
may be mapped to the output &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{199} = 1\)&lt;/span&gt;. Since purely combinational cirucits cannot map
the same input to different outputs, this circuit must be sequential. Now, let’s see
how we could actually build a sequential circuit for this 1-bit memory, called &lt;span class=&quot;cmti-12&quot;&gt;SR
latch&lt;/span&gt;.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;sr-latch&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3.1   &lt;/span&gt; &lt;a id=&quot;x1-310005.3.1&quot;&gt;&lt;/a&gt;SR Latch&lt;/h4&gt;
&lt;!-- l. 1461 --&gt;&lt;p class=&quot;noindent&quot;&gt;Set-Reset or SR latch is what the mystic box from the first section of this chapter
represented informally. You have seen how this behavior exactly matches with the
behavior of a very simple 1-bit memory component that can update its memory
upon receiving certain inputs ((0, 1) and (1, 0)) and preserve the old 1-bit value
upon receiving another input ((0, 0)). So, we can control what’s kept in the
memory without explicitly knowing what’s kept in it. For example, if we wanted
to preserve the currently memorized boolean value in the next time step &lt;span class=&quot;mathjax-inline&quot;&gt;\(t+1\)&lt;/span&gt;, we
would provide the (0, 0) input at the time step &lt;span class=&quot;mathjax-inline&quot;&gt;\(t\)&lt;/span&gt;, and if we wanted to update or
memorize a new value 0 or 1, we would provide the (0, 1) or (1, 0) input,
respectively.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1465 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_sr_latch_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1470 --&gt;&lt;p class=&quot;indent&quot;&gt;   It turns out that it is really simple to build a sequential circuit for
SR latch. The circuit is given on the diagram above. It essentially has
two NAND gates and two NOT gates (one for each input bit &lt;span class=&quot;cmbx-12&quot;&gt;S&lt;/span&gt;et and
&lt;span class=&quot;cmbx-12&quot;&gt;R&lt;/span&gt;eset). The NAND gate on top outputs the thing that’s kept on the
memory currently - &lt;span class=&quot;cmbx-12&quot;&gt;Q&lt;/span&gt;. In contrast, the NAND gate on bottom outputs the
opposite of that thing - &lt;span class=&quot;cmbx-12&quot;&gt;Q’&lt;/span&gt;. Now, go ahead and check whether the previous
truth table that we saw for this SR latch makes perfect sense: verify the
outputs on the truth table by pushing the inputs through the SR latch’s
circuit.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1472 --&gt;&lt;p class=&quot;indent&quot; id=&quot;extended-truth-table-for-sr-latch&quot;&gt;   &lt;a id=&quot;x1-31001r11&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-41&quot;&gt;&lt;colgroup id=&quot;TBL-41-1g&quot;&gt;&lt;col id=&quot;TBL-41-1&quot; /&gt;&lt;col id=&quot;TBL-41-2&quot; /&gt;&lt;col id=&quot;TBL-41-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-41-4g&quot;&gt;&lt;col id=&quot;TBL-41-4&quot; /&gt;&lt;col id=&quot;TBL-41-5&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-41-6g&quot;&gt;&lt;col id=&quot;TBL-41-6&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-41-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;S &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;R &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_t}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1}}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q&apos;_{t+1}}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-1-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       Valid?          &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-41-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Yes, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1} = Q_t \neq Q&apos;_{t+1}}\)&lt;/span&gt;.&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Yes, same as above.  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-4-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       Yes, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1} = 0 \neq Q&apos;_{t+1}}\)&lt;/span&gt;.           &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-5-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Yes, same as above.  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-6-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       Yes, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1} = 1 \neq Q&apos;_{t+1}}\)&lt;/span&gt;.           &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-7-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Yes, same as above.  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-41-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-8-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       No, &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1} = Q&apos;_{t+1}\)&lt;/span&gt;.           &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-41-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-41-9-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       No, &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1} = Q&apos;_{t+1}\)&lt;/span&gt;.           &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                   &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.11: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Extended truth table for SR latch.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-31001r11  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1493 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s go through a couple of the rows from the truth table. Suppose the input
is (&lt;span class=&quot;mathjax-inline&quot;&gt;\(S=1\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(R=0\)&lt;/span&gt;) and the previously memorized value is &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t = 0\)&lt;/span&gt;. Then, we can compute &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1}}\)&lt;/span&gt; for the next
time step as follows:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1497 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/sr-latch-set.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1502 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, suppose that the input is (0, 0) and we have previously update the latch
to store 1. Then this is what happens in the next time step:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1506 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/sr-latch-hold.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1511 --&gt;&lt;p class=&quot;indent&quot;&gt;   If you go through all of the possible inputs from listed in the truth table, you
will verify the outputs mentioned. By doing this you will also see that the &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_{t+1}}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q&apos;_{t+1}}\)&lt;/span&gt;
become 1 when the input is (1, 1) and therefore, leads to metastability when the
input suddenly switches to (0, 0). When &lt;span class=&quot;mathjax-inline&quot;&gt;\(S_{t-1} = R_{t-1} = 1\)&lt;/span&gt; and then &lt;span class=&quot;mathjax-inline&quot;&gt;\(S_t = R_t = 0\)&lt;/span&gt;, it depends on the speed in
which one of the either input (&lt;span class=&quot;mathjax-inline&quot;&gt;\(S_t\)&lt;/span&gt; or &lt;span class=&quot;mathjax-inline&quot;&gt;\(R_t\)&lt;/span&gt;) reaches to the NAND gate before the
other one does, and then the output will settle either in 0 (if &lt;span class=&quot;mathjax-inline&quot;&gt;\(R_t\)&lt;/span&gt; reaches
NAND faster) or in 1 (if &lt;span class=&quot;mathjax-inline&quot;&gt;\(S_t\)&lt;/span&gt; reaches NAND faster). Since it is not up to us to
deterministically tell whether &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t = 1\)&lt;/span&gt; will be preserved in the next time step when &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt; is
also 1, providing the (1, 1) input is not a reliable way of storing boolean value
1.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;d-latch&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3.2   &lt;/span&gt; &lt;a id=&quot;x1-320005.3.2&quot;&gt;&lt;/a&gt;D Latch&lt;/h4&gt;
&lt;!-- l. 1514 --&gt;&lt;p class=&quot;noindent&quot;&gt;You have learned about the SR latch, which is a very basic but essential memory
component. Now, we are going to use this basic building block to build more
complex but also useful piece of memory circuitry. This one is called &lt;span class=&quot;cmbx-12&quot;&gt;D latch &lt;/span&gt;and
here is how it works: we provide two-bit input &lt;span class=&quot;cmbx-12&quot;&gt;(data, enable) &lt;/span&gt;to the D latch, and
if &lt;span class=&quot;cmbx-12&quot;&gt;enable &lt;/span&gt;bit is 0 then the previously memorized value at &lt;span class=&quot;mathjax-inline&quot;&gt;\(\mathbf {Q_t}\)&lt;/span&gt; is preserved for the
next time step &lt;span class=&quot;mathjax-inline&quot;&gt;\(t+1\)&lt;/span&gt;, otherwise (when &lt;span class=&quot;cmbx-12&quot;&gt;enable &lt;/span&gt;is 1) the memory is updated with the
value of the &lt;span class=&quot;cmbx-12&quot;&gt;data &lt;/span&gt;bit provided at time step &lt;span class=&quot;mathjax-inline&quot;&gt;\(t\)&lt;/span&gt;. Check out the truth table for D latch
below:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1516 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-d-latch&quot;&gt;   &lt;a id=&quot;x1-32001r12&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-42&quot;&gt;&lt;colgroup id=&quot;TBL-42-1g&quot;&gt;&lt;col id=&quot;TBL-42-1&quot; /&gt;&lt;col id=&quot;TBL-42-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-42-3g&quot;&gt;&lt;col id=&quot;TBL-42-3&quot; /&gt;&lt;col id=&quot;TBL-42-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-42-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(D_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(E_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_{t+1}\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-42-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-42-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-42-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-42-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-42-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                     &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.12: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for D latch.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-32001r12  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1532 --&gt;&lt;p class=&quot;indent&quot;&gt;   Since we do not want to start from scratch, we would like to use the SR latch
to build the D latch. Now, the question is how can we decide what inputs should
be provided to an SR latch so that it acts like the D latch? To answer this
question, let’s imagine the following scenario first. Suppose that you tell
me you have got a D latch in your pocket and you ask me to test you
without seeing or touching your D latch. For me to know whether you are
lying or not, I can give you random input values from the D latch’s truth
table and ask you about the output of the D latch in your pocket. If
what you say D latch outputs given my inputs do not match with the
expected output values from the truth table, then I will know that you are
lying.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1536 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/d-latch-interface.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1541 --&gt;&lt;p class=&quot;indent&quot;&gt;   You (the guy in the middle) will act like the interface for the SR latch in your
pocket, and through this interface I (the guy on the left) will get the impression
that I am actually working with a D latch. So, a D latch is essentially You + SR
latch in your pocket. Let’s see the complete truth table for the SR latch
interface:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1543 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-43&quot;&gt;&lt;colgroup id=&quot;TBL-43-1g&quot;&gt;&lt;col id=&quot;TBL-43-1&quot; /&gt;&lt;col id=&quot;TBL-43-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-43-3g&quot;&gt;&lt;col id=&quot;TBL-43-3&quot; /&gt;&lt;col id=&quot;TBL-43-4&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-43-5g&quot;&gt;&lt;col id=&quot;TBL-43-5&quot; /&gt;&lt;col id=&quot;TBL-43-6&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-43-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-43-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;D latch input&lt;/div&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-43-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;Corresponding SR latch input&lt;/div&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; colspan=&quot;2&quot; id=&quot;TBL-43-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;div class=&quot;multicolumn&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;Output&lt;/div&gt;  
&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-43-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; D  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    E      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; S  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;          R                &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_{t+1}\)&lt;/span&gt;  &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-43-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-43-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    0      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           0                 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-4-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt;  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-43-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           1                 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-5-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-43-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    1      &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           0                 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-43-6-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                    &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1561 --&gt;&lt;p class=&quot;indent&quot;&gt;   From the truth table above you could derive the following boolean functions
for S and R inputs to the SR latch: &lt;span class=&quot;mathjax-inline&quot;&gt;\(S(D, E) = DE\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(R(D, E) = D&apos;E\)&lt;/span&gt;. Building this circuit that outputs S and
R values given D and E values essentially replaces you (the guy in the middle
acting as an interface for the SR latch) and allows us to build the D latch circuit.
Here’s how this can be implemented by using SR latch and a couple of AND
gates:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1565 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_d_latch_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1570 --&gt;&lt;p class=&quot;indent&quot;&gt;   One last thing to note is that there is not invalid inputs when we
use a D latch. Each input is valid and has a particular meaning. This is
really nice if you want to avoid any uncertainties in your boolean logic
when it gets complex. It is especially useful to prove things about the
behavior of complex circuitry as well as to debug one when things go
sideways.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;d-flipflop&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3.3   &lt;/span&gt; &lt;a id=&quot;x1-330005.3.3&quot;&gt;&lt;/a&gt;D Flip-Flop&lt;/h4&gt;
&lt;!-- l. 1573 --&gt;&lt;p class=&quot;noindent&quot;&gt;You have seen how the D latch works: as long as the &lt;span class=&quot;cmti-12&quot;&gt;enable &lt;/span&gt;input is high, the
latch becomes transparent, i.e., &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1} = D\)&lt;/span&gt;. To make it opaque, we have to turn off the
&lt;span class=&quot;cmti-12&quot;&gt;enable &lt;/span&gt;bit after setting the correct &lt;span class=&quot;cmti-12&quot;&gt;data &lt;/span&gt;bit. Here is how a proper functioning of a
D latch would look like in real life:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-33001r8&quot;&gt;&lt;span id=&quot;timing-diagram-for-operating-d-latch&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1577 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_d_latch.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.8: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Timing diagram for operating D latch.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-33001r8  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1582 --&gt;&lt;p class=&quot;indent&quot;&gt;   If we hook the raw clock output to the &lt;span class=&quot;cmti-12&quot;&gt;enable &lt;/span&gt;bit of a D latch, then the setup
and hold times would be violated. What’s proven to be useful in practice is to
latch a new value once in every clock rising or positive clock edge. The memory
components that react to the edge (i.e., transitioning from LOW to HIGH or
from HIGH to LOW), as opposed to the stable HIGH input, is called
&lt;span class=&quot;cmbx-12&quot;&gt;flip-flops&lt;/span&gt;. This is as shown on the timing diagram of positive edge-triggered D
flip-flop:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-33002r9&quot;&gt;&lt;span id=&quot;timing-diagram-for-d-flip-flop&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1586 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_d_flipflop.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.9: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Timing diagram for D flip flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-33002r9  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1591 --&gt;&lt;p class=&quot;indent&quot;&gt;   A D flip flop can be implemented by using two ordinary D latches and a NOT
gate as follows:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1595 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_d_flipflop_impl.png&quot; width=&quot;70%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1600 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let the circuit diagram above sink in for a moment. There are 2 D latches: the
one connected to the data signal D is called &lt;span class=&quot;cmti-12&quot;&gt;master latch &lt;/span&gt;and the one connected
to the output of the master latch is called &lt;span class=&quot;cmti-12&quot;&gt;slave latch&lt;/span&gt;. The idea is as follows: since
this is a positive-edge triggered D flipflop, when the clock is low – the master
latch becomes transparent when the clock is low (the enable signal for the master
latch becomes 1 due to the NOT gate) and the slave latch becomes opaque; when
the clock is high – the master latch becomes opaque and the slave latch
becomes transparent, updating its output with whatever was latched into the
master latch when the clock signal was still low. This transitioning (i.e.,
master latch storing data when clock is low and slave latch storing master’s
output when clock is high) makes the whole circuit act as if it stores
the data signal during the positive clock edge. Here is how the timing
diagram for both master and slave latches in a D flip flop may look like in
practice:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-33003r10&quot;&gt;&lt;span id=&quot;timing-diagram-for-master-and-slaves-latches-in-d-flip-flop&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1604 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/timing_master_slave_latch.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.10: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Timing diagram for master and slaves latches in D flip flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-33003r10  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1609 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, let’s add a cherry on top of the cake by building an &lt;span class=&quot;cmti-12&quot;&gt;asynchronously
resettable D flip flop&lt;/span&gt;. Resettable means we can reset the memory (set the Q value
to 0), and asynchronously resettable means this operation will reset the memory
regardless of the clock – whether it is high or low or transitioning from
low to high (positive edge) or transitioning from high to low (negative
edge).
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1613 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_async_d_flipflop_impl.png&quot; width=&quot;70%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1618 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here’s the truth table for asynchronously resettable D flipflop:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1620 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-asynchronously-resettable-d-flip-flop&quot;&gt;   &lt;a id=&quot;x1-33004r13&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-44&quot;&gt;&lt;colgroup id=&quot;TBL-44-1g&quot;&gt;&lt;col id=&quot;TBL-44-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-44-2g&quot;&gt;&lt;col id=&quot;TBL-44-2&quot; /&gt;&lt;col id=&quot;TBL-44-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-44-4g&quot;&gt;&lt;col id=&quot;TBL-44-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-44-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Reset  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Clk  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; D  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t}\)&lt;/span&gt;  &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-44-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
R=0&lt;/div&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t}\)&lt;/span&gt;  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-44-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-44-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t}\)&lt;/span&gt;  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-44-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;       &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\searrow \)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; d  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t}\)&lt;/span&gt;  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-44-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  R=1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  x   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-44-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                               &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.13: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for asynchronously resettable D flip flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-33004r13  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
   
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;t-flipflop&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3.4   &lt;/span&gt; &lt;a id=&quot;x1-340005.3.4&quot;&gt;&lt;/a&gt;T Flip-Flop&lt;/h4&gt;
&lt;!-- l. 1639 --&gt;&lt;p class=&quot;noindent&quot;&gt;Another simple flip flop that is commonly used in &lt;span class=&quot;cmti-12&quot;&gt;counter &lt;/span&gt;design is &lt;span class=&quot;cmbx-12&quot;&gt;T flip flop&lt;/span&gt;.
We have not seen counters yet, but we will in the section 5.4.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1643 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_t_flipflop_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1650 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_async_t_flipflop_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
   
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;jk-flipflop&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.3.5   &lt;/span&gt; &lt;a id=&quot;x1-350005.3.5&quot;&gt;&lt;/a&gt;JK Flip-Flop&lt;/h4&gt;
&lt;!-- l. 1656 --&gt;&lt;p class=&quot;noindent&quot;&gt;JK flip flop is another memory unit that has the following truth table:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1658 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-jk-flipflop&quot;&gt;   &lt;a id=&quot;x1-35001r14&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-45&quot;&gt;&lt;colgroup id=&quot;TBL-45-1g&quot;&gt;&lt;col id=&quot;TBL-45-1&quot; /&gt;&lt;col id=&quot;TBL-45-2&quot; /&gt;&lt;col id=&quot;TBL-45-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-45-4g&quot;&gt;&lt;col id=&quot;TBL-45-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-45-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; Clk  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; J  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; K  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_{t+1}\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-45-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;div class=&quot;multirow&quot;&gt;&lt;!--  rows=256  --&gt;
&lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-45-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-45-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(1\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-45-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q&apos;_t\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-45-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(1/\searrow /0\)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; x  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-45-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_t\)&lt;/span&gt; &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                 &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.14: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for JK flip-flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-35001r14  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1676 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here is how a JK flip flop can be implemented by using a D flip flop and a 4x1
MUX:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1680 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s2_async_jk_flipflop_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
   
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;counter&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.4   &lt;/span&gt; &lt;a id=&quot;x1-360005.4&quot;&gt;&lt;/a&gt;Counter&lt;/h3&gt;
&lt;!-- l. 1686 --&gt;&lt;p class=&quot;noindent&quot;&gt;0… 1… 2… 3… An n-bit &lt;span class=&quot;cmbx-12&quot;&gt;counter &lt;/span&gt;is a unit that counts up/down after each clock
cycle, outputting an n-bit binary number. For example, here’s a truth table for
3-bit &lt;span class=&quot;cmti-12&quot;&gt;up counter &lt;/span&gt;that counts by incrementing previous output and &lt;span class=&quot;cmti-12&quot;&gt;down counter&lt;/span&gt;
that counts by decrementing it.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1688 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-bit-up-counter-and-down-counter&quot;&gt;   &lt;a id=&quot;x1-36001r15&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-46&quot;&gt;&lt;colgroup id=&quot;TBL-46-1g&quot;&gt;&lt;col id=&quot;TBL-46-1&quot; /&gt;&lt;col id=&quot;TBL-46-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-46-3g&quot;&gt;&lt;col id=&quot;TBL-46-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-46-4g&quot;&gt;&lt;col id=&quot;TBL-46-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-46-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-12&quot;&gt;Clk &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q^\text {up/down}_t\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q^\text {up}_{t+1}\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q^\text {down}_{t+1}\)&lt;/span&gt;  &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-46-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 000 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 001 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 111&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 001  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 010  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 000  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-46-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 010 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 011 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 001&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 011  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 100  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 010  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 100  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 101  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 011  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 101  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 110  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 100  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 110  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 111  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 101  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 111  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 000  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 110  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-46-10-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-10-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(1/\searrow /0\)&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-10-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  q   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-10-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  q   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-46-10-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  q   &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                 &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.15: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 3-bit Up counter and Down counter.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-36001r15  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1709 --&gt;&lt;p class=&quot;indent&quot;&gt;   Notice how the up counter’s output &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q^\text {up}_{t+1}\)&lt;/span&gt; wraps around and becomes 000 when it
reaches the highest 3-bit binary number 111 (7 in decimal) and how the down
counter’s output &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q^\text {down}_{t+1}\)&lt;/span&gt; becomes 111 when the ouptut reaches the smallest 3-bit binary
number 000 (0 in decimal). This is not a bug – it’s actually a feature and we will
see why when we build our computer!
&lt;/p&gt;&lt;!-- l. 1711 --&gt;&lt;p class=&quot;indent&quot;&gt;   There are two types of counters regarding their circuit-level clock connections:
&lt;span class=&quot;cmbx-12&quot;&gt;synchronous &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;asynchronous &lt;/span&gt;counters. Now, you will see how these two
types are different from each other.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;synchronous-up-counter&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.4.1   &lt;/span&gt; &lt;a id=&quot;x1-370005.4.1&quot;&gt;&lt;/a&gt;Synchronous Up Counter&lt;/h4&gt;
&lt;!-- l. 1714 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Synchronous &lt;/span&gt;counter is a counter that uses clock to update all of its internal
registers simulateneously at the same raw clock edges. Calling this type of circuit
synchronous makes sense because a single global clock orchastrates the update
times for all the memory units inside, and therefore, we say that &lt;span class=&quot;cmti-12&quot;&gt;all units are
in sync with the clock&lt;/span&gt;. Here is one a 3-bit up counter could be built in
practice:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1718 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s4_sync_up_counter_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
   
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;asynchronous-ripple-counter&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.4.2   &lt;/span&gt; &lt;a id=&quot;x1-380005.4.2&quot;&gt;&lt;/a&gt;Asynchronous Ripple Counter&lt;/h4&gt;
&lt;!-- l. 1724 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Asynchronous &lt;/span&gt;counter, as opposed to the synchronous one, may use raw clock
signal for updating some of its internal registers and another signal for other
registers. This implies that the updating of the all internal memory units does not
happen at the same time as the &lt;span class=&quot;cmbx-12&quot;&gt;clk &lt;/span&gt;signals to different flip-flops come from
different sources. One such famous counter is called a &lt;span class=&quot;cmbx-12&quot;&gt;ripple counter &lt;/span&gt;and here is
how it can be implemented:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1728 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c5s4_async_up_counter_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1733 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let’s analyze the circuit above with a bit more care and see why it is called an
asynchronous ripple counter. Before starting the analysis, just remember that the &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;
notation is used for the &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; clock transitioning, and these two notations are
exchangeable.
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1735 --&gt;&lt;p class=&quot;indent&quot; id=&quot;analysis-of-a-bit-asyncronous-ripple-counter-that-counts-up-the-bit-output-represents-binary-number-y-y-y-where-y-is-msb-and-y-is-lsb&quot;&gt;   &lt;a id=&quot;x1-38001r16&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-47&quot;&gt;&lt;colgroup id=&quot;TBL-47-1g&quot;&gt;&lt;col id=&quot;TBL-47-1&quot; /&gt;&lt;col id=&quot;TBL-47-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-47-3g&quot;&gt;&lt;col id=&quot;TBL-47-3&quot; /&gt;&lt;col id=&quot;TBL-47-4&quot; /&gt;&lt;col id=&quot;TBL-47-5&quot; /&gt;&lt;col id=&quot;TBL-47-6&quot; /&gt;&lt;col id=&quot;TBL-47-7&quot; /&gt;&lt;col id=&quot;TBL-47-8&quot; /&gt;&lt;col id=&quot;TBL-47-9&quot; /&gt;&lt;col id=&quot;TBL-47-10&quot; /&gt;&lt;col id=&quot;TBL-47-11&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-47-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=2  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=3  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=4  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=5  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=6  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=7  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-1-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; t=8  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-47-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; clk &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-2-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-47-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_0\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;     &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-3-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-47-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_0\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor1&quot;&gt;0&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor2&quot;&gt;1&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor3&quot;&gt;0&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor4&quot;&gt;1&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor5&quot;&gt;0&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor6&quot;&gt;1&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor7&quot;&gt;0&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor8&quot;&gt;1&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-4-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span id=&quot;textcolor9&quot;&gt;0&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-47-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_1\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-5-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-47-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor10&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor11&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor12&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor13&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor14&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor15&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor16&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor17&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-6-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor18&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-47-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_2\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-7-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\nearrow \)&lt;/span&gt;1   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-47-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt;  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor19&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor20&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor21&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor22&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor23&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-7&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor24&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-8&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor25&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-9&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor26&quot;&gt;1&lt;/span&gt;   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-47-8-10&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span id=&quot;textcolor27&quot;&gt;0&lt;/span&gt;   &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                           &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 5.16: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Analysis of a 3-bit asyncronous ripple counter that counts up.
(the 3-bit output represents binary number &lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {y_2 y_1 y_0}\)&lt;/span&gt; where &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt; is MSB and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_0\)&lt;/span&gt; is LSB)&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-38001r16  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1754 --&gt;&lt;p class=&quot;indent&quot;&gt;   &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_0\)&lt;/span&gt; is directly connected to the global clock &lt;span class=&quot;cmti-12&quot;&gt;clk&lt;/span&gt;, so it is effectively updated with
the global clock edges. &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_1\)&lt;/span&gt; is connected to &lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {y_0}\)&lt;/span&gt;, so it takes 2 global clock cycles to flip &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt;.
This is because &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_0\)&lt;/span&gt; oscillates between &lt;span class=&quot;mathjax-inline&quot;&gt;\(0 \rightarrow 1 \rightarrow 0\)&lt;/span&gt;, making &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_1 = \overline {y_0} = 1 \rightarrow 0 \rightarrow 1\)&lt;/span&gt;. Therefore, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_1\)&lt;/span&gt; goes from low to high
after the second global clock cycle (that is, from t=1 to t=2 in the timing
table above) and that is exactly when &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt; becomes 1 initially. Similarly, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_2 = \overline {y_1}\)&lt;/span&gt; and
since &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_1\)&lt;/span&gt; is flipped once in every 2 clock cycles, it will will be 0 for t=0,1;
then flip to 1 for t=2,3; then again to 0 for t=4,5. In the meantime, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_2=\overline {y_1}\)&lt;/span&gt; will
be 1 for t=0,1; then 0 for t=2,3; then 1 again for t=4,5. It will be from
t=3 to t=4 when &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {clk}_2\)&lt;/span&gt; will rise from low to high for the first time, causing &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt;
to flip from 0 to 1 for the first time as well. Therefore, &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_2\)&lt;/span&gt; will be flipped
once in every 4 clock cycles. This is exactly why it is called asynchronous
because every T flip-flop gets updated at different times. Moreover, it is as
if the raw clock signal &lt;span class=&quot;cmbx-12&quot;&gt;ripples &lt;/span&gt;through the counters with the 2 cycles
difference in between them, hence making the wording “ripple counter”
meaningful.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;timing1&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.5   &lt;/span&gt; &lt;a id=&quot;x1-390005.5&quot;&gt;&lt;/a&gt;Timing&lt;/h3&gt;
&lt;!-- l. 1757 --&gt;&lt;p class=&quot;noindent&quot;&gt;So far you have hopefully learned a great deal of things in computer architecture.
New readers might find this crowded with a lot of new information and this is
fine. The organization that I have followed while writing this book in “one sitting”
is not flawless because of the fact that the book’s been written in “one sitting”…
This being said, my goal throughout this book is not to make you a professional
computer architect; the goal is to help newcomers intuitively understand the
essentials of the computer architecture and realize how the subject can be learned
by trying to build a computer by themselves (from “scratch”) and deepen their
knowledge upon further self-study by themselves. Wihout further ado, let me
introduce the timing framework used in circuit design. Before that let me
actually motivate the reason that such a framework is used in the first
place.
&lt;/p&gt;&lt;!-- l. 1759 --&gt;&lt;p class=&quot;indent&quot;&gt;   You have seen how edge-triggered D flip-flop is implemented by using two D
latches. You have also seen the timing diagrams capturing its operational span.
But have you ever scrutinized it really? If you have, then have you thought about
                                                                          

                                                                          
the following question: what happens right when the clock is about to transition
from 0 to 1 in both master and slave latches? Let me visualize this question for
you.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-39001r11&quot;&gt;&lt;span id=&quot;which-latch-becomes-transparent-and-which-one-becomes-opaque-spoiler-both-latches-become-transparent-for-a-moment-necessity-of-hold-time-for-d-flipflop&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1763 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/hold_d_flipflop.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.11:  &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Which  latch  becomes  transparent  and  which  one  becomes
opaque? Spoiler: both latches become transparent for a moment &lt;span class=&quot;mathjax-inline&quot;&gt;\(\implies \)&lt;/span&gt; necessity
of &lt;span class=&quot;cmbx-12&quot;&gt;hold time &lt;/span&gt;for D flip-flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-39001r11  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1768 --&gt;&lt;p class=&quot;indent&quot;&gt;   When clock transitions from low to high and data bit transitions from low to
high at the same moment, it takes new D=1 to reach to the top NAND gate faster
than the negated clock signal, leading the master latch to stay transparent and
update &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_m\)&lt;/span&gt; with value 1. Then the high clock signal is propagated through the slave
latch, updating its value with the master latch’s output, i.e., &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q = Q_m = 1\)&lt;/span&gt; as opposed to &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q = 0\)&lt;/span&gt;. So,
what we have observed here is the following: unless we make the data bit stable a
little after the rising clock edge, the slave latch will be updated with
the wrong value. This is known as the &lt;span class=&quot;cmbx-12&quot;&gt;hold time &lt;/span&gt;constraint: how much
time we should hold the D input stable for the flip-flop to function as
intended.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-39002r12&quot;&gt;&lt;span id=&quot;necessity-of-setup-time-for-d-flipflop&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1772 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/setup_d_flipflop.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.12: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Necessity of &lt;span class=&quot;cmbx-12&quot;&gt;setup time &lt;/span&gt;for D flip-flop.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-39002r12  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1777 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here is another case: when (1) the clock transitions from low to high and (2)
the data bit D transitions from high to low and (3) &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_m\)&lt;/span&gt; is previously high, even
though the intended behavior is to store D=0 in &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q\)&lt;/span&gt;, the negated clock signal and the
negated D may or may not reach the bottom NAND gate in the master latch at
the same time causing that NAND to output 0 or 1 “randomly”. This will cause &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q_m\)&lt;/span&gt;
to fluctuate between 0 and 1, and this is known as &lt;span class=&quot;cmbx-12&quot;&gt;metastable &lt;/span&gt;state
for the memory unit. Metastability of master latch will also lead to the
metastability of the slave latch, and therefore, the whole D flip-flop will
become metastable as the result. This is illustrated on the timing diagram
above.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-39003r13&quot;&gt;&lt;span id=&quot;proper-setup-and-hold-durations&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1781 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/proper_timing_d_flipflop.png&quot; width=&quot;85%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.13: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Proper &lt;span class=&quot;cmbx-12&quot;&gt;setup &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;hold &lt;/span&gt;durations.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-39003r13  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1786 --&gt;&lt;p class=&quot;indent&quot;&gt;   The timing diagram above depicts the behavior of a D flip flop when the setup
and hold times are well respected. Having this intuition about these two timing
constraints, let’s formalize this framework.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;setup-time-constraint&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.5.1   &lt;/span&gt; &lt;a id=&quot;x1-400005.5.1&quot;&gt;&lt;/a&gt;Setup Time Constraint&lt;/h4&gt;
&lt;!-- l. 1789 --&gt;&lt;p class=&quot;noindent&quot;&gt;Imagine the basic but very essential flip-flop setup as shown below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-40001r14&quot;&gt;&lt;span id=&quot;setup-timing-for-flipflops-in-series&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1793 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/setup_timing_2flipflops.png&quot; width=&quot;85%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.14: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Setup timing for 2 flip-flops in series.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-40001r14  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1798 --&gt;&lt;p class=&quot;indent&quot;&gt;   Note that &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {clk}\)&lt;/span&gt; is the clock period, &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {clk2q}\)&lt;/span&gt; is the time it takes for the &lt;span class=&quot;cmbx-12&quot;&gt;clock &lt;/span&gt;signal to
reach the output of the flip-flop, &lt;span class=&quot;cmbx-12&quot;&gt;Q&lt;/span&gt;. &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {pd}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {cd}\)&lt;/span&gt; are the respective &lt;span class=&quot;cmbx-12&quot;&gt;propagation &lt;/span&gt;and
&lt;span class=&quot;cmbx-12&quot;&gt;contamination &lt;/span&gt;delays of the combinational circuit in between the flip-flops. This
being clarified, suppose that the clock signal reaches the left flip-flop at time &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {launch}\)&lt;/span&gt; and
the right flip-flop at time &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {capture}\)&lt;/span&gt;. Then we say that the following inequality must
hold:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} T_\text {capture} + t_\text {clk} \geq T_\text {launch} + t_\text {clk2q} + t_\text {pd} + t_\text {setup} \end{align*}&lt;/div&gt;
&lt;!-- l. 1804 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let me try to explain the inequality above. As the clock signal reaches the left
(source) flip-flop at &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {launch}\)&lt;/span&gt;, it takes &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {clk2q}\)&lt;/span&gt; amount of time for it to affect source &lt;span class=&quot;mathjax-inline&quot;&gt;\(Q\)&lt;/span&gt; output and
another &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {pd}\)&lt;/span&gt; amount of time to pass through the combinational circuit (in the worst
case scenario). We know that the next clock edge will reach the right (target)
flip-flop at time &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {capture} + t_\text {clk}\)&lt;/span&gt;, and therefore, the output of the combinational circuit
(this value is propagated only after &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {launch} + t_\text {clk2q} + t_\text {pd}\)&lt;/span&gt;) must be stable at least &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {setup}\)&lt;/span&gt; amount
of time before the next clock edge reaching the target flip-flop. Since
the output of the combinational circuit must be ready before &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {capture} + t_\text {clk} - t_\text {setup}\)&lt;/span&gt;, we say
&lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {launch} + t_\text {clk2q} + t_\text {pd} \leq T_\text {capture} + t_\text {clk} - t_\text {setup}\)&lt;/span&gt;.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;hold-time-constraint&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;5.5.2   &lt;/span&gt; &lt;a id=&quot;x1-410005.5.2&quot;&gt;&lt;/a&gt;Hold Time Constraint&lt;/h4&gt;
&lt;!-- l. 1807 --&gt;&lt;p class=&quot;noindent&quot;&gt;Here is the same picture for the hold time constraint, except that here we only
care about the shortest path that the signal takes to propagate through the
combinational circuit in between the two flip-flops:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-41001r15&quot;&gt;&lt;span id=&quot;hold-timing-for-flipflops-in-series&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1811 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/hold_timing_2flipflops.png&quot; width=&quot;85%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 5.15: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Hold timing for 2 flip-flops in series.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-41001r15  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1816 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here is the inequality for the hold time constraint:
&lt;/p&gt;
   &lt;div class=&quot;mathjax-env mathjax-align*&quot;&gt;\begin{align*} T_\text {launch} + t_\text {clk2q} + t_\text {cd} \geq T_\text {capture} + t_\text {hold} \end{align*}&lt;/div&gt;
&lt;!-- l. 1822 --&gt;&lt;p class=&quot;indent&quot;&gt;   Let me now try to explain this inequality. After making sure that the setup
time is constraint is not violated, we then also have to check if the output of the
combinational logic will stay the same for enough time period (a.k.a. &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {hold}\)&lt;/span&gt;) after the
clock edge. As the clock edge reaches the source flip-flop at &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {launch}\)&lt;/span&gt;, then takes &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {clk2q}\)&lt;/span&gt; time to
affect the its output, and &lt;span class=&quot;mathjax-inline&quot;&gt;\(t_\text {cd}\)&lt;/span&gt; minimum amount of time to pass through the
combinational circuit, we say that the new value at the output of this
combinational circuit must be ready not before than &lt;span class=&quot;mathjax-inline&quot;&gt;\(T_\text {capture} + t_\text {hold}\)&lt;/span&gt; (when the clock edge
reaches the target flip-flop + a little bit of time so that hold time is not
violated).
                                                                          

                                                                          
&lt;/p&gt;&lt;!-- l. 1824 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;lets-build-a-computer&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 6&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-420006&quot;&gt;&lt;/a&gt;Let’s Build a Computer!&lt;/h2&gt;
&lt;!-- l. 1826 --&gt;&lt;p class=&quot;noindent&quot;&gt;Congratulations! You have made this far, and now you get to understand and
even build a custom 8-bit computer on your own through some guidance provided
in this chapter. However, it is important to talk about the &lt;span class=&quot;cmbx-12&quot;&gt;instruction set
architecture &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;ISA &lt;/span&gt;before building anything. ISA is essentially a sheet
of paper that lists all of the basic operations that can be carried in our
hypothetical computing machine by providing the instructions in binary
directly to the machine. Basically, it is the design process of a computer
in a higher level abstraction, which then leads to relatively lower level
&lt;span class=&quot;cmbx-12&quot;&gt;microarchitecture &lt;/span&gt;(how the operations listed on the ISA specification
are executed step-by-step) design, and then to gate-level construction of
the real physical computer. Here’s the first step of this high-level design
process – I would like to represent each instruction in 16 bits or 2 bytes as
follows:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1828 --&gt;&lt;p class=&quot;indent&quot; id=&quot;bit-instruction-representation&quot;&gt;   &lt;a id=&quot;x1-42001r1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-48&quot;&gt;&lt;colgroup id=&quot;TBL-48-1g&quot;&gt;&lt;col id=&quot;TBL-48-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-48-2g&quot;&gt;&lt;col id=&quot;TBL-48-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-48-3g&quot;&gt;&lt;col id=&quot;TBL-48-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-48-4g&quot;&gt;&lt;col id=&quot;TBL-48-4&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-48-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-48-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{15}\)&lt;/span&gt;                                &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-48-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;        &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{14} b_{13} b_{12} b_{11}\)&lt;/span&gt;        &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-48-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                 &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{10} b_9 b_8\)&lt;/span&gt;                                 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-48-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                 &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_7 b_6 b_5 b_4 b_3 b_2 b_1 b_0\)&lt;/span&gt;                                 &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-48-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-48-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-49&quot;&gt;&lt;colgroup id=&quot;TBL-49-1g&quot;&gt;&lt;col id=&quot;TBL-49-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-49-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-49-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;span class=&quot;cmr-10&quot;&gt;ALU/Memory&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr id=&quot;TBL-49-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-49-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    &lt;span class=&quot;cmr-10&quot;&gt;1/0        &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                               &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-48-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmr-10&quot;&gt;instruction opcode  &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-48-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-50&quot;&gt;&lt;colgroup id=&quot;TBL-50-1g&quot;&gt;&lt;col id=&quot;TBL-50-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-50-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-50-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmbx-10&quot;&gt;first argument  &lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr id=&quot;TBL-50-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-50-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;span class=&quot;cmti-10&quot;&gt;Register File &lt;/span&gt;&lt;span class=&quot;cmr-10&quot;&gt;address&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                        &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-48-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-51&quot;&gt;&lt;colgroup id=&quot;TBL-51-1g&quot;&gt;&lt;col id=&quot;TBL-51-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-51-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-51-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;&lt;span class=&quot;cmbx-10&quot;&gt;second argument&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr id=&quot;TBL-51-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-51-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmr-10&quot;&gt;immediate value or &lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr id=&quot;TBL-51-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-51-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmr-10&quot;&gt;memory address   &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                        &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                                                                                                                                  &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 6.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;16-bit instruction representation.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-42001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1841 --&gt;&lt;p class=&quot;indent&quot;&gt;   The representation above explains the semantic division of the 2-byte
instruction. The MSB (most significant bit) &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{15}\)&lt;/span&gt; indicates whether instruction is an
ALU instruction (such as adding two numbers, logical AND, logical OR, and so
on) or memory instruction (such as storing a number in memory, loading values
from memory to registers, and so on). The next 4 bits &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{14:11}\)&lt;/span&gt; is the operation code or
opcode that specifies which instruction we want our CPU to execute. Then comes
the next 3 bits &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{10:8}\)&lt;/span&gt; as the first argument of our instruction (&lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{15:11}\)&lt;/span&gt;), which is always
going to be a register address in the &lt;span class=&quot;cmbx-12&quot;&gt;register file &lt;/span&gt;consisting 8 registers.
The second byte &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{7:0}\)&lt;/span&gt; is the second argument, which can be an immediate
value or an 8-bit memory address depending on the context/instruction.
Since we allow only the second byte of the instruction to work with the
memory addresses, fixing 8 bits for this purpose also limits how big of a
memory we can possibly work with in this kind of architecture. Since we also
want &lt;span class=&quot;cmbx-12&quot;&gt;byte-addressable &lt;/span&gt;memory system in which one can access the
individual bytes by providing an 8-bit address, of course, the answer is we
are going to work with &lt;span class=&quot;mathjax-inline&quot;&gt;\(2^8 = 256\)&lt;/span&gt; byte memory. Each of 256 locations is going to
represent one byte or 8 bits instead of a single bit. If we wanted to access the
individual bits, then the memory would be called &lt;span class=&quot;cmbx-12&quot;&gt;bit-addressable &lt;/span&gt;and not
byte-addressable.
&lt;/p&gt;&lt;!-- l. 1843 --&gt;&lt;p class=&quot;indent&quot;&gt;   Lastly, since this is going to be an 8-bit computer (byte-addressable memory,
support for operations on byte-long numbers, byte-long bus width; in other words,
only 8 bits can be travelling accross wires at a given moment), I will call this
computer &lt;span class=&quot;cmbx-12&quot;&gt;D&lt;/span&gt;ummy &lt;span class=&quot;cmbx-12&quot;&gt;x8 &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;Dx8&lt;/span&gt;!
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;instruction-set-architecture&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.1   &lt;/span&gt; &lt;a id=&quot;x1-430006.1&quot;&gt;&lt;/a&gt;Instruction Set Architecture&lt;/h3&gt;
&lt;!-- l. 1846 --&gt;&lt;p class=&quot;noindent&quot;&gt;One popular architecture for modern computing devices has been &lt;span class=&quot;cmbx-12&quot;&gt;Von Neumann
architecture&lt;/span&gt;. This architecture is essentially the one that mentions a &lt;span class=&quot;cmbx-12&quot;&gt;central
processing unit &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;CPU &lt;/span&gt;which works with a &lt;span class=&quot;cmbx-12&quot;&gt;memory unit &lt;/span&gt;where the data and
the program is mixed. The CPU consists of a &lt;span class=&quot;cmbx-12&quot;&gt;control unit &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;arithmetic and
logic unit &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;ALU&lt;/span&gt;. Control unit is used to orchestrate different components
within the CPU and even memory units to some extent. ALU is the part where
numbers get crunched and calculations happen. Besides, there is external input
                                                                          

                                                                          
and output devices that can be connected to this core computing device (CPU +
Memory).
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-43001r1&quot;&gt;&lt;span id=&quot;von-neumann-architecture&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1850 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/von_neumann_arch.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.1: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Von Neumann architecture.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-43001r1  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1855 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, let’s start designing our own ISA from scratch. Just keep in mind that,
we will build computer around the architectural principles of Von Neumann’s,
however, our instruction set and the microarchitecture (technical gate-level
details) will be built and customized for our personal liking. Von Neumann
architecture, as illustrated in the figure above, tells us which high-level
components there are and how they are frankly connected; it does not dictate how
these components ought to be built or which instructions should they be able to
carry out. So, we are free to do what the hell we want with this. Nice, let’s get to
it!
&lt;/p&gt;&lt;!-- l. 1857 --&gt;&lt;p class=&quot;indent&quot;&gt;   I visualize the general organization of the DX8 computer as follows:
&lt;/p&gt;
      &lt;ul class=&quot;itemize1&quot;&gt;
      &lt;li class=&quot;itemize&quot;&gt;
      &lt;!-- l. 1860 --&gt;&lt;p class=&quot;noindent&quot;&gt;There is a CPU, which has a &lt;span class=&quot;cmbx-12&quot;&gt;Control unit &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;Arithmetic unit &lt;/span&gt;(to
      perform &lt;span class=&quot;mathjax-inline&quot;&gt;\(a + b\)&lt;/span&gt;, comparison &lt;span class=&quot;mathjax-inline&quot;&gt;\(a &amp;lt; b ?\)&lt;/span&gt;, etc.) + &lt;span class=&quot;cmbx-12&quot;&gt;Logic unit &lt;/span&gt;(to perform &lt;span class=&quot;mathjax-inline&quot;&gt;\(a \operatorname {AND} b\)&lt;/span&gt;, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {NOT} a\)&lt;/span&gt;, etc.)
      and a bunch of registers (R0, …, R7 – also known as Register file);
      &lt;/p&gt;
           &lt;ul class=&quot;itemize2&quot;&gt;
           &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Controller&lt;/span&gt;;
           &lt;/li&gt;
           &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;ALU&lt;/span&gt;;
           &lt;/li&gt;
           &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Register File&lt;/span&gt;;&lt;/li&gt;&lt;/ul&gt;
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;There is more general non-volatile memory unit – also known as &lt;span class=&quot;cmbx-12&quot;&gt;Random
      Access Memory &lt;/span&gt;or &lt;span class=&quot;cmbx-12&quot;&gt;RAM&lt;/span&gt;, whose bytes can be accessed(read or written)
      by providing arbitrary 8-bit address;
                                                                          

                                                                          
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;
      &lt;!-- l. 1867 --&gt;&lt;p class=&quot;noindent&quot;&gt;External input unit: &lt;/p&gt;
           &lt;ul class=&quot;itemize2&quot;&gt;
           &lt;li class=&quot;itemize&quot;&gt;8 ON/OFF switches (acting as a “keyboard”) to set the &lt;span class=&quot;cmti-12&quot;&gt;data &lt;/span&gt;to
           be written to the RAM;
           &lt;/li&gt;
           &lt;li class=&quot;itemize&quot;&gt;8 ON/OFF switches to set the memory &lt;span class=&quot;cmti-12&quot;&gt;address&lt;/span&gt;;
           &lt;/li&gt;
           &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmti-12&quot;&gt;Write &lt;/span&gt;button to make the computer write the given &lt;span class=&quot;cmti-12&quot;&gt;data &lt;/span&gt;into the
           indicated memory &lt;span class=&quot;cmti-12&quot;&gt;address&lt;/span&gt;;
           &lt;/li&gt;
           &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmti-12&quot;&gt;Reset &lt;/span&gt;switch to restart the computer.&lt;/li&gt;&lt;/ul&gt;
      &lt;/li&gt;&lt;/ul&gt;
&lt;!-- l. 1876 --&gt;&lt;p class=&quot;indent&quot;&gt;   Here’s how I visualize this in my mind:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-43002r2&quot;&gt;&lt;span id=&quot;dx-computer-organization&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 1880 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/dx8-organization.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;DX8 computer organization.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-43002r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 1885 --&gt;&lt;p class=&quot;indent&quot;&gt;   With this high-level visualization of the DX8 computer in mind, let’s see my
“beautiful” ISA:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1887 --&gt;&lt;p class=&quot;indent&quot; id=&quot;dx-isa&quot;&gt;   &lt;a id=&quot;x1-43003r2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-52&quot;&gt;&lt;colgroup id=&quot;TBL-52-1g&quot;&gt;&lt;col id=&quot;TBL-52-1&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-52-2g&quot;&gt;&lt;col id=&quot;TBL-52-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-52-3g&quot;&gt;&lt;col id=&quot;TBL-52-3&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-52-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-1-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1891 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Mnemonic&lt;/span&gt;                  &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-1-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1891 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Opcode&lt;/span&gt;  &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-1-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1891 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Semantics&lt;/span&gt;                              &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-52-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-2-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1893 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;load &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$regX $memAddr&lt;/span&gt;&lt;/code&gt;      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-2-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1893 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0000     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-2-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1893 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regX} \leftarrow \texttt {memAddr}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-3-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1894 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;store &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$regX $memAddr&lt;/span&gt;&lt;/code&gt;     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-3-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1894 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0001     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-3-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1894 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {memAddr} \leftarrow \texttt {regX} \)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-4-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1895 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;move &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$regX $val&lt;/span&gt;&lt;/code&gt;          &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-4-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1895 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0010     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-4-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1895 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regX} \leftarrow \texttt {val}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-5-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1896 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;arg1 &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$regX&lt;/span&gt;&lt;/code&gt;              &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-5-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1896 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0011     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-5-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1896 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regA} \leftarrow \texttt {regX}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-6-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1897 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;arg2 &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$regX&lt;/span&gt;&lt;/code&gt;              &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-6-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1897 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0100     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-6-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1897 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regB} \leftarrow \texttt {regX}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-7-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1898 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;cmp&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-7-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1898 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0000     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-7-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1898 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {CMP regA regB}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-8-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1899 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;add&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-8-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1899 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0001     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-8-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1899 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA} + \texttt {regB}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-9-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1900 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;neg&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-9-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1900 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0010     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-9-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1900 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \text {NOT regA} + 1\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-10-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-10-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1901 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;and&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-10-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1901 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0011     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-10-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1901 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA AND regB}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-11-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-11-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1902 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;or&lt;/span&gt;                      &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-11-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1902 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0100     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-11-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1902 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA OR regB}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-12-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-12-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1903 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;xor&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-12-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1903 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0101     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-12-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1903 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA XOR regB}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-13-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-13-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1904 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;not&lt;/span&gt;                     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-13-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1904 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0110     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-13-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1904 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {NOT regA}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-14-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-14-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1905 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;rotl&lt;/span&gt;                    &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-14-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1905 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,0111     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-14-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1905 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA[6:0]\_regA[7]}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-15-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-15-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1906 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;rotr&lt;/span&gt;                    &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-15-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1906 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,1000     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-15-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1906 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA[0]\_regA[7:1]}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-16-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-16-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1907 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;shiftl&lt;/span&gt;                  &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-16-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1907 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,1001     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-16-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1907 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA[6:0]\_0}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-17-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-17-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1908 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;shiftr&lt;/span&gt;                  &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-17-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1908 --&gt;&lt;p class=&quot;noindent&quot;&gt;1,1010     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-17-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1908 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {0\_regA[7:1]}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-18-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-18-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1909 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;jmp &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$val&lt;/span&gt;&lt;/code&gt;                &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-18-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1909 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0101     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-18-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1909 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regIP} \leftarrow \texttt {val}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-19-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-19-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1910 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;jmpgt &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$val&lt;/span&gt;&lt;/code&gt;              &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-19-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1910 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0110     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-19-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1910 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regIP} \leftarrow \begin {cases} \texttt {val}, \text {if gt flag is set} \\ \texttt {regIP} + 1, \text {otherwise} \end {cases}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-20-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-20-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1915 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;jmplt &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$val&lt;/span&gt;&lt;/code&gt;              &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-20-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1915 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,0111     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-20-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1915 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regIP} \leftarrow \begin {cases} \texttt {val}, \text {if lt flag is set} \\ \texttt {regIP} + 1, \text {otherwise} \end {cases}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-52-21-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-21-1&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1920 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;cmtt-12&quot;&gt;jmpeq &lt;/span&gt;&lt;code class=&quot;lstinline&quot;&gt;&lt;span style=&quot;color:#000000&quot;&gt;$val&lt;/span&gt;&lt;/code&gt;              &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-21-2&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1920 --&gt;&lt;p class=&quot;noindent&quot;&gt;0,1000     &lt;/p&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-52-21-3&quot; style=&quot;white-space:normal; text-align:left;&quot;&gt; &lt;!-- l. 1920 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regIP} \leftarrow \begin {cases} \texttt {val}, \text {if eq flag is set} \\ \texttt {regIP} + 1, \text {otherwise} \end {cases}\)&lt;/span&gt;                               &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                      &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 6.2: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;DX8 ISA&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-43003r2  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1931 --&gt;&lt;p class=&quot;indent&quot;&gt;   Table &lt;a href=&quot;#dx-isa&quot;&gt;6.2&lt;!-- tex4ht:ref: tab:dx8-isa  --&gt;&lt;/a&gt; is a very basic and naive instruction set that I have designed for the
DX8 computer. Let’s now try to build some of the components that are needed for
our CPU. For example, ISA mentions that one should be able to execute &lt;span class=&quot;cmbx-12&quot;&gt;add&lt;/span&gt;
instruction, which performs &lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {regOUT} \leftarrow \texttt {regA} + \texttt {regB}\)&lt;/span&gt;. So, the plan is to build a subunit called Arithmetic
(sub)Unit, and Logic (sub)Unit, then combine them in a single unit called ALU.
Let’s see how we can do this.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;arithmetic&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.2   &lt;/span&gt; &lt;a id=&quot;x1-440006.2&quot;&gt;&lt;/a&gt;Arithmetic&lt;/h3&gt;
&lt;!-- l. 1934 --&gt;&lt;p class=&quot;noindent&quot;&gt;Suppose I wanted to add two 1-bit inputs &lt;span class=&quot;cmtt-12&quot;&gt;in1 &lt;/span&gt;and &lt;span class=&quot;cmtt-12&quot;&gt;in2&lt;/span&gt;. What I would like is to
build a circuit that gives me their sum in a single bit, as well as their carry (in
case the sum does not fit in a single bit). Such as circuit is called &lt;span class=&quot;cmbx-12&quot;&gt;half adder &lt;/span&gt;and
its truth table can be given as follows:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1936 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-half-adder&quot;&gt;   &lt;a id=&quot;x1-44001r3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-53&quot;&gt;&lt;colgroup id=&quot;TBL-53-1g&quot;&gt;&lt;col id=&quot;TBL-53-1&quot; /&gt;&lt;col id=&quot;TBL-53-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-53-3g&quot;&gt;&lt;col id=&quot;TBL-53-3&quot; /&gt;&lt;col id=&quot;TBL-53-4&quot; /&gt;&lt;col id=&quot;TBL-53-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-53-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmtt-12&quot;&gt;in1 &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmtt-12&quot;&gt;in2 &lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; sum  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; carry  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;cmtt-12&quot;&gt;in1 &lt;/span&gt;+ &lt;span class=&quot;cmtt-12&quot;&gt;in2 &lt;/span&gt;= [carry][sum]  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-53-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           00                 &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-53-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 01&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-53-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   0    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           01                 &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-53-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   1    &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-53-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;           10                 &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                 &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 6.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for half adder.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-44001r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1952 --&gt;&lt;p class=&quot;indent&quot;&gt;   This is obviously very simple truth table, and therefore, the circuit for the half
adder can be built as given below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1956 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s2_half_adder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1961 --&gt;&lt;p class=&quot;indent&quot;&gt;   The unfortunate thing about the half adder is that we cannot stack a bunch of
these half adders to add two multiple-bit numbers, say &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_{7:0}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_{7:0}\)&lt;/span&gt;. The reason is
obvious if you think about it for a second: because we have to use the carry
output of the rightmost bits &lt;span class=&quot;mathjax-inline&quot;&gt;\(a_i + b_i\)&lt;/span&gt; while adding the bits on the left &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_{i+1} + y_{i+1}\)&lt;/span&gt;. To do this, we
should build a &lt;span class=&quot;cmbx-12&quot;&gt;full adder &lt;/span&gt;that is capable of adding two 1-bit numbers while also
adding another &lt;span class=&quot;cmti-12&quot;&gt;carry input&lt;/span&gt;. Therefore, a full adder is essentially a 3-bit adder
that outputs 1-bit sum and 1-bit carry-out. Here’s the truth table for
it:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 1963 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-full-adder&quot;&gt;   &lt;a id=&quot;x1-44002r4&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-54&quot;&gt;&lt;colgroup id=&quot;TBL-54-1g&quot;&gt;&lt;col id=&quot;TBL-54-1&quot; /&gt;&lt;col id=&quot;TBL-54-2&quot; /&gt;&lt;col id=&quot;TBL-54-3&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-54-4g&quot;&gt;&lt;col id=&quot;TBL-54-4&quot; /&gt;&lt;col id=&quot;TBL-54-5&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-54-6g&quot;&gt;&lt;col id=&quot;TBL-54-6&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-54-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {carry}_{i}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_{i+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_{i+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {sum}_{i+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {carry}_{i+1}\)&lt;/span&gt; &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-1-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;span class=&quot;mathjax-inline&quot;&gt;\(\text {carry}_i + x_{i+1} + y_{i+1} = [\text {carry}_{i+1}][\text {sum}_{i+1}]\)&lt;/span&gt;  &lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-54-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-2-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 00&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-3-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 01  &lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-54-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0 &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-4-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 01&lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-5-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 10  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-6-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-6-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 01  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-7-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-7-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 10  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-8-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 0  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-8-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 10  &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-54-9-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-54-9-6&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; 11  &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                     &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 6.4: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for full adder.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-44002r4  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 1983 --&gt;&lt;p class=&quot;indent&quot;&gt;   With a little bit of SoP/PoS magic, it is easy to realize the following
implementation for the full adder:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1987 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s2_full_adder_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 1992 --&gt;&lt;p class=&quot;indent&quot;&gt;   In order to add two 4-bit numbers &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_{3:0}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_{3:0}\)&lt;/span&gt;, we can stack up 4 full adders as
follows:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 1996 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s2_full_adder_4b_impl.png&quot; width=&quot;80%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2001 --&gt;&lt;p class=&quot;indent&quot;&gt;   I think it is hopefully pretty obvious how we could scale this up to 8 bits or
even further. For our computer, we only need 8-bit adder, so we will stack 4
more full adders on top of the ones shown above and we will call it a
day!
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;logic&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.3   &lt;/span&gt; &lt;a id=&quot;x1-450006.3&quot;&gt;&lt;/a&gt;Logic&lt;/h3&gt;
&lt;!-- l. 2004 --&gt;&lt;p class=&quot;noindent&quot;&gt;Performing basic logic on input(s) is much more easier because this is what the
logic gates, such as AND, NOT, OR, do by default. All we need to do to scale
these logical operations from 1-bit inputs to 8-bit inputs. Doing this is very easy
and trivial: given two 8-bit inputs &lt;span class=&quot;mathjax-inline&quot;&gt;\(x_{7:0}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(y_{7:0}\)&lt;/span&gt;, connect each bit &lt;span class=&quot;mathjax-inline&quot;&gt;\(a_i\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(b_i\)&lt;/span&gt; to a different
AND/OR/XOR gate &lt;span class=&quot;mathjax-inline&quot;&gt;\(G_i\)&lt;/span&gt;, then the final 8-bit output is the concationation of the
outputs of these gates, &lt;span class=&quot;mathjax-inline&quot;&gt;\(\overline {G_7 \dots G_0}\)&lt;/span&gt;.
&lt;/p&gt;&lt;!-- l. 2006 --&gt;&lt;p class=&quot;indent&quot;&gt;   What about comparing two 1-bit numbers? Well here is a pretty intuitive
implementation of 1-bit comparator:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2010 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s3_comparator_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2015 --&gt;&lt;p class=&quot;indent&quot;&gt;   If you wonder how you can build it, just remember that the first step is to
write down the truth table for the comparator. My stupid truth table for the
circuit above looked like this:
&lt;/p&gt;
   &lt;div class=&quot;table&quot;&gt;
                                                                          

                                                                          
&lt;!-- l. 2017 --&gt;&lt;p class=&quot;indent&quot; id=&quot;truth-table-for-bit-comparator&quot;&gt;   &lt;a id=&quot;x1-45001r5&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;figure class=&quot;float&quot;&gt;
                                                                          

                                                                          
&lt;div class=&quot;tabular&quot;&gt; &lt;table class=&quot;tabular&quot; id=&quot;TBL-55&quot;&gt;&lt;colgroup id=&quot;TBL-55-1g&quot;&gt;&lt;col id=&quot;TBL-55-1&quot; /&gt;&lt;col id=&quot;TBL-55-2&quot; /&gt;&lt;/colgroup&gt;&lt;colgroup id=&quot;TBL-55-3g&quot;&gt;&lt;col id=&quot;TBL-55-3&quot; /&gt;&lt;col id=&quot;TBL-55-4&quot; /&gt;&lt;col id=&quot;TBL-55-5&quot; /&gt;&lt;/colgroup&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-55-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-55-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; in1  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-55-1-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; in2  &lt;/td&gt;&lt;td class=&quot;td11&quot; id=&quot;TBL-55-1-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-56&quot;&gt;&lt;colgroup id=&quot;TBL-56-1g&quot;&gt;&lt;col id=&quot;TBL-56-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-56-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-56-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;    gt      &lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-56-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-56-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;greater than&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                  &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-1-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-57&quot;&gt;&lt;colgroup id=&quot;TBL-57-1g&quot;&gt;&lt;col id=&quot;TBL-57-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-57-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-57-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;   lt    &lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-57-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-57-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;less than&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                      &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-1-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  &lt;table class=&quot;tabular&quot; id=&quot;TBL-58&quot;&gt;&lt;colgroup id=&quot;TBL-58-1g&quot;&gt;&lt;col id=&quot;TBL-58-1&quot; /&gt;&lt;/colgroup&gt;&lt;tr id=&quot;TBL-58-1-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-58-1-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt; eq  &lt;/td&gt; &lt;/tr&gt;&lt;tr id=&quot;TBL-58-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-58-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;equal&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;                                                                                           &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr id=&quot;TBL-55-2-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-2-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-2-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-2-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-2-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-2-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-55-3-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-3-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-3-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-3-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-3-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-3-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-55-4-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-4-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-4-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  0   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-4-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-4-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-4-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;
&lt;/tr&gt;&lt;tr id=&quot;TBL-55-5-&quot; style=&quot;vertical-align:baseline;&quot;&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-5-1&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-5-2&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;  1   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-5-3&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-5-4&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                0                                                   &lt;/td&gt;&lt;td class=&quot;td00&quot; id=&quot;TBL-55-5-5&quot; style=&quot;white-space:nowrap; text-align:center;&quot;&gt;                                1                                                   &lt;/td&gt;
&lt;/tr&gt;&lt;tr class=&quot;hline&quot; style=&quot;border-top:1px solid #000&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;                                                                                                                                                                                                                                                    &lt;/div&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Table 6.5: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Truth table for 1-bit comparator.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-45001r5  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
   &lt;/div&gt;
&lt;!-- l. 2033 --&gt;&lt;p class=&quot;indent&quot;&gt;   If we wanted to extend this circuit to compare 4-bit numbers instead, we could
do it by stacking up a bunch of these simpler 1-bit comparator units
and adding some extra logic that I will leave for you to figure out on
your own as an exercise. But here is the circuit for comparing two 4-bit
numbers:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2037 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s3_comparator_4b_impl.png&quot; width=&quot;80%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2042 --&gt;&lt;p class=&quot;indent&quot;&gt;   Scaling this further to 8-bit number comparison, the same simple logic follows.
Try to do this yourself to see what I mean.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;arithmetic-logic-unit-alu&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.4   &lt;/span&gt; &lt;a id=&quot;x1-460006.4&quot;&gt;&lt;/a&gt;Arithmetic Logic Unit (ALU)&lt;/h3&gt;
&lt;!-- l. 2045 --&gt;&lt;p class=&quot;noindent&quot;&gt;Now that we have built both &lt;span class=&quot;cmbx-12&quot;&gt;arithmetic unit &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;logic unit&lt;/span&gt;, we can combine
them under the &lt;span class=&quot;cmbx-12&quot;&gt;arithmetic and logic unit&lt;/span&gt;. Moreover, we will add some more
functionality to this ALU bad boy. Here are the things I want my ALU to be
capable of doing:
&lt;/p&gt;
      &lt;ul class=&quot;itemize1&quot;&gt;
      &lt;li class=&quot;itemize&quot;&gt;Rotate a number to left or to right by one bit (&lt;span class=&quot;cmbx-12&quot;&gt;rotl &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;rotr&lt;/span&gt;): &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {rotl}(\overline {a_7 a_6 \dots a_1 a_0}) = \overline {a_6 a_5 \dots a_1 a_0 a_7}\)&lt;/span&gt; and &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {rotr}(\overline {a_7 a_6 \dots a_1 a_0}) = \overline {a_0 a_7 a_6 \dots a_2 a_1}\)&lt;/span&gt;.
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;Shift a number to left or to right by one bit (&lt;span class=&quot;cmbx-12&quot;&gt;shiftl &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;shiftr&lt;/span&gt;): &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {shiftl}(\overline {a_7 a_6 \dots a_1 a_0}) = \overline {a_6 a_5 \dots a_1 a_0 0}\)&lt;/span&gt; and
      &lt;span class=&quot;mathjax-inline&quot;&gt;\(\operatorname {shiftr}(\overline {a_7 a_6 \dots a_1 a_0}) = \overline {0 a_7 a_6 \dots a_2 a_1}\)&lt;/span&gt;.
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;2’s complement of a number: NOT(a) + 1.&lt;/li&gt;&lt;/ul&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2055 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s4_alu_8b_impl.png&quot; width=&quot;80%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2060 --&gt;&lt;p class=&quot;indent&quot;&gt;   Since our ISA has assigned special opcodes for each operation, we connect
outputs of these arithmetic and logic components (such as rotl, rotr, shiftl,
shiftl, 8-bit adder, 8-bit comparator, NOTx8, ANDx8, ORx8 XORx8, 2’s
complementer) to a 16x1 MUX and provide the 4-bit opcode (&lt;span class=&quot;mathjax-inline&quot;&gt;\(b_{14:11}\)&lt;/span&gt;) as the selector
bits.
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;random-access-memory-ram&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.5   &lt;/span&gt; &lt;a id=&quot;x1-470006.5&quot;&gt;&lt;/a&gt;Random Access Memory (RAM)&lt;/h3&gt;
&lt;!-- l. 2063 --&gt;&lt;p class=&quot;noindent&quot;&gt;Having learned about the latches and flip-flops, building an 8-bit register is easy:
just stack 8 flip-flops (or latches if you don’t want edge-triggered memory). Since
we want edge-triggered memory, here is a simple implementation by using 8 D
flip-flops, all in sync with the global clock:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2067 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s5_reg_8b_impl.png&quot; width=&quot;50%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2072 --&gt;&lt;p class=&quot;indent&quot;&gt;   We will come back to this 8-bit register in a bit. Now, let’s understand how
addressing works in a basic &lt;span class=&quot;cmbx-12&quot;&gt;bit-level addressable memory&lt;/span&gt;. Say there are 4 D
flip-flops (conventionally indexed from 00 to 11 in binary) and we would
like to ”use” the third one (at index 10). By ”using”, we have to also
specify whether we would like to write some data to it or read the data
already stored in it. Therefore, we have two additional input bits &lt;span class=&quot;cmbx-12&quot;&gt;WE&lt;/span&gt;
(write-enable) and &lt;span class=&quot;cmbx-12&quot;&gt;RE &lt;/span&gt;(read-enable). Sometimes these are also called &lt;span class=&quot;cmbx-12&quot;&gt;load &lt;/span&gt;and
&lt;span class=&quot;cmbx-12&quot;&gt;enable &lt;/span&gt;bits. Here is the circuit that allows us to work with such a memory
unit:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2076 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s5_ram_4b_impl.png&quot; width=&quot;80%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2081 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now, let’s go back our 8-bit register once again. This is essentially what
byte-addressable memory uses: we stack up 256 of these 8-bit registers and only
active one of them depending on the 8-bit address, as well as WE/RE bits. We
used four 2x1 MUXs to select one out of 4 D flip-flops previously. It is easy to
apply the same logic to select one out of 4 8-bit registers, as well. This
will give us 4 bytes of byte-addressable memory unit or 2x8 RAM (2
indicates number of address bits and 8 represents addressability). To
construct 4x8 RAM, you would need to apply the same logic using four 2x1
MUXs recursively to four 2x8 RAM units (instead of four D flip-flops).
Then to build 6x8 RAM, the same organization of 2x1 MUXs will be
connected to four 4x8 RAM units. Finally, by using four 6x8 RAM units in a
similar organization, we could build 8x8 RAM or 256 byte byte-addressable
RAM.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot;&gt; 

                                                                          

                                                                          
                                                                          

                                                                          
&lt;!-- l. 2085 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s5_ram_8x8_impl.png&quot; width=&quot;80%&quot; /&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;/figure&gt;
&lt;!-- l. 2090 --&gt;&lt;p class=&quot;indent&quot;&gt;   The figure above shows the construction of 8x8 RAM by using four 6x8 RAM
units, each of which is similarly constructed by using four 4x8 RAM units
(this goes on until we use four 8-bit registers to construct a 2x2 RAM
unit).
   
&lt;/p&gt;
   &lt;h3 class=&quot;sectionHead&quot; id=&quot;the-dx-computer&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.6   &lt;/span&gt; &lt;a id=&quot;x1-480006.6&quot;&gt;&lt;/a&gt;The DX8 Computer&lt;/h3&gt;
&lt;!-- l. 2093 --&gt;&lt;p class=&quot;noindent&quot;&gt;We are going to build the four high-level components that we are going to use to
assembly my DX8 computer. These components are the following:
&lt;/p&gt;
      &lt;ul class=&quot;itemize1&quot;&gt;
      &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Stepper &lt;/span&gt;-  that  turns  on  a  single  output  bit  in  a  predefined  order
      repetitively and synchronously based on the global clock signal.
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Register File &lt;/span&gt;- a small memory unit consisting of 8 registers that can
      be selected by using 3-bit addresses, also in sync with the clock.
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;ALU &lt;/span&gt;- we have already built this; we are just going to containarize it.
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Contoller &lt;/span&gt;- that output the control bits for different components inside
      our computer depending the current workflow, syncronized with the
      clock.&lt;/li&gt;&lt;/ul&gt;
                                                                          

                                                                          
&lt;!-- l. 2102 --&gt;&lt;p class=&quot;indent&quot;&gt;   It is very natural to ask why the hell we need a thing called &lt;span class=&quot;cmbx-12&quot;&gt;stepper &lt;/span&gt;in the
first place. Well, to understand the reason we need it, I first need to introduce the
four main stages of computation that goes inside a computer:
&lt;/p&gt;&lt;!-- l. 2104 --&gt;&lt;p class=&quot;indent&quot;&gt;
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48002x1&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Fetch &lt;/span&gt;- in this stage Controller sets the RE control bits of RAM to read
      data, and sets the WE control bits of Register file and other bunch of
      relevant registers (such as IR) so that instruction is fetched and saved
      into the registers properly for the next stage;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48004x2&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Decode &lt;/span&gt;- in this stage the instruction is scrutinized to understand
      whether it’s ALU or Memory instruction, and which component within
      ALU is responsible for it;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48006x3&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Execute &lt;/span&gt;- in this stage the decoded instruction is executed either in
      ALU or elsewhere and the outputs are stored temporarily in registers
      such as regOUT, regFLAG, etc.;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48008x4&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Load &lt;/span&gt;- in this stage the temporarily saved results from the previous
      stage gets written back to the main memory unit (RAM) if needed,
      and cycle repeats again.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 2111 --&gt;&lt;p class=&quot;indent&quot;&gt;   There are different ways of going through these 4 stages inside computers in
general. Here are 3 different ways that a computer can be built to go through
these &lt;span class=&quot;cmbx-12&quot;&gt;Fetch-Decode-Execute-Load &lt;/span&gt;stages:
&lt;/p&gt;&lt;!-- l. 2113 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48010x1&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Single-cycle &lt;/span&gt;processing uses single clock cycle to go through all of the
      4 stages at once.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48012x2&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Multi-cycle &lt;/span&gt;processing uses different clock cycles to go through each
      of  4  stages  individually,  improving  the  performance  compared  to  a
      single-cycle machine.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-48014x3&quot;&gt;&lt;span class=&quot;cmbx-12&quot;&gt;Pipelined  &lt;/span&gt;processing   further   imporoves   the   performance   of   a
      multi-cycle CPU by not putting the next instructions throught the idle
      stages not used by the current instruction anymore.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 2119 --&gt;&lt;p class=&quot;indent&quot;&gt;   If you do not fully understand what &lt;span class=&quot;cmbx-12&quot;&gt;pipelining &lt;/span&gt;is, do not worry about it too
much for now. I have decided that I want to go with multi-cycle processor design
for the DX8 CPU. You can view it as a tradeoff for performance and simplicity for
this book. Building single-cycle is the simplest and the pipelined is the
hardest, while single-cycle is the least efficient and the pipelined is the
most efficient. This leaves the multi-cycle CPU in the middle: moderate
complexity in design and moderate performance in practice! That’s what I
wanted.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;singlecycle-multicycle-pipelined-design&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.6.1   &lt;/span&gt; &lt;a id=&quot;x1-490006.6.1&quot;&gt;&lt;/a&gt;Single-cycle, Multi-cycle, Pipelined Design&lt;/h4&gt;
&lt;!-- l. 2122 --&gt;&lt;p class=&quot;noindent&quot;&gt;We said there are 4 stages of electricity running inside our computer: (1)
electricity running to fetch instruction from main memory to the instruction
register IR, (2) electricity running to decode the fetched IR content to know what
control signals should be sent to the rest of the hardware to execute the
                                                                          

                                                                          
instruction in IR, (3) electricity running to actually follow the generated control
signal to the different hardware components in order to execute the instruction
and save results into their corresponding registers, (4) electricity running to store
these results held in temporary registers into the main memory if needed. Well,
having 4 stages like this makes the design process easier and modular. Here is the
roughly drawn picture illustrating these 4 stages in a single-cycle and multi-cycle
processor:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-49001r3&quot;&gt;&lt;span id=&quot;fetchdecodeexecuteload-in-top-singlecycle-and-bottom-multicycle-cpu&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2126 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/fdel-single-cycle.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;&lt;!-- l. 2128 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/fdel-multi-cycle.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.3: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Fetch-Decode-Execute-Load in &lt;span class=&quot;cmbx-12&quot;&gt;(top) &lt;/span&gt;single-cycle and &lt;span class=&quot;cmbx-12&quot;&gt;bottom)&lt;/span&gt;
multi-cycle CPU.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-49001r3  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2133 --&gt;&lt;p class=&quot;indent&quot;&gt;   In a pipelined processing, the unused stages by the current instruction is given
to the use for the next instruction. This makes the next instruction to already
start executing even when the previous instruction is not completely finished with
all the stages. This is shown in the figure below clearly:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-49002r4&quot;&gt;&lt;span id=&quot;fetchdecodeexecuteload-in-top-multicycle-and-bottom-pipelined-cpu&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2137 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/fdel-multi-cycle-blocking.png&quot; width=&quot;90%&quot; /&gt;
&lt;/p&gt;&lt;!-- l. 2139 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/fdel-pipelined.png&quot; width=&quot;90%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.4: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Fetch-Decode-Execute-Load in &lt;span class=&quot;cmbx-12&quot;&gt;(top) &lt;/span&gt;multi-cycle and &lt;span class=&quot;cmbx-12&quot;&gt;(bottom)&lt;/span&gt;
pipelined CPU.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-49002r4  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2144 --&gt;&lt;p class=&quot;indent&quot;&gt;   Speaking of optimizing CPU performance, here is something that I want to
mention very briefly for the curious readers out there. The &lt;span class=&quot;cmti-12&quot;&gt;amount of time it
takes for the CPU to finish one instruction &lt;/span&gt;is called &lt;span class=&quot;cmbx-12&quot;&gt;latency&lt;/span&gt;, and the
&lt;span class=&quot;cmti-12&quot;&gt;number of instructions finished in each “second” &lt;/span&gt;is called &lt;span class=&quot;cmbx-12&quot;&gt;throughput&lt;/span&gt;.
Moving from single-cycle to multi-cycle processor design clearly improves
performance by reducing the latency, and moving from multi-cycle to pipelined
processor does not inherently change the latency (that is, an instruction
still takes the same 4 stages in multiple cycles to finish) but increases
the throughput. This can be clearly observed from the figure above as
follows:
&lt;/p&gt;
      &lt;ul class=&quot;itemize1&quot;&gt;
      &lt;li class=&quot;itemize&quot;&gt;If the longest instruction takes 100 ns then the clock period must be
      at least 100 ns in single-cycle CPU in order to finish even the hardest
      instruction properly;
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;In a single cycle CPU, setting clock period to 100 ns will also cause
      every instruction to finish in 100 ns (even if some instruction could
      have been finished sooner than that);
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;Multi-cycle  CPU  solves  this  problem  by  allocating  varying  number
      of  cycles  for  each  stage  in  Fetch-Decode-Execute-Load;  now,  if  an
      instruction could be fetched in 2 cycles then only 2 cycles are spared
      for it, and if a single cycle is enough for decoding then only single cycle
      is spared for decoding, and so on;
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;However,  the  next  instruction  must  wait  for  the  current  one  to
      completely finish in multi-cycle CPU; but if current instruction has
      already finished the Fetch stage and now is processed in the Decode
                                                                          

                                                                          
      stage, why shouldn’t we allow the next instruction to be fetched since
      our “fetcher” is idle?
      &lt;/li&gt;
      &lt;li class=&quot;itemize&quot;&gt;Pipelined CPU solves this problem by pipelining instructions next to
      one another, increasing the throughput.&lt;/li&gt;&lt;/ul&gt;
&lt;!-- l. 2154 --&gt;&lt;p class=&quot;indent&quot;&gt;   Even though the latency does not change when we go from multi-cycle
CPU to pipelined one (see the diagram above again – clock period is the
same for both), in multi-cycle design it would take 24 cycles to execute 3
instructions (assuming each phase takes exactly 2 cycles, and therefore,
each instruction takes exactly 8 cycles), whereas in pipelined design it
would take 10 cycles for the same 3 instructions to finish. In this example,
throughput for the multi-cycle CPU would be &lt;span class=&quot;mathjax-inline&quot;&gt;\(\frac {3}{24} = 0.125\)&lt;/span&gt;, and for pipelined CPU
it would be &lt;span class=&quot;mathjax-inline&quot;&gt;\(\frac {3}{10} = 0.3\)&lt;/span&gt;; this is 2.4x more throughput… 2.4x more instructions per
cycle.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;stepper&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.6.2   &lt;/span&gt; &lt;a id=&quot;x1-500006.6.2&quot;&gt;&lt;/a&gt;Stepper&lt;/h4&gt;
&lt;!-- l. 2157 --&gt;&lt;p class=&quot;noindent&quot;&gt;To have a clear separation of which phase is executing for a given instruction, we
are going to build a component called &lt;span class=&quot;cmbx-12&quot;&gt;stepper&lt;/span&gt;. Stepper has one external
&lt;span class=&quot;cmtt-12&quot;&gt;reset &lt;/span&gt;input. It operates with the clock signal to output one-hot encoded
values to indicate which stage the CPU should be in the current clock
cycle. To build a stepper, we can use a binary counter and a decoder as
follows:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-50001r5&quot;&gt;&lt;span id=&quot;step-stepper-implementation&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2161 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s6_stepper_impl.png&quot; width=&quot;50%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.5: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;8-step Stepper implementation.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-50001r5  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2166 --&gt;&lt;p class=&quot;indent&quot;&gt;   To build DX8, I am going to allocate maximum of 2 steps (or 2 clock cycles)
for each stage. Therefore, &lt;span class=&quot;cmbx-12&quot;&gt;Fetch &lt;/span&gt;will take 2 clock cycles (steps 1 and 2), &lt;span class=&quot;cmbx-12&quot;&gt;Decode&lt;/span&gt;
will take the next 2 clock cycles after &lt;span class=&quot;cmbx-12&quot;&gt;Fetch &lt;/span&gt;(steps 3 and 4), &lt;span class=&quot;cmbx-12&quot;&gt;Execute &lt;/span&gt;will take
the next 2 clock cycles (that is steps 5 and 6), and &lt;span class=&quot;cmbx-12&quot;&gt;Load &lt;/span&gt;will take the last 2 clock
cycles (steps 7 and 8). Notice that the stepper will go from step 1 to step 8, and
then it will go back to step 1 again, and the same behavior will repeat. This is
literally what stepper is useful for: for telling us which stage we are in
currently.
&lt;/p&gt;&lt;!-- l. 2168 --&gt;&lt;p class=&quot;indent&quot;&gt;   Before ending this section, let me briefly show you another pair of useful
components that are going to be used in DX8: &lt;span class=&quot;cmbx-12&quot;&gt;register file with 8 8-bit
registers &lt;/span&gt;and &lt;span class=&quot;cmbx-12&quot;&gt;8-bit ALU&lt;/span&gt;. Designing the register file is really easy since we have
already seen how RAM is built. We will use the same logic to build 3x8 RAM
(byte-addressable RAM with 3-bit addresses):
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-50002r6&quot;&gt;&lt;span id=&quot;register-file-implementation-with-addressable-bit-register-r-r&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2172 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s6_reg_3x8_impl.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.6: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Register File implementation with 8 addressable 8-bit register: &lt;span class=&quot;mathjax-inline&quot;&gt;\(\texttt {R0}_{7:0}, \dots , \texttt {R7}_{7:0}\)&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-50002r6  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2176 --&gt;&lt;p class=&quot;indent&quot;&gt;   The register file built in the figure above actually holds 16 registers, but we
will only use the first 8 of them. Now, let’s see our ALU component that we built
previously but did not “containarize” it.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-50003r7&quot;&gt;&lt;span id=&quot;bit-pseudocpu-implementation&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;div class=&quot;minipage&quot;&gt;&lt;!-- l. 2181 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s6_cpu_8b_impl.png&quot; width=&quot;65%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.7: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;8-bit (pseudo-)CPU implementation.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-50003r7  --&gt;                   &lt;/div&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2187 --&gt;&lt;p class=&quot;indent&quot;&gt;   There you go. We have a 8-bit ALU component as well as the register
file.
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;controller&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.6.3   &lt;/span&gt; &lt;a id=&quot;x1-510006.6.3&quot;&gt;&lt;/a&gt;Controller&lt;/h4&gt;
&lt;!-- l. 2190 --&gt;&lt;p class=&quot;noindent&quot;&gt;We need to build the last component before we put everything together for my
DX8 computer. The component we are going to build is called &lt;span class=&quot;cmbx-12&quot;&gt;Control Unit &lt;/span&gt;or
&lt;span class=&quot;cmbx-12&quot;&gt;Controller&lt;/span&gt;. But you may wonder why we need such a component in the first
place. Let me explain.
&lt;/p&gt;&lt;!-- l. 2192 --&gt;&lt;p class=&quot;indent&quot;&gt;   Suppose we are in the first stage where we need to fetch an instruction from
the main memory into the instruction register IR. The question is, which
wires are going to be active during this stage? To be able to answer this
question, let’s see the &lt;span class=&quot;cmbx-12&quot;&gt;data path &lt;/span&gt;of the DX8 computer that I gave you
earlier:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-51001r8&quot;&gt;&lt;span id=&quot;data-path-for-the-dx-computer-while-fetching&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2196 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/dx8-datapath-fetch.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.8: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Data path for the DX8 computer while &lt;span class=&quot;cmbx-12&quot;&gt;fetching&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-51001r8  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2201 --&gt;&lt;p class=&quot;indent&quot;&gt;   When decoding the arguments present in the instruction must be
sent to their corresponding register regA and regB and the operation
must be sent in 4-bits to the ALU, assuming it is an ALU instruction.
Therefore, the data path for decoding should roughly look like something
below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-51002r9&quot;&gt;&lt;span id=&quot;data-path-for-the-dx-computer-while-decoding&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2205 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/dx8-datapath-decode.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.9: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Data path for the DX8 computer while &lt;span class=&quot;cmbx-12&quot;&gt;decoding&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-51002r9  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2210 --&gt;&lt;p class=&quot;indent&quot;&gt;   Assuming we are executing an ALU instruction, the wires connecting two
operands &lt;span class=&quot;cmtt-12&quot;&gt;regA &lt;/span&gt;and &lt;span class=&quot;cmtt-12&quot;&gt;regB &lt;/span&gt;to the ALU (because ALU will be reading inputs from
these registers), the wire connecting &lt;span class=&quot;cmtt-12&quot;&gt;IR &lt;/span&gt;to ALU (because ALU will output the
result of the operation corresponding to the instruction held in the &lt;span class=&quot;cmtt-12&quot;&gt;IR&lt;/span&gt;), the wires
connecting ALU to the temporary output registers &lt;span class=&quot;cmtt-12&quot;&gt;regOUT &lt;/span&gt;and &lt;span class=&quot;cmtt-12&quot;&gt;regFLAG&lt;/span&gt;
(because ALU ouput will be stored in these registers), and a bunch of wires
connected/connecting the Controller (because Controller decides these control
signals that I mentioned based on the context, such as Stepper’s output and IR’s
content) on the datapath will need to become active. The active wires are shown
with orange color in the figure below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-51003r10&quot;&gt;&lt;span id=&quot;data-path-for-the-dx-computer-while-executing&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2212 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/dx8-datapath-execute.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.10: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Data path for the DX8 computer while &lt;span class=&quot;cmbx-12&quot;&gt;executing&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-51003r10  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2219 --&gt;&lt;p class=&quot;indent&quot;&gt;   Finally, the &lt;span class=&quot;cmti-12&quot;&gt;load &lt;/span&gt;or &lt;span class=&quot;cmti-12&quot;&gt;write-back &lt;/span&gt;stage may require &lt;span class=&quot;cmtt-12&quot;&gt;regOUT &lt;/span&gt;and &lt;span class=&quot;cmtt-12&quot;&gt;regFlAG &lt;/span&gt;content
to be moved into the register file, or some register’s content in the register file to
be stored in the RAM by providing an address from the &lt;span class=&quot;cmtt-12&quot;&gt;IP&lt;/span&gt;. This is illustrated in
the figure given below:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-51004r11&quot;&gt;&lt;span id=&quot;data-path-for-the-dx-computer-while-loading&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2219 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/other/dx8-datapath-load.png&quot; width=&quot;80%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.11: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Data path for the DX8 computer while &lt;span class=&quot;cmbx-12&quot;&gt;loading&lt;/span&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-51004r11  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2224 --&gt;&lt;p class=&quot;indent&quot;&gt;   Now that we know what wires become “hot” during each and every stage of
clock cycles, how do we make these wires become “hot” and active? Well, we do it
by basically read-enabling outputs of a source component and write-enabling the
target component that the data needs to transfer to. Controlling these
read-enable, write-enable, or some of the select bits of MUXs used to transfer data
is the job of &lt;span class=&quot;cmbx-12&quot;&gt;controller&lt;/span&gt;. The controller takes signal from various sources,
important one being the stepper’s output to know which stage is executing and
the instruction itself, and decides which enable/select bits must be turned on and
off for other components.
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-51005r12&quot;&gt;&lt;span id=&quot;controller-implementation&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2228 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s6_controller_impl.png&quot; width=&quot;95%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.12: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;Controller implementation.&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-51005r12  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2233 --&gt;&lt;p class=&quot;indent&quot;&gt;   Above you see the implementation of the control unit that is used in DX8. It is
not too fancy: if you take a look at it closely, you will be able to figure it out
easily. For example, look at what happens when controller’s &lt;span class=&quot;cmbx-12&quot;&gt;s1 &lt;/span&gt;input becomes
high: &lt;span class=&quot;cmbx-12&quot;&gt;regFileWE &lt;/span&gt;turns high (which is connected to the write-enable input of the
register file), allowing the instruction to be copied from the main memory to the
register file during the first cycle of &lt;span class=&quot;cmbx-12&quot;&gt;fetching&lt;/span&gt;. The inputs and outputs of the
controller will make sense once you see all the components together inside the
DX8 computer. That’s when you will be able to track each output and wire to see
which components get affected by the control outputs. So, let’s see the whole
thing!
   
&lt;/p&gt;
   &lt;h4 class=&quot;subsectionHead&quot; id=&quot;putting-everything-together&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;6.6.4   &lt;/span&gt; &lt;a id=&quot;x1-520006.6.4&quot;&gt;&lt;/a&gt;Putting everything together!&lt;/h4&gt;
&lt;!-- l. 2236 --&gt;&lt;p class=&quot;noindent&quot;&gt;Here is the &lt;span class=&quot;rm-qzcmi-x-x-144&quot;&gt;8-bit Dummy &lt;/span&gt;computer:
&lt;/p&gt;
   &lt;figure class=&quot;figure&quot; id=&quot;x1-52001r13&quot;&gt;&lt;span id=&quot;the-dx-computer1&quot;&gt;&lt;/span&gt; 

                                                                          

                                                                          

                                                                          

                                                                          
&lt;!-- l. 2240 --&gt;&lt;p class=&quot;noindent&quot;&gt;&lt;img alt=&quot;PIC&quot; src=&quot;/assets/courses/comp-arch/figures/c6s6_dx8.png&quot; width=&quot;100%&quot; /&gt;
&lt;/p&gt;
&lt;figcaption class=&quot;caption&quot;&gt;&lt;span class=&quot;id&quot;&gt;Figure 6.13: &lt;/span&gt;&lt;span class=&quot;content&quot;&gt;The DX8 Computer!&lt;/span&gt;&lt;/figcaption&gt;&lt;!-- tex4ht:label?: x1-52001r13  --&gt;
                                                                          

                                                                          
   &lt;/figure&gt;
&lt;!-- l. 2245 --&gt;&lt;p class=&quot;indent&quot;&gt;   It even has very basic keyboard: &lt;span class=&quot;cmbx-12&quot;&gt;8-bit data &lt;/span&gt;input switches and &lt;span class=&quot;cmbx-12&quot;&gt;8-bit addr&lt;/span&gt;
address switches (with which you can specify the memory address inside RAM
you want to put your &lt;span class=&quot;cmti-12&quot;&gt;input data&lt;/span&gt;). Before I explain how input system works
for this computer, let me first tell you the difference between a (push)
&lt;span class=&quot;cmbx-12&quot;&gt;button &lt;/span&gt;and a &lt;span class=&quot;cmbx-12&quot;&gt;switch&lt;/span&gt;. A button sends high signal through its output
wire as long as it is pressed; its output immediately drops to 0 when you
lift your finger up. In contrast, a switch becomes ON (sends high signal
through its output wire) once you turn it on, and then you can keep your
fingers away from it and it will still keep sending 1 through the wire; it will
become OFF again once you turn it off and then it will stay OFF unless
you turn it on again later on. The difference may sound subtle, but it is
important: to make push button become ON (to send high signal) you need to
actively use your finger to press it, whereas you only need your finger
once to turn on the switch. Having clarified this difference between these
two essential input components, this is how you can operate the DX8
computer:
      &lt;/p&gt;&lt;ol class=&quot;enumerate1&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52003x1&quot;&gt;Turn on the single-bit &lt;span class=&quot;cmbx-12&quot;&gt;reset &lt;/span&gt;switch.
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52005x2&quot;&gt;
      &lt;!-- l. 2249 --&gt;&lt;p class=&quot;noindent&quot;&gt;If you want to program the computer before letting it run:
           &lt;/p&gt;&lt;ol class=&quot;enumerate2&quot;&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52007x1&quot;&gt;Put in the data bits in the &lt;span class=&quot;cmbx-12&quot;&gt;8-bit data &lt;/span&gt;switch.
           &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52009x2&quot;&gt;Put in the address bits in the &lt;span class=&quot;cmbx-12&quot;&gt;8-bit addr &lt;/span&gt;switch.
                                                                          

                                                                          
           &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52011x3&quot;&gt;Push the &lt;span class=&quot;cmbx-12&quot;&gt;write &lt;/span&gt;button (it is essentially the same as turning on
           1-bit switch and then turning it off instantly).
           &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52013x4&quot;&gt;Repeat  this  process  as  long  as  you  haven’t  finished  putting
           everything you need in the main memory.&lt;/li&gt;&lt;/ol&gt;
      &lt;/li&gt;
&lt;li class=&quot;enumerate&quot; id=&quot;x1-52015x3&quot;&gt;Turn off the &lt;span class=&quot;cmbx-12&quot;&gt;reset &lt;/span&gt;switch and the DX8 will start working.&lt;/li&gt;&lt;/ol&gt;
&lt;!-- l. 2259 --&gt;&lt;p class=&quot;indent&quot;&gt;   I hope you enjoyed reading this book. You can find everything related to DX8
in the following github repo:  &lt;a href=&quot;https://github.com/AliKhudiyev/alikhudiyev.github.io/tree/main//assets/courses/comp-arch&quot;&gt;dx8-course-material&lt;/a&gt;.
                                                                          

                                                                          
&lt;/p&gt;&lt;!-- l. 2261 --&gt;&lt;p class=&quot;indent&quot;&gt;
                                                                          

                                                                          
&lt;/p&gt;
   &lt;h2 class=&quot;chapterHead&quot; id=&quot;epilogue&quot;&gt;&lt;span class=&quot;titlemark&quot;&gt;Chapter 7&lt;/span&gt;&lt;br /&gt;&lt;a id=&quot;x1-530007&quot;&gt;&lt;/a&gt;Epilogue&lt;/h2&gt;
&lt;!-- l. 2262 --&gt;&lt;p class=&quot;noindent&quot;&gt;You have reached the end of this journey. Thanks for reading this unpolished
draft book, which is more like a lecture notes from the caveman. I want you to
know that any constructive feedback is appreciated. You can contact me via my
email for this. Now, if you are a sharp reader you may catch a lot of things and
technical details which were introduced and explained in a very hand-wavy
manner. This is no coincidence. I wanted to keep this book under 100 pages, so
that readers with even a little patience could get the courage to read it
without hesitation. That’s why I have usually went straight to the point
sometimes without trying to explain very thoroughly the whys, hows, and
whats. What you may also notice is that while building my DX8 computer,
I did not bother with the timing constraints at all, even though I was
telling you to be careful about all this &lt;span class=&quot;cmti-12&quot;&gt;setup &lt;/span&gt;and &lt;span class=&quot;cmti-12&quot;&gt;hold &lt;/span&gt;time constraints
while building sequential circuits. The reason I did not bother the timing
in parts of the book where I was explaining how DX8 can be built is
because &lt;span class=&quot;cmti-12&quot;&gt;real computer architects do not care about timing violations&lt;/span&gt;. If it
works, then it works; and if it doesn’t then you suck and you need to
probably go back to checking your timing constraints after making sure your
logic works right. Okay, jokes aside, I did not do the time checks while
building DX8 because &lt;span class=&quot;cmti-12&quot;&gt;I left it as an exercise for readers&lt;/span&gt;. Okay, okay… I just
didn’t because I did not want to bother (at least for now… or maybe for
ever…).
&lt;/p&gt;
    
&lt;!-- &lt;/body&gt; --&gt; 
&lt;!-- &lt;/html&gt; --&gt;
&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
</description>
        <pubDate>Tue, 12 May 2026 00:00:00 +0000</pubDate>
        <link>/courses/self-study/computer-architecture/book/2026/05/12/computer-architecture-1.html</link>
        <guid isPermaLink="true">/courses/self-study/computer-architecture/book/2026/05/12/computer-architecture-1.html</guid>
        
        
        <category>courses</category>
        
        <category>self-study</category>
        
        <category>computer-architecture</category>
        
        <category>book</category>
        
      </item>
    
      <item>
        <title>Live Aquarium</title>
        <description>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta charset=&quot;utf-8&quot;&gt;
	&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, user-scalable-no, minimum-scale=1.0, maximum-scale=1.0&quot;&gt;
	&lt;title&gt;FishLive – Live Aquarium&lt;/title&gt;
	&lt;style&gt;
		* { margin: 0; padding: 0; box-sizing: border-box; }
		body { background: #000; overflow: hidden; }
		canvas { display: block; }
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id=&quot;container&quot;&gt;&lt;/div&gt;
	&lt;script type=&quot;module&quot; src=&quot;/assets/js/live-aquarium/main.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;
</description>
        <pubDate>Mon, 16 Mar 2026 14:37:00 +0000</pubDate>
        <link>/art/generated/2026/03/16/live-aquarium.html</link>
        <guid isPermaLink="true">/art/generated/2026/03/16/live-aquarium.html</guid>
        
        
        <category>art</category>
        
        <category>generated</category>
        
      </item>
    
      <item>
        <title>Set Theory</title>
        <description>&lt;h1 id=&quot;lemmas--theorems&quot;&gt;Lemmas &amp;amp; Theorems&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Lemma 1 (Zorn’s lemma).&lt;/strong&gt; If $X$ is a partially ordered set such
that every chain in $X$ has an upper bound, then $X$ contains a
maximal element.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 1 (Recursion).&lt;/strong&gt; If $a$ is an element of a set $X$, and if
$f$ is a function from $X$ to $X$, then there exists a function $u$
from $w$ to $X$ such that $u(0) = a$ and such that $u(n^+) = f(u(n))$
for all $n$ in $w$.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 2 (Well ordering).&lt;/strong&gt; Every set can be well ordered.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 3 (Transfinite recursion).&lt;/strong&gt; If $W$ is a well ordered set,
and if $f$ is a sequence function of type $W$ in a set $X$, then there
exists a unique function $U$ from $W$ into $X$ such that
$U(a) = f(U^a)$ for each $a$ in $W$.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 4 (Counting).&lt;/strong&gt; Each well ordered set is similar to a unique
ordinal number.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 5 (Schröder-Bernstein theorem).&lt;/strong&gt; If $X \precsim Y$ and
$Y \precsim Z$, then $X \sim Y$.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Theorem 6.&lt;/strong&gt; Every set is strictly dominated by its power set, or,
in other words,&lt;/p&gt;

\[X \prec \mathcal{P}(X)\]

  &lt;p&gt;for all $X$.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Sun, 07 Dec 2025 19:00:00 +0000</pubDate>
        <link>/courses/self-study/mathematics/foundations/2025/12/07/set-theory-3.html</link>
        <guid isPermaLink="true">/courses/self-study/mathematics/foundations/2025/12/07/set-theory-3.html</guid>
        
        
        <category>courses</category>
        
        <category>self-study</category>
        
        <category>mathematics</category>
        
        <category>foundations</category>
        
      </item>
    
      <item>
        <title>Set Theory</title>
        <description>&lt;h1 id=&quot;axioms&quot;&gt;Axioms&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 1 (Axiom of Extension).&lt;/strong&gt; Two sets are equal if and only if
they have the same elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 2 (Axiom of Specification).&lt;/strong&gt; To every set $A$ and to every
condition $S(x)$ there corresponds a set $B$ whose elements are
exactly those elements $x$ of $A$ for which $S(x)$ holds.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 3 (Axiom of Pairing).&lt;/strong&gt; For any two sets there exists a set
that they both belong to.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 4 (Axiom of Unions).&lt;/strong&gt; For every collection of sets there
exists a set that contains all the elements that belong to at least
one set of the given collection.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 5 (Axiom of Powers).&lt;/strong&gt; For each set there exists a collection
of sets that contains among its elements all the subsets of the given
set.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 6 (Axiom of Infinity).&lt;/strong&gt; There exists a set containing 0 and
containing the successor of each of its elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 7 (Axiom of Choice).&lt;/strong&gt; The Cartesian product of a non-empty
family of non-empty sets is non-empty.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Axiom 8 (Axiom of Substitution).&lt;/strong&gt; If $S(a, b)$ is a sentence such
that for each $a$ in a set $A$ the set ${b : S(a, b)}$ can be
formed, then there exists a function $F$ with domain $A$ such that
$F(a) = {b : S(a, b)}$ for each $a$ in $A$.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Sun, 07 Dec 2025 19:00:00 +0000</pubDate>
        <link>/courses/self-study/mathematics/foundations/2025/12/07/set-theory-2.html</link>
        <guid isPermaLink="true">/courses/self-study/mathematics/foundations/2025/12/07/set-theory-2.html</guid>
        
        
        <category>courses</category>
        
        <category>self-study</category>
        
        <category>mathematics</category>
        
        <category>foundations</category>
        
      </item>
    
      <item>
        <title>Set Theory</title>
        <description>&lt;h1 id=&quot;basics&quot;&gt;Basics&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Definition 1 (Set).&lt;/strong&gt; Set is a bucket that can hold objects or
elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

\[\begin{aligned}
    &amp;amp;S = \{1, 2, 3, 4, 5\} \quad\text{(S is a set of some numbers)} \\
    &amp;amp;C = \{a, b, g, r, s\} \quad\text{(C is a set of some letters)}
\end{aligned}\]

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Remark 1 (Set Membership).&lt;/strong&gt; Given a set $S$ and an element $x$, $x$
can either be included in $S$ (denoted as $x \in S$), or excluded in
$S$ (denoted as $x \not\in S$).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

\[\begin{aligned}
    &amp;amp;3 \in S, \text{but}\ 8 \not\in S \\
    &amp;amp;B \not\in C, \text{but}\ b \in S
\end{aligned}\]

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Remark 2 (Set Construction).&lt;/strong&gt; A set builder notation
${x : \text{&lt;some logical=&quot;&quot; condition=&quot;&quot; on=&quot;&quot; x=&quot;&quot;&gt;}\}$ can be used to
construct sets more conveniently.&lt;/some&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

\[\begin{aligned}
    &amp;amp;N = \{x : x \in \mathbb{Z} \text{ and } 0 &amp;lt; x &amp;lt; 101\} \quad\text{$N$ is a set of all positive integers up to 101}\\
    &amp;amp;E = \{x : x \in \mathbb{N} \text{ and } x \mod 2 = 0\} \quad\text{$E$ is a set of all even natural numbers}\\
\end{aligned}\]

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Definition 2 (Union of Sets).&lt;/strong&gt; Union of sets
$A = {a_1, a_2, \cdots}$ and $B = {b_1, b_2, \cdots}$ is another
set containing all the elements of $A$ and $B$, i.e.,
$A \cup B = {a_1, a_2, a_3, \cdots, b_1, b_2, \cdots}$.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

\[\begin{aligned}
    S \cup C = \{1, 2, 3, 4, 5, a, b, g, r, s\}
\end{aligned}\]

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Definition 3 (Intersection of Sets).&lt;/strong&gt; Intersection of sets $A$ and
$B$ is another set containing all the common elements that appear both
in $A$ and $B$, i.e., $A \cap B =$&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

\[\begin{aligned}
    S \cap C = \{\}
\end{aligned}\]

&lt;h1 id=&quot;more-about-sets&quot;&gt;More About Sets&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Definition 4 (Countability).&lt;/strong&gt; A set $X$ is called countable (or
denumerable) in case $X \precsim w$ and countably infinite in case
$X \sim w$.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Definition 5.&lt;/strong&gt; If $X$ and $Y$ are sets such that $X$ is equivalent
to a subset of $Y$, we say $Y$ dominates $X$ or \(X \precsim Y\)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Remark 3.&lt;/strong&gt; Strong domination vs weak domination&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Sun, 07 Dec 2025 19:00:00 +0000</pubDate>
        <link>/courses/self-study/mathematics/foundations/2025/12/07/set-theory-1.html</link>
        <guid isPermaLink="true">/courses/self-study/mathematics/foundations/2025/12/07/set-theory-1.html</guid>
        
        
        <category>courses</category>
        
        <category>self-study</category>
        
        <category>mathematics</category>
        
        <category>foundations</category>
        
      </item>
    
      <item>
        <title>PhD Defended</title>
        <description>&lt;p&gt;Today I defended my PhD thesis in front of four French jury members in
Strasbourg. My presentation took $\sim$45 minutes, and
then the back-and-forth Q&amp;amp;A with the jury members took
$\sim$60 minutes. Examiners and other jury members
asked good and relevant questions, some of which were very on point. I
felt like they were genuinely interested in my research work and what I
was about to say to answer their questions. I was very happy when I
observed this from the beginning of the Q&amp;amp;A part. They also seemed to
like my responses and, I guess, my way of thinking through problems,
which was good to hear, too. We seemed to disagree on a couple of things
with one jury member, but we both acknowledged that either of us could
be wrong. I didn’t know what to expect when I started my presentation,
but then I felt like the work and everything else were appreciated by
the jury. At the end of the defense, they discussed internally whether
or not I deserve to get a PhD and then decided to declare me a PhD
holder. I felt like the process went very smoothly and very well in
general. I got my PhD degree in AI. People cheered, I received some nice
gifts, then I left the lab to digest the things a little bit and have
some fun with some of my fellow PhD students in Strasbourg.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;My PhD Thesis: &lt;a target=&quot;_blank&quot; href=&quot;https://drive.google.com/file/d/1y50fqGA3UeJdahZq4IVDfrb4A3uDx-fG/view?usp=share_link&quot;&gt;&lt;i&gt;Scaling Intelligence: A Formal and Practical Framework for Computationally Unbounded AI&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://drive.google.com/file/d/1hFb1uohubKAOpnVGRoJFlsKL6tAZb90p/view?usp=share_link&quot;&gt;My PhD Defense Presentation&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;figure style=&quot;text-align:center;&quot;&gt;
    &lt;img style=&quot;margin:auto;&quot; src=&quot;/assets/images/phd-defense-2025.jpg&quot; alt=&quot;Me in my PhD defense (28.11.2025)&quot; /&gt;
    &lt;figcaption&gt;Me in my PhD defense. 28.11.2025&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;At the final moments of the jury’s congratulations and others’ cheerings
for me for getting a PhD, something struck me lightly. I internally had
this very weird feeling about things. The whole thing seemed unreal
because many fragments from the past 3 years of my PhD were playing in
front of my eyes, and I couldn’t believe how, after this many years of
“struggle”, without anyone truly rooting for you, except very few
people, could end like this… people saying the nicest things and
congratulating you for what you have done silently for the past 3 years.
One of the people who supported me during this process was my director,
Anne Jeannin-Girardon. My mother’s support meant a lot, too. I am
thankful for this.&lt;/p&gt;

&lt;p&gt;It is not really about having a PhD degree or becoming a doctor… Well,
the world has made it this way, but keep an open mind, folks! We are who
we are when there is no one in the audience watching us.&lt;/p&gt;
</description>
        <pubDate>Fri, 28 Nov 2025 11:00:00 +0000</pubDate>
        <link>/blog/phd/academia/ai/2025/11/28/phd-defense-fr.html</link>
        <guid isPermaLink="true">/blog/phd/academia/ai/2025/11/28/phd-defense-fr.html</guid>
        
        
        <category>blog</category>
        
        <category>PhD</category>
        
        <category>academia</category>
        
        <category>AI</category>
        
      </item>
    
  </channel>
</rss>
