Friday 4 November 2011

Made by people

Now we've done some logic of the "Either Adam or Bill is a murderer, and if Bill is a murderer then..... etc" type, we've started doing some stuff about the basic logic that underlies the physical implementations of computers. For example, if you have an AND gate in a circuit then it has two inputs and one output. If both the inputs are true, or 1, which means that they have a small current going through them, then the output is true. Then you can put a NOT gate on it, which just turns a true into a false and vice versa. The two together make a NAND gate, which apparently is the most useful gate -- you can put NAND gates together to form lots of different types of gate.

The thing is that these outputs all vary according to the current input. If you put two NAND gates together in a particular combination you can make a latch, which can be set to true or false and then remains at that value even though both its inputs are set to true as default. This is a way of storing some information -- one latch can store one bit, e.g. one instance of true or false (1 or 0). So suppose you want to store the number 5, which is 101 in binary. That's three bits of information, but to put it into a computer you have to follow the computer's rules about how numbers are stored. On a 64-bit machine an integer is probably stored as 4 bytes, that is 32 bits of information. So you need 32 latches to store it, each of them consisting of four little gates, two AND and two NOT. I have a little USB pen about the size of my thumbnail which has 2Gb of storage. 2Gb is (strictly speaking) 2 x 1,073,741,824 bytes, which is 2,147,483,648 bytes, which is 17,179,869,184 bits, and each of those bits has four gates, making a total of 68,719,476,736 logic gates just on that little thing. I think that's truly amazing.

Of course it's possible I've not got this right because unfortunately our lecturer for this is very softly-spoken and doesn't give the impression of thinking it's amazing at all. I really need to sit down and work through it properly.

No comments:

Post a Comment