Computer Science 1000 Digital Circuits Digital Information computers store and process information using binary as we’ve seen, binary affords us similar advantages as other representations e.g. we saw how we could add binary numbers, just as we add decimal numbers Binary Representation recall that the way in which information is represented depends on the component for our purposes, the most important point to remember is that there are exactly two states RAM: capacitor charge hard drive: magnetic fields processor: voltages binary numbers: 1 0 logic: true false gate input/outputs: on off your text refers to such a binary system as a PandA representation, where information is made up of states that are Present and Absent PandA from pg. 198 of your text Processing your CPU processes information what does that mean? one possible definition: create a new state (output) from an existing state (input) by state, I am referring to a binary sequence Input 5 120 Processing Output Processing – Example consider our addition example from the previous lecture 1011 +0010 1101 Input (Existing State) Output (New State) Processing – Example what we require is a device that can: 1011 0010 take two binary numbers as input produces their sum as output 1011 0010 1101 Binary Adder in fact, this is (part of) what the arithmetic logic unit (ALU) in your processor does the question is: how? Logic Gates at a very basic level, processors are constructed using gates a logic gate is a very simple device: has a number of inputs produces a single output think of each input as a wire that is either on or off on represents a 1 in binary, or a true in logic off represents a 0 in binary, or a false in logic Logic Gates - Continued the output of a logic gate depends on (and only on) its inputs in other words, for each possible combination of its inputs, there is a specific output we represent this using a truth table the truth table of a gate depends on its type Not Gate one of the simplest gate types also known as an inverter takes one input, and produces a single output symbol: Input Output Not Gate a not-gate simply inverts its input that is if its input wire is on, its output is off if its input wire is off, its output is on 0 1 1 0 hence, the truth table is constructed as follows: Input Output on off off on Truth Table Representation in the interest of space, on and off in truth tables are often represented as 1 and 0 hence, our previous truth would be written as follows: Input Output 0 1 1 0 unless otherwise stated, this will be the representation that we adopt AND Gate an example of a gate with two inputs its output is on only if both of its inputs are on Symbol: otherwise, the output is off Truth Table: A B Output 0 0 0 0 1 0 1 0 0 1 1 1 Truth Table – Multiple Inputs note that our truth table now has four rows one for each possible configuration of inputs suppose we had a gate with three inputs how many rows would that require? A B C 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Output In general, any circuit with n binary inputs will require 2n rows in its truth table. Digital Circuits by themselves, gates are quite limited in what they do there are only so many uses for an AND gate the real power of gates is when we begin to combine them that is, the output of one gate becomes the input to another gate Digital Circuits Example: suppose we have a NOT gate and an AND gate we could connect them in the following configuration notice that we still have two inputs (A,B) and one output the output of the not gate is attached to the first input of the AND gate Digital Circuits Example: what does the truth table of our circuit look like? to determine this, let’s consider each input state individually A B 0 0 0 1 1 0 1 1 Output Digital Circuits Example: when A is 0 and B is 0 0 the output of the not gate is 1 hence, the input to our AND gate is 1 and 0 the output of our AND gate is 0 1 0 0 A B Output 0 0 0 0 1 1 0 1 1 Digital Circuits Example: when A is 0 and B is 1 0 the output of the not gate is 1 hence, the input to our AND gate is 1 and 1 the output of our AND gate is 1 1 1 1 A B Output 0 0 0 0 1 1 1 0 1 1 Digital Circuits Example: when A is 1 and B is 0 1 the output of the not gate is 0 hence, the inputs to our AND gate are 0 and 0 the output of our AND gate is 0 0 0 0 A B Output 0 0 0 0 1 1 1 0 0 1 1 Digital Circuits Example: when A is 1 and B is 1 1 the output of the not gate is 0 hence, the inputs to our AND gate are 0 and 1 the output of our AND gate is 0 0 0 1 A B Output 0 0 0 0 1 1 1 0 0 1 1 0 Digital Circuit previous example demonstrated a digital circuit like logic gates, each digital circuit has: an assembly of logic gates input(s) output(s) a truth table like logic gates, digital circuits can be used in the construction of other circuits output from one circuit connected to another digital circuit Digital Circuit - Rendering circuits are often rendered in an enclosed shape this makes it clear what the inputs and outputs to the system are Digital Circuit - Rendering in fact, if we know the inputs, outputs, and truth table, then we often are not concerned with how the circuit is built becomes a “black box” handy when this circuit is used as part of a larger circuit A B Output 0 0 0 0 1 1 1 0 0 1 1 0 Digital Circuit – Example 2 suppose I rearrange my previous circuit into the following configuration what would the truth table of this circuit be? Digital Circuit – Example 2 Answer (discussed in class): A B Output 0 0 1 0 1 1 1 0 1 1 1 0 Digital Circuit – Solving our circuits so far are reasonably small, and therefore easy and quick to derive truth table step through each individual configuration of the inputs however, as circuits grow, this task becomes more difficult and time consuming Digital Circuit – Solving as a consequence, it is often helpful to label intermediate points in the circuit, and solve for those points explicitly in the truth table usually, these intermediate points are the output from a gate that are being input into another gate consider our previous example let’s label the output of the NOT gate as point C C Digital Circuit – Solving now, when we create our truth table, we will create an “output” column for C as well although this might initially seem like more work, it will ultimately make computing the output easier C A B C 0 0 0 1 1 0 1 1 Output Digital Circuit – Solving compute the values for column C C A B C 0 0 1 0 1 1 1 0 0 1 1 0 Output Digital Circuit – Solving now, compute the values for the output column notice that the output depends only on C and B we need not even consider A the output is 1 if C and B are 1, and 0 otherwise C A B C Output 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 0 OR Gate another common example of a gate with two inputs its output is off only if both of its inputs are off Symbol: otherwise, the output is on notice how this contrasts with and Truth Table: A B Output 0 0 0 0 1 1 1 0 1 1 1 1 Digital Circuit suppose we replace the AND gate in our previous circuit with an OR gate compute the resulting truth table for the output A B Output 0 0 0 1 1 0 1 1 Digital Circuit first, to simplify our computation, let’s add an intermediate point at the NOT gate call it C C will require a column in the truth table A BB COutput Output C 0 00 0 11 1 00 1 11 Digital Circuit now, let’s calculate the values for column C A B C Output C 0 0 1 0 1 1 1 0 0 1 1 0 Digital Circuit now, we can calculate the values for the output based on columns B and C recall our definition for the OR gate – the output is off if both of its inputs are off, and on otherwise A B C Output C 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1