Building a Digital Computer

A Simple 8-bits Processor (CPU) Design

All the arithmetic operations of a microprocessor take place in the arithmetic logic unit (ALU). Using a combination of gates and flip-flops, numbers can be added in less than a microsecond, even in small personal computers. The operation to be performed is specified by signals from the control unit. The data upon which operations are performed can come from memory or an external input. The data may be combined in some way with the contents of the accumulator and the results are typically placed in the accumulator. From there they may be transferred to memory or to an output unit.

Introduction

To be, or not to be, that is the question
William Shakespeare [1564-1616]

Modern computers are among the most complex machines ever designed by the human mind. Although adequate electrical components for such a purpose were available 120 years ago, it appears like no one at that time understood or saw any connection between elementary logics, boolean algebra, binary numbers, and the simple act of switching electricity on and off.

George Boole never had the thrill of seeing a Boolean expression realized in switches, wires, and lightbulbs. One obstacle, of course, was that the incandescent lightbulb wasn't inventet until 15 years after Boole's death. But Samuel Morse had demonstrated his telegraph in 1844 - ten years before the publication of Boole's "The Laws of Thought" - and it would be simple to substitute a telegraph sounder for the lightbulb in a simple circuit performing boolean algebra. But nobody in the nineteenth century made the connection between the ANDs and ORs of boolean algebra and the wiring of simple switches in series and in parallel. No mathematician, no electrician, no telegraph operator, nobody - not even Charles Babbage. Instead of gears and levers to perform calculations, his Analytical Engine should have been (better) built using telegraph relays.

Switches, Transistors, and Memory

Switches remembers. Think about it. You flip the switch by the door, and the light in the middle of the ceiling comes on. It stays on. When you leave the room, you flip the switch down again, and the light goes out. It stays out. The switch will remain in the position you last left it until you (or someone else) come back and flip it to its other position.

In a sense, it "remembers" what its last command was until you change it, and "overwrite" that command with a new one. In this sense, a light switch represents a sort of rudimentary memory element.

Light switches are more mechanical than electrical, which does not prevent them from acting as memory; in fact, the very first computer was entirely mechanical. It had lots of little cams that could be flipped by other cams from one position to another. Numbers were encoded and remembered as patterns of cam positions.

Whether a switch is mechanical, electrical, hydraulic, or something else is irrelevant. What counts is that a switch contains a pattern: On or off, up or down, flow or no flow. To that pattern can be assigned a meaning.

In general then, what we call "memory" is an aggregate of switches that will retain a pattern long enough for that pattern to be read and understood by a person or a mechanism. For our purpose, those switches will be electrical, but keep in mind that both mechanical and hydraulic computers have been proposed and built with varying degree of success.

Memory consists of containers for alterable patterns that retain an entered pattern until someone or something alters the pattern.

Transistor Switches

One problem with building a computer memory system of light switches is that light switches are pretty specialized: they require fingers to set them, and their "output" is a current path for electricity. Ideally, a computer memory switch should be operated by the same force it controls to allow the patterns in memory locations to be passed on to other memory locations. In the gross electromechanical world, such a switch is called a relay.

A relay is a switch that is operated by electricity, and also controls electricity. You "flip" a relay by feeding it a pulse of electricity, which powers a little hammer that whaps a lever to one side or another. This lever then opens or closes a set of electrical contacts, just like your garden-variety light switch does. Computers have been made out of relays, although as you might imagine (with a typical relay being the size of an ice cube) they weren't especially powerful computers.

Fully electronic computers are made out of transistor switches. Transistors are tiny crystals of silicon that use the peculiar electrical properties of silicon to act as switches conductors/semiconductors I won't try to explain what those peculiar properties are, since that explanation would take an entire (fat) book unto itself. Let's consider a transistor switch a sort of electrical "black box" and describe it in terms of inputs and outputs.

 Transistor Switch OFF  Transistor Switch ON
The above sketch shows a transistor switch. When an electrical current is fed through the base, current flows between emitter and collector. When the current ceases flowing through the base, current ceases to flow between emitter and collector.

In real life, a tiny handful of other components (typically diodes and capacitors) are necessary to make things work smoothly in a computer memory context. These components are not necessarily little gizmos connected by wires to the outside of the transistor (although in early transistorized computers they were), but are now cut from the same silicon crystal the transistor itself is cut from, and occupy almost no space at all. Taken together, the transistor switch and its support components are called a memory cell. The electrical complexity of the memory cell is hidden within an appropiate black-box symbol.

A memory cell keeps current flow through it to a minimum, because electrical current flow produces heat, and heat is the enemy of electrical components. The memory cell's circuit is arranged so that if you put a tiny voltage on its input pin and a similar voltage on its select pin, a voltage will appear and remain on its output pin. That output voltage will remain in its set state until you take away the voltage from the cell as a whole, or remove the voltage from the input pin while putting a voltage on the select pin.

The "on" voltage being applied to all of these pins is kept at a consistent level (except, of course, when it is removed entirely). Most memory cells operate at a constant 5 volts. The pattern is binary in nature: you either put a voltage on the input pin or you take away the voltage entirely. Likewise, the output pin either holds a fixed voltage or no voltage at all.

We apply a code to that state of affairs: the presence of voltage indicates a binary 1, and the lack of voltage indicates a binary 0. This code is arbitrary. We could as well have said that the lack of voltage indicates a binary 1 and vise versa (and computers have been built this way for obscure reasons) but the choice is up to us. Having the presence of something indicate a binary 1 is more natural, and that is the way things have evolved in the computing mainstream.

A single computer memory cell, such as the transistor-based one we're speaking of here, holds one binary digit, either a 1 or a 0. This is called a bit. A bit is the indivisible atom of information. There is no half-a-bit, and no bit-and-a-half. (This has been tried. It works badly. But that didn't stop it from being tried.)

A bit is a single binary digit, either 1 or 0.

Random Access

One bit doesn't tell us much. To be useful, we need to bring a lot of memory cells together. Transistors started out small and went down from there. In the beginning, one chip held one transistor. In time, the designers crisscrossed the chip into four equal areas, making each area an independent transistor. From there it was an easy jump to adding the other minuscule components needed to turn a transistor into a computer memory cell. These chips are called RAM chips, because they contain random access memory.

Newcomers sometimes find this a perplexing and disturbing word, because random often connotes chaos or unpredictability. What the word really means is at random, meaning you can reach into a megabit memory chip and pick out any of those million-plus bits without disturbing any of the others, just as you might select one book at random from a library's many shelves of thousands of books without sifting through them in order.

Random access works like this: Inside the chip, each bit is stored in its own memory cell, identical to the memory cell diagrammed in the previous sketch. Each of the however-many memory cells has a unique number. This number is a cell's (and hence a bit's) address.

 RAM chip

Each chip has a number of pins coming out of it. The bulk of these pins are called address pins. One pin is called a data pin. (See the above sketch.) The address pins are electrical leads that carry a binary address code. Your address is a binary number, expressed in 1s and 0s only. You apply this address to the address pins by encoding a binary 1 as five volts and a binary 0 as zero volts. Special circuits inside the RAM chip decode this address to one of the select inputs of the numerous memory cells inside the chip. For any given address applied to the address pins, only one select input will be raised to five volts, thereby selecting that cell.

Depending on whether you intend to read a bit or write a bit, the data pin is switched between the memory cell's input or output, as shown above. But that's all done internally to the chip. Once you've applied the address to the address pins, the data pin will contain a voltage representing the value of the bit you requested. If that bit contained a binary 1, the data pin will contain a 5 volt signal; otherwise, the binary 0 bit will be represented by 0 volts.

Bytes

Our memory system must store our information. How we organize a memory system out of a hatful of memory chips will be dictated largely by how we organize our information. From a functional perspective, memory is measured in bytes. A byte is eight bits.

A bit is a single binary digit, 0 or 1. A byte is eight bits side-by-side.

Computers were designed to store and manipulate human information. The basic elements of human discourse are built from a set of symbols consisting of letters of the alphabet (two of each for upper- and lowercase), numbers, and symbols like commas, colons, periods, and exclamation marks. Add to these the various international variations on letters like æ and ø plus the more arcane mathematical symbols, and you'll find that human information requires a symbol set of well over 200 symbols (Ref.: ASCII table).

Bytes are central to the scheme because one symbol out of that symbol set can be neatly expressed in one byte. A byte is eight bits, and 28 is 256. This means that a binary number eight bits in size can be one of 256 different values, numbered from 0 to 255. Because we use these symbols, most of what we do in computer programs is done in byte-sized chunks.

Every byte of memory in the computer has its own unique address, even in computers that process two bytes, or even four bytes, of information at a time.

Talking to Memory

The CPU chip's most important job is to communicate with the computer's memory system. Like the pins of memory chips, the CPU's pins transfer information encoded as voltage levels. Five volts indicate a binary 1, and zero volts indicate a binary 0.

 Memory Bank
Each boxs is a chip like that shown in the previous sketch. Each of eight chips contains 1,048,576 bits. The eight chips taken together contain 1,048,576 bytes, with each contributing one bit to every byte. Bytes of data may be written to and read from the eight data lines shown here.

Like the memory chips (in a memory bank), the CPU chip has a number of pins devoted to memory addresses, and these pins are connected directly to the computer's banks of memory chips. When the CPU desires to read a byte from memory, it places the memory address of the byte to be read on its address pins, encoded as a binary number. A split second later, the byte appears (also as a binary number) on the data pins of the memory chips. The CPU chip also has data pins, and it slurps up the byte presented by the memory chips through its own data pins.

 CPU and Memory

The process, of course, also works in reverse: to write a byte into memory, the CPU first places the memory address where it wants to write onto its address pins. A split second later, it places the byte it wishes to write into memory on its data pins. The memory chips obediently store the byte inside themselves at the requested address.

The Data Bus

This give-and-take between the CPU and the memory system represents the bulk of what happens inside your computer. Information flows from memory into the CPU and back again. Information flows in other paths as well. Your computer contains additional devices called peripherals that are either sources or destinations (or both) for information.

Like the CPU and memory, these peripherals are all ultimately electrical devices, having both address pins and data pins. Peripherals "talk" to the CPU (i.e., pass the CPU data or take data from the CPU) and sometimes to one another. These conversations take place across the electrical connections, linking the address pins and data pins that all devices in the computer have in common. These electrical lines are called a data bus, and form a sort of party line linking the CPU with all other parts of the computer. There is an elaborate system of electrical arbitration that determines when and in what order the different devices can use this party line to talk with one another. But it happens the same way: an address is placed on the bus, followed by a byte (or word or double word) of data. Special signals go out on the bus with the address to indicate whether the address is of a location in memory, or of one of the peripherals attached to the data bus. The address of a peripheral is called an I/O address to differentiate between it and a memory address.

The data bus is the major element in the expansion slots present in most PC-type computers, and most peripherals are boards that plug into these slots. The peripherals talk to the CPU and memory through the data bus connections brought out as electrical pins in the expansion slots.

Registers

Every CPU contains very few data storage cubbyholes called registers. When the CPU needs a place to tuck something away for awhile, an empty register is just the place. The CPU could always store data out in memory, but that takes a lot of time. Because the registers are actually inside the CPU, placing data in a register or reading back again is fast.

But more important, registers are the processor's workbench. When the CPU needs to add two numbers, the easiest and fastest way is to place the numbers in two registers and add the two registers together. The sum (in usual CPU practice) replaces one of the two original numbers that were added, but after that, the sum could then be placed in yet another register, or added to another number in another register, or stored out in memory, or any of a multitude of other operations.

The CPU's immediate work-in-progress is held in temporary storage containers called registers.

Work involving registers is always fast, because the registers are within the CPU and very little movement of data is necessary.

Like memory cells, and indeed, like the entire CPU, registers are made out of transistors. But rather than having numeric addresses, registers have names like AX or DI. To make matters even more complicated, while all CPU registers have certain common properties, most registers have unique special powers not shared by other registers.

Machine Instructions

Continuous, furious communication along the data bus between CPU, memory, and peripherals is what accomplishes the work that the computer does. The question then arises: who tells the processor and the rest of the machine what to do? You do. How do you do that? You write a program. Where is the program? It's in memory, along with all the rest of the data stored in memory. In fact, the program is data, and that is the heart of the whole idea of programming as we know it.

Finally, we come to the essence of computing: the nature of programs and how they direct the CPU to control the computer.

We've seen how memory can be used to store bytes of information. These bytes are all binary codes, patterns of 1s and 0s stored as minute electrical voltage levels and making up binary numbers. We've also spoken of symbols, and how certain binary codes may be interpreted as meaning something to us human beings, things like letters, digits, punctuation, and so on.

Just as the ASCII table contains a set of codes and symbols that mean something to us, there is a set of codes that mean something to the CPU. These codes are called machine instructions, and their name is evocative of what they actually are, instructions to the CPU.

Putting it all together...

"I don't recommend that anybody but total crazies wirewrap their own machines out of loose chips anymore, although it was a common enough thing to do in the mid- to late Seventies".
Jeff Duntemann

Addition

A Binary Adding Machine will do SUMS and CARRIES separately... to do this we need a circuit that perform these operations. The Sum of two binary numbers is given by the output of an XOR gate, and the Carry Bit is given by the output of an AND gate. So, let us combine an AND gate and an XOR gate to add two binary digits called A and B:

 Half Adder  Half Adder

We can use the HALF ADDER only for the addition of the rightmost column of binary digits... like 1 + 1 = 0, Carry = 1

   1111
 + 1111
  -----
  11110

For the second column from the right we see that we have to add three binary digits because of the carry, and that goes for all subsequent columns as well. Therefore, to handle three digits (the two digits plus the carry bit) we need two of the HALF ADDERS plus a single OR gate configured in the following manner:

 Full Adder  Full Adder

The following table summarizes all possible combinations of Inputs to the FULL ADDER and the resultant Outputs:

FULL ADDER Input/Output Combinations
A in B in CARRY in SUM out CARRY out
0 0 0 0 0
0 1 0 1 0
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 1

The first column, i.e. the least significant bits (LSB), does not include a Carry Bit, which is why the Carry Input to the Full Adder is connected to ground.

 Full Adder, LSB

For the next two digits and the next lightbulb you use a Full Adder wired this way:

 Full Adder

The Carry Output from the first Full Adder is an Input to the second Full Adder. Each subsequent column of digits is wired the same way. Each Carry Output from one column is a Carry Input to the next column. Finally the eighth and last pair of switches, i.e. the most significant bits (MSB), are wired to the last Full Adder like this:

 Full Adder, MSB

As you can see (in the sketch above), the final Carry Output goes to the ninth lightbulb used to indicate an OVERFLOW...

 8-Bit Adder  2 ea. 8-Bit Adders

The Total Speed of the Adder is equal to the Number of Bits times the Speed of the Full Adder Component. This is called a Ripple Carry. Faster Adders use additional circuitry called a Look-Ahead Carry that speeds up this process.

Subtraction

The One's Complement is equivalent to inverting bits... The new 'Control Panel' for Adding and Subtracting two 8-bit numbers is just slightly modified. It includes an extra switch to indicate whether we want to ADD or SUBTRACT (i.e. you turn this switch OFF for Addition and ON for Subtraction). Please note that only the rightmost eight lightbulbs are used to display results. The ninth lightbulb is now labeled OVERFLOW / UNDERFLOW, which indicates that a number is being calculated that cannot be represented by the eight lightbulbs.

The major addition to the Binary Adding Machine is some circuitry that calculates a One's Complement of an 8-Bit Number (i.e. inverting the bits).

 8-Bit Inverter

However, the circuitry above will always invert the bits that is entered. The circuitry needs to invert the bits only if a subtraction is being performed.

 8-Bit Conditional Inverter  XOR Truth Table

A single signal labeled INVERT is input to each of the eight XOR (Exclusive OR) gates. So, if the Invert Signal is 0 (zero), the eight Outputs of the XOR gates are the same as the eight Inputs. If the Invert Signal is 1 (one), the eight Input Signals are inverted. Let's package these eight XOR gates in a box labeled 'One's Complement':

 One's Complement  8-Bit Add / Subtract

Notice the three signals labeled SUB, this is the ADD/SUBTRACT Switch. This signal is 0 (zero) if an Addition is to be performed and 1 (one) if a Subtraction is to be performed. For a Subtraction, the B Inputs (the second row of switches) are all inverted by the One's Complement Circuit before entering the Adder. Also for Subtraction, you add 1 (one) to the result of the addition by setting the CI (carry in) Input of the Adder to 1 (one). For an Addition, the One's Complement Circuit has no effect and the CI Input is 0 (zero).

The SUB Signal and the CO (carry out) Output of the Adder also go into an XOR gate that is used to light up the OVERFLOW / UNDERFLOW Lamp. If the SUB Signal is 0 (zero, which means an addition is being performed), the lightbulb will be lit if the CO Output of the Adder is 1 (one). This means that the result of the addition is greater than 255 (the maximum value of one byte, i.e. with all 8 bits set).

If a Subtraction is being performed and if the SUBTRAHEND (the B switches) is less than the MINUEND (the A switches), it is normal that the CO Output from the Adder is 1 (one). This represents the 1 0000 0000 that must be subtracted in the final step (relax, we'll get back to this in a little while...).

So the OVERFLOW / UNDERFLOW Lamp is lit only if the CO Output from the Adder is 0 (zero). This means that the SUBTRAHEND is greater than the MINUEND and the result is negative. Please note that the machine shown is not designed to display negative numbers.

 Adding/Subtracting Machine

The sketch above shows the user interface (control panel) of an 8-bit Adding/Subtracting Machine.

Flip Flop Circuits

A Flip Flop circuit retains information, it "remembers". Imagine trying to count if you couldn't remember anything. You wouldn't know what number you were up to and what number comes next.

Let us look at the NOR gate again. The output of a NOR gate is 1 only if both inputs are 0. Here is a circuit with two NOR gates, two switches, and a lightbulb:

 RS [reset-set] Flip Flop

Notice the oddly contoured wiring: The output of the NOR gate on the left is an input to the NOR gate on the right, and the output of the right NOR gate is an input to the left NOR gate. This is a type of feedback. Indeed, just like an oscillator, an output circles back to become an input.

 RS [reset-set] Flip Flop

At the outset, the only current flowing in this circuit is from the output of the left NOR gate. That's because both inputs to that gate are 0. Now close the upper switch. The output from the left NOR gate becomes 0, which means the output from the right NOR gate becomes 1 and the lightbulb goes on.

 RS [reset-set] Flip Flop

The magic occurs when you now open the upper switch. Because the output of a NOR gate is 0 if either input is 1, the output of the left NOR gate remains the same and the light remains lit.

NOTE: At this point you can close and open that upper switch as much as you like... the light remains lit. That switch has no further effect on the circuit because the output of the left NOR gate remains 0.

 RS [reset-set] Flip Flop

Now close the lower switch. Because one of the inputs to the right NOR gate is now 1, the output becomes 0 and the lightbulb goes out. The output of the left NOR gate becomes 1.

 RS [reset-set] Flip Flop

Now you can open the bottom switch and the lightbulb stays off. We're back where we started. At this time, you can close and open the bottom switch with no further effect on the lightbulb.

In summary, this circuit has two stable states when both switches are open.

Before we continue, let me draw the RS flip flop circuit a little different to look like this:

 RS [reset-set] Flip Flop

The output that we used for the lightbulb is called Q. In addition, there's a second output called Q that's the opposite (inverse) of Q. If Q = 0 then Q = 1 (and vice versa). The two inputs are called S for "set" and R for "reset" (i.e. set Q to 1 / reset Q to 0).

When both inputs are 0 (zero), the output indicates whether Q was last set or reset.

These results are summed up in the following truth table:

RS FLIP FLOP Input/Output Combinations
S R Q Q
1010
0101
00Q Q
11DisallowedDisallowed

Please note that when S and R are both 0 (zero):

NOTE: The final row (of table) indicates an illegal situation.

So, when you're designing circuitry that uses R-S Flip Flops avoid situations in which the S and R inputs are both 1.

The R-S Flip Flop is certainly interesting as a first example of a circuit that seems to "remember" which of the two inputs was last a voltage, i.e. 1.

What turns out to be much more useful, however is a circuit that remembers whether a particular signal was 0 or 1 at a particular point in time.

We want something that has the following function table:

Inputs Outputs
Data'hold that bit'Q
010
111
00Q
10Q

In the first two cases, when the 'hold that bit' signal is 1, the output Q is the same as the Data input. In the second two cases, when the 'hold that bit' signal is 0, the Q output is the same as it was before.

Notice in the second two cases that when the 'hold that bit' signal is 0, the Q output is the same regardless of what the Data input is.

The function table can be simplified like this:

Inputs Outputs
Data'hold that bit'Q
010
111
X0Q

The X means 'do not care'. It doesn't matter what the Data input is because if the 'hold that bit' input signal is zero, the output Q is the same as it was before.

Implementing a 'hold that bit' signal based on our existing R-S Flip Flop requires that we add 2 (two) AND gates at the input end.

Only when the 'hold that bit' input signal is 1 will this circuit function the same way as the normal R-S Flip Flop shown earlier.

We want only two inputs, not three. Remember, the case in which SET and RESET were both 1 is illegal. So we want to avoid that. And it doesn't make much sense for the SET and RESET signals to now both be 0 (zero> because that is simply the case in which the output didn't change.

We can accomplish the same thing in this circuit by setting the 'hold that bit' to 0 (zero). So it makes sense that if SET = 1 then RESET = 0, and else if SET = 0 then RESET = 1.

A signal called DATA can be equivalent to a SET, and the DATA signal inverted can be the RESET signal.

The following sketch shows a Level Triggered D-Type Flip Flop (or Latch). The 'D' stands for Data, and the thing is actually a 1-bit memory.

As long as the 'hold that bit' is 0, the DATA input has no effect on the circuit, but when the 'hold that bit' is 1, the circuit reflects the value of the DATA input.

For now, the 'hold that bit', i.e. the CLOCK input simply indicates when the DATA input is to be saved.

Inputs Outputs
DCLKQ
010
111
X0!Q

Saving a multi bit value in Latches

Let's assemble eight Latches in a box. Each of the eight Latches uses two NOR gates and two AND gates and one INVERTER as shown previously. The CLOCK inputs are all connected.

This Latch is capable of saving eight bits at once. The CLOCK signal is normally 0 (zero). When the CLOCK signal is 1, the 8-bit value on the D inputs is transferred to the Q outputs. When the CLOCK signal goes back to 0 (zero), that 8-bit value stays there until the next time the CLOCK signal is 1.

Normally (ignoring what we did with subtraction awhile ago), the eight A inputs and eight B inputs are connected to switches, the CI (Carry In) input is connected to ground, and the eight S (Sum) outputs and CO (Carry Out) are connected to lightbulbs. In this revised version, the eight S outputs of the 8-bit Adder can be connected to both the lightbulbs and the D inputs of the 8-bit Latch. A switch labeled SAVE can be the CLOCK input of the Latches to save a result from the Adder.

The box labeled 2-Line-to-1-Line Selector lets you choose with a switch whether you want the B inputs to the Adder to come from the Second Row of Switches or from the Q outputs of the Latches.

You close the switch to select the outputs from the 8-bit Latch.

The 2-to-1 Selector uses eight of the following circuits:

If the SELECT input is 1, the output of the OR gate is the same as the B input. That is because the output of the top AND gate is the same as the B input, and the output of the bottom AND gate is 0 (zero). Similarly, if the SELECT input is 0 (zero), the output is the same as the A input.

Inputs Outputs
SELECTABQ
00X0
01X1
1X00
1X11

The box shown in the revised Adding Machine comprises eight of these 1-bit Selectors. All of the SELECT inputs are wired together.

Please note that the revised Adding Machine isn't handling the Carry Out signal very well. If the addition of two numbers causes the Carry Out signal to be 1, the signal is ignored when the next number is added in. This will be solved later. Right now, a more interesting approach to the Adding Machine is to eliminate an entire row of eight switches. But first we need to modify the D-type Flip Flop slightly by adding an OR gate and an input signal called CLEAR. The CLEAR input is normally 0. But when it's 1, the Q output becomes 0, as shown here:

This CLEAR signal forces Q to be 0 (zero) regardless of the other input signals, in effect clearing the flip flop.

If you wanted to add up a long list of numbers with this modified 8-bit Latch installed, you would have to begin by pressing the CLEAR switch. That action causes the output of the Latches to be 0 (zero), turning off all the lights and also setting the second set of inputs to the 8-bit Adder to all 0 (zero). You key in the first number and press the ADD button. That number appears on the lights. You then key in the second number and again press the ADD button. The number set up by the switches is added to the previous total, and it appears on the lights. Just continue keying in more numbers and press the ADD button.

Level Triggering

This means that the CLOCK input must change it's level from 0 to 1 in order for the value of the DATA input to be stored in the Latch. But during that time that the CLOCK input is 1, the DATA input can change.

Any changes in the DATA input while the CLOCK input is 1 will be reflected in the values of the Q and !Q outputs.

For some applications, a Level-Triggered Clock input is quite sufficient. But for other applications an Edge-Triggered Clock input is preferred.

Edge Triggering

An Edge Trigger causes the output to change only when the CLOCK makes a transition from 0 (zero> to 1 (one). The difference in an Edge-Triggered Flip Flop is that changes to the DATA input also don't affect the outputs when the CLOCK input is 1.

The DATA input affects the outputs only at the instant that the CLOCK changes from 0 to 1.

An Edge-Triggered D-Type Flip Flop is constructed from two stages of R-S Flip Flops wired together this way:

The idea here is that the CLOCK input controls both the first stage and the second stage. But notice that the CLOCK is INVERTED in the first stage. This means that the first works exactly like a D-Type Flip Flop except that the DATA input is stored when the CLOCK is 0. The outputs of the second stage are inputs to the first stage, and these are saved when the CLOCK is 1. The overall result is that the DATA input is saved when the CLOCK changes from 0 to 1.

The function table of the Edge-Triggered D-Type Flip Flop requires a new symbol, which is an arrow pointing up '^'. This symbol indicates a signal making a transition from a 0 (zero) to 1 (one):

Inputs Outputs
DCLKQ!Q
0^01
1^10
X0Q!Q

The arrow '^' indicates that the output Q becomes the same as the DATA input when the CLOCK makes a transition from 0 to 1. This is known as a positive transition of the CLOCK signal. [A negative transition is the transition from 1 to 0.]

The Flip Flop has a diagram like this:

The little angle bracket at the CLOCK input pin indicates that the Flip Flop is edge-triggered.

Here is a circuit using the Edge-Triggered D-Type Flip Flop that can't be duplicated with the Level-Triggered version.

Let's connect the output from an oscillator (alternating between 0 and 1) to the CLOCK input of the Edge-Triggered D-Type Flip Flop.

The output of the Flip Flop is itself an input to the Flip Flop.

Let us assume that the oscillator is "slower" than the gate response in the Flip Flop (to avoid problems).

To see what happens in this circuit, let's look at a function table that illustrates the various changes:

At the start, let's say that the CLOCK input is 0 and the Q output is 0. That means that the !Q output is 1, which is connected to the D input.
Inputs Outputs
DCLKQ!Q
1001

When the CLOCK input changes from 0 to 1, the Q output will become the same as the D input.
Inputs Outputs
DCLKQ!Q
1001
1^10

But because the !Q output
Inputs Outputs
DCLKQ!Q
1001
1^10
0110

Inputs Outputs
DCLKQ!Q
1001
1^10
0110
0010

Inputs Outputs
DCLKQ!Q
1001
1^10
0110
0010
0^01

Inputs Outputs
DCLKQ!Q
1001
1^10
0110
0010
0^01
1101


work in progress, to be continued...

Bibliographic Appendix:

A Minimal TTL Processor for Architecture Exploration
   1994 
   by Bradford J. Rodriguez
   From the Proceedings of the 1994 ACM Symposium on Applied Computing.
   McMaster University
   [or if otherwise not found, check here...]

Assembly Language: Step-by-Step
   1992 
   by Jeff Duntemann 
   ISBN 0-471-57814-2
   John Wiley & Sons, Inc.

CODE: The Hidden Language of Computer Hardware and Software
   1999 
   by Charles Petzold 
   ISBN 0-7356-0505-X
   Microsoft Press

Compilers and Compiler Generators
   1996 
   by P.D. Terry 
   Rhodes University,
   Grahamstown, South Africa.

Build The COSMAC ELF: A Low-Cost Experimenter's Microcomputer
   1976
   by Joseph Weisbecker 
   Popular Electronics

Related Internet Links:

http://www.linux.com/howto/CPU-Design-HOWTO.html
CPU is the "brain" of computer and is a very vital component of computer system and is like a "cousin brother" of operating system (Linux or Unix). This document helps companies, businesses, universities and research institutes to design, build and manufacture CPUs. Also the information will be useful for university students of U.S.A and Canada who are studying computer science/engineering. The document has URL links which helps students understand how a CPU is designed and manufactured. Perhaps in near future there will be a GNU/GPLed CPU running Linux, Unix, Microsoft Windows, Apple Mac and BeOS operating systems.

http://www.cse.ucsc.edu/research/hsnlab/projects/CPUkit.html
The CPU Design Kit is a prototyping platform designed at UCSC for teaching the Processor Design (CMPE 124) class. The prototyping platform allows the design and implementation of a 32-bit pipelined CPU similar to the example machine DLX described in the book "Computer Architecture: A Quantitative Approach" by Hennessy and Patterson.

http://www.embedded.com/1999/9903/9903bits.htm
Any embedded programmer with even a passing familiarity with the PC business might have reason to despair. Computers were once a rich, thriving, vital, and exciting industry ripe with alternatives and possibilities, advances and innovations. Now it seems the computer industry has degenerated into a repackaging exercise for Intel (or AMD, or Cyrix) processors. One by one, Clipper, MIPS, PA-RISC, Alpha, and other once-mighty processors have faded from the scene, replaced by the ubiquitous Pentium II and its descendants. Don’t microprocessors matter anymore?

http://www.f-cpu.org/ and http://f-cpu.tux.org/
Newcomers are often troubled that there is no precise definition but here's a rough idea. It is a group of people who speak about CPU design and reinvent the world and the wheel on a mailing list. It is also (and it's certainly more interesting) the first purely SIMD superpipelined 64-bit RISC CPU, and the sources (or what can be considered as the beginning) are distributed under the terms of the GNU licence (supplemented by a charter). You can compare it with a "Bourbaki" group for computers, or the "Linux of the CPU world", it's a strange mix of utopia, realism and creativity. But most of all : the F-CPU is what you make with it, it's nobody's and everybody's CPU.

http://home.hccnet.nl/g.baltissen/pod6502.htm
POD6502, A project to build your own 6502 using only common available TTL-IC's.

http://www.jetnet.ab.ca/users/bfranchuk/
Open Source 12/24 bit Octal Controllers. Computers in the style of the 70's with the 90's parts.

http://surfin.spies.com/~dgc/pdp8x/
The PDP-8/X is a reimplementation of the PDP-8/I, with 32K words of memory (all the memory you can put on a PDP-8/I), an extended memory control, an interface to an RS-232 terminal, and an interface to an IDE disk, which I built just for fun.

http://www.hanssummers.com/index.htm
The Great Z80 Computer project was originally started way back when I was 13 or so, must have been about 1984 or thereabouts. Like many of my projects, an article in an electronics magasine inspired the project. What tends to happen is that I read an article, understand something of how their circuit works, in this case how to build a Z80 computer, then my imagination gets carried away with how I might design my own. I probably bit off more than I could chew at this point... I did build some stuff and had an LED connected to the HALT light and a 8-way DIL switch on the bus. I reckoned if I gave it the HALT instruction I could get the LED to light, and indeed it did, but that's about as far as it went. Shortly after I started work on my Sidereal Clock project, which was probably a less ambitious way of learning some digital electronics (although still a hefty project!). I hadn't even finished the sidereal clock before I started the Z80 project though. Tragically the boards are lost so I have no photographs, but I have all the circuit diagrams and will explain a bit about how it all worked, and tell the story of this long and hard struggle!

http://www.his.com/~jlewczyk/adavie/mark8b.html
This shrine to the Mark 8 Minicomputer discusses the machine with its designer, Jon Titus. Jon was gracious enough to write up most of the data you see here, and also provide some of the diagrams and pictures. Jon is happy to discuss the machine with you, but please look for your answer here, first!

http://koo.corpus.cam.ac.uk/chaos/
The (chaos) computer described on these pages was started in 1977 with the gift of a Signetics 2650 microprocessor by Mullard. Attempts during the previous year to order an Intel 8008 and a 2650 from Farnell had all proved impossible, and this 2650 processor was finally obtained after my father drafted me a letter which I sent to the Managing Director of Mullard. The 2650 was an 8 bit processor with 32Kbyte address range and 256 I/O locations. It has 7 general purpose registers and an on-chip return address stack for subroutines with 8 entries. It was not possible to access this stack or flush it to memory.

http://members.iinet.net.au/~daveb/simplex/simplex.html
It all began in 1968, when I was at University in Bangor, N. Wales. The entire campus possessed just two machines (Elliott 803 and Elliott 4130), each of which filled a large room. Students punched their own programs (usually in Algol) on cards or 5-track paper tape, and submitted them to the operators. This whetted my appetite for computing. When I left University, I lost access to a computer, and gradually developed the idea of building my own. There was a free-floating community of computer experimenters in the UK at that time. We made do with what could be found, and no two people's machines bore the least likeness to each other. Designs invariably were conditioned by what hardware we could lay our hands on. In those days, even basic 7400 logic parts were almost unobtainable by amateurs in the UK. DRAMs and EPROMs did not exist.

http://home.freeuk.net/c.ward/6502/index.html
These pages describe a simple home-made computer based on the 8-bit 6502 microprocessor. The project was intended to fill the summer holiday between the end of my BSc and the start of my MSc, but it's still keeping me occupied over a year since I started.
I got the crazy idea of designing and building a computer from scratch after taking a course entitled 'Low Level Architecture and Programming' at UEA while I was studying, funnily enough, for a BSc in Chemistry. Once you know about address and data lines, address decoding, R/W and CS signals, and a bit of discrete logic, you begin to think that maybe computers aren't all that complicated after all.
And so, after a quick flick through the Maplin catalogue, I was convinced (falsely, as I later discovered) that a basic computer would be quite simple and cheap to make. The idea of switching on a computer and seeing the message 'Chris-64 Mk1 - Ready' (or something like that) is quite exciting. This would be a completely unique and personalised computer.
If you're also interested in this sort of project, then hopefully this site should save you a certain amount of time and money. You can build a copy of my computer from the schematics, or just use some of the ideas and techniques for your own design.

http://www.epanorama.net/links/project_pc.html
PC Hardware Project Page

http://www.technology.niagarac.on.ca/courses/comp630/homebrew.htm
This file contains frequently asked questions (FAQ) and general information pertaining to the newsgroup alt.comp.hardware.homebuilt (v.19 Modified 01/18/97). The latest version (?) may also be obtained by sending an e-mail request to Mark Sokos.

EAGLE Light Edition (CadSoft)
This allows anybody who wishes to use EAGLE Light for their private hobby projects to do so. Also students can use this version for any educational projects. It is even ok to use this version in a commercial environment, as long as you just want to evaluate the program. As soon as you start using it for commercial projects, you will have to register it. As an exception to this, board manufacturers may use the Freeware Light Edition to generate production data (e.g. Gerber files) from board files they have received from EAGLE users.

http://www.embedded.com/2000/0009/0009feat1.htm
Despite being a quarter-century old, the 8-bit Z80 and its derivatives continue to be popular with embedded system designers. With two new derivatives emerging within the last year, it's a good time to take a fresh look at the architecture. This article considers the architectural choices from the perspective of an RTOS implementer or user.

http://www.opencores.org/
To group lot of designs under our license and available free tools, to make it easier for the designers to choose between them. Furthermore, to search and define what circuits, cores and software tools are needed and start new sub-projects for them. To build tools, supporting designs and documentation to already existing designs, such as compilers, drivers and external circuits; and to give support for anyone who needs some designs, cores and tools or even documentation.

http://www.chipcenter.com/questlink
To find a datasheet please follow the features presented at their page. Please note that you need to be logged in (registration here) to see a final datasheet. They have more than 200,000 datasheets and the number is growing. Naturally, they can't possibly have all the datasheets in the world, but if you can’t find the datasheet or datasheets you’re looking for, please either go to the manufacturer's Web site, or send an e-mail to the chipcenter guys and hope for the best.