Y. C. Lemard COMPUTER SCIENCE - UNIT ONE MODULE 1 - COMPUTER ARCHITECTURE LOGIC ELEMENTS We are engaged in studying how computers handle binary data and instructions at the digital logic level of the machine. Logic gates are digital logic elements which take two input signals and generate one output signal. They are devices which control the passage of pulses thus facilitating logical operations. Logic gates are combined to construct more complicated logic elements which actually perform a function. Thus gates can be used for arithmetic and logical purposes; for control purposes such as selecting operations and devices ( e.g. multiplexing); and for encoding and decoding. The logic elements we will examine are the : o o o o o o flip flop register counter multiplexor (multiplexer) encoder and the decoder The flip flop is a circuit that has two stable states and stores a previously entered value. That makes it ideal for use as a one bit storage element. Flip flops have 2 inputs and 2 outputs and the fundamental flip flop – the Set Reset flip flop (SR flip flop) can be constructed from two cross coupled NAND gates. U1M2 – logic elements 1 Y. C. Lemard State Set Reset Invalid S R Q Q 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 Note The RS flip flop can also be constructed from 2 cross coupled NOR gates. Flip flops can be used as status registers (storing 1 bit), they can be used in multiples to form registers; or they can be cascaded to form counters. A Register is a group of flip flops configured in such a way that they store one word (4 bits, 8 bits, etc) of data i.e. it is a set of flip flops operating as a coherent unit to hold data. Below is a 4 bit parallel register 2 U1M2 – logic elements Y. C. Lemard One common requirement in digital circuits is counting, both forward and backward. Digital clocks and watches are everywhere, timers are found in a range of appliances from microwave ovens to VCRs, and counters for other reasons are found in everything from automobiles to test equipment. A counter is an array of latches/flip flops that increment on a clock pulse i.e. a counter is an electronic circuit that counts when an electronic signal is applied to it. They can also be used to measure time intervals or frequencies. Counters can be asynchronous or synchronous. In a synchronous counter all the flip flops are clocked simultaneously while in an asynchronous counter, the first flip flop is triggered and the others are triggered by the previous one in turn one after the other. Some counters have a feedback element in the circuitry. U1M2 – logic elements 3 Y. C. Lemard Examples of counters are the 74192-decade UP/DOWN counter and the 7493-4 bit binary counter. [ Counters could be viewed as special types of registers that counts events thus generating data instead of simply storing data but do not use this as the definition in an exam] 4 U1M2 – logic elements Y. C. Lemard A multiplexor is a digital circuit with multiple signal inputs, one of which is selected by separate address inputs to be sent to the single output. Multiplexors are data selectors i..e they take multiple input and produce just one of them as output. The multiplexer circuit is typically used to combine two or more digital signals onto a single line, by placing them there at different times. (Technically, this is known as time-division multiplexing.) The telephone network combines multiple audio signals onto a single pair of wires using exactly this technique, and is readily able to separate many telephone conversations so that everyone's voice goes only to the intended recipient. With the growth of the Internet and the World Wide Web, most people have heard about T1 telephone lines. A T1 line can transmit up to 24 individual telephone conversations by multiplexing them in this manner. 8 to 1 multiplexor U1M2 – logic elements 5 Y. C. Lemard 4 to 1 multiplexor A demultiplexor would take one signal and produce the corresponding multiple signal. 6 U1M2 – logic elements Y. C. Lemard Encoding involves the conversion of one signal from a set into a group of signals from another set. The device that does this is called an encoder. One example is a BCD encoder. It takes a decimal value and outputs the binary BCD of that number. A decoder is a device which does the reverse of encoding undoing the encoding so that the original information can be retrieved. The same method used to encode is usually just reversed in order to decode. In digital electronics this would mean that a decoder is a multiple-input, multiple-output logic circuit that converts coded inputs into coded outputs, where the input and output codes are different. e.g. n-to-2n, BCD decoders. U1M2 – logic elements 7 Y. C. Lemard The two basic types of logic are combinational logic and sequential logic. In combinational logic it is possible to tell the output by simply knowing all the inputs. AND, OR, and NOT gates are examples of combinational logic. In sequential logic one has to know not just the inputs but also the state the device was in before in order to to be able to tell the new state. A flip flop is an example of sequential logic. 8 U1M2 – logic elements