How can we describe conditional statements in software and hardware? This lecture introduces you to 1
simple implementations of conditional statements in software and hardware. 2
A conditional statement has two parts: hypothesis and conclusion. If the hypothesis is correct, then 3
the conclusion will occur. 4
In a software program, usually, an if-then structure is used to describe a condition. An if-then 5
structure usually has two parts: a boolean expression or hypothesis and a block containing a consequence 6
or conclusion. 7
In a general case of the conditional statement, a selection between a consequence and its alternative 8
may happen. 9
If the Boolean expression is true, then the consequence block is selected; 10
otherwise, the alternative part will be chosen. 11
In logic design, a switch can implement the conditional statement. In the simplest form, a select bit 12
controls the switch and the connection between the input and output bits. 13
If the select bit is 0, the input is not connected to the output. Otherwise, the output is the input. 14
In the generalized form, the switch can select between two or more options. 15
For example, if the select bit is zero, the first input is connected to the output, 16
and if it is one the output in the second input. 17
How can we use logic gates to implement conditional statements? To cope with this question, 18
I will explain the concept of a multiplexer and its implementation with logic gates in the next lecture. 19
These are our takeaway messages: Each decision-making process has at least one Hypothesis and one Conclusion. 20
If the hypothesis is correct, then the conclusion will occur. If statements in software and switches 21
in hardware are the building blocks of decision-making processes. 22
Now the quiz question. How can we use the following hardware switches to implement a decision-making process 23
with four options for selection?