Hardware question

Hi guys I am reading a book on operating systems and have a few questions to ask about hardware,

so a computer consists of countless of logic gates(and,nand,nor,xor gates) and also consists of busses to transport the low and high pulses of electricity,but where do these logic gates sit?

is the ram made up of logic gates? or does the ram just contain transistors that hold each byte?

are the CPU registers made up of logic gates or do they just contain transistors that hold these electrical representations?

and lastly does the data and address bus also contain logic gates?

thanks
gates are really 'circuits' and they are microscopic etchings in your CPU and other chips. Most CPU use nand for almost everything because that circuit is simpler (read, faster). So even if you needed and or not or xor etc, it really uses nands for it most of the time. Or they used to, this may be dated info :)

ram is made up of what are called flip-flop circuits. These are designed to retain data so long as they have power. They don't use logic, per-se, they are just circuits. They don't change the data, they retain it.

cpu registers are a form of memory. I don't recall exactly what format those take, but they are similar to ram (but may not be flip flops, I forget!), just on the same chip instead of off a bus.

a bus is usually a wire. Some busses have front and back end logic, circuitry, and more, but the actual bus proper is a wire (usually, a bunch of wires) between components.

so where do the logic gates come into play? I mean how are they used to store different bit values in memory?

and where abouts are they located?

lets take an example program

1
2
3
4
5
6
7
8
9
10

<#include iostream>

int main(){

 std::cout << "hello world!" << endl;


}


what happens with this simple program how are the bits used in logic gates,it would probably be easier to explain in assembly but I'm still confused as to how the logic gates determine the bit patterns to store things in memory

thanks
Last edited on
bump,sorry I hate bumping lol but I just don't get where the logic gates are actually located and how they change the output(I know how the gates work but I don't know how they are implemented)

thanks
You say you know how gates work, so perhaps you should explain your understanding of how basic gates function.

Do you understand that basic gates are basically transistors that are either conducting voltage or blocking voltage (on or off)?

Do you also understand that a simple microprocessor is made of from tens of thousands to millions of transistors?



kind of,

I know a gate has two inputs and has one output so a nand gate with the inputs of 1 and 1 will be 0 as the output although I suck at boolean algebra I do have a basic understanding of it.

that makes sense so these gates(transistors) are contained in the CPU that would make sense

thanks
the cpu has all kinds of built in stuff. It has an integer multiplication circuit, which might have dozens of gates in it. It has add and either a division or an invert/multiply for division, etc.

The CPU is full of many, many circuits that are made up of 'gates'.

lets talk electricity for a sec..
suppose you had a magic electrical device that took voltage in and cut it in half. Lets do that for all the inputs, in this case, 2 inputs. so if you have 1 and 1 going in, you get 1/2 and 1/2. Now lets say it takes those wires with the reduced voltage and puts them back together so the output has the same current as the original. In the 1/1 input example, that would output 1. in the 1 and 0 or 0/1 input combos, it outputs 1/2, and for 0/0 it puts out 0. Now lets check that voltage, and if its less than 0.9 we will consider it zero, else its 1. This is an awful lot like "and" :)

But and by itself is not terribly interesting. The CPU has blocks of gates that make up complex operations like integer multiply (that is a pretty large one).

there is nothing really special about the gates and circuits. You can implement all of them with a battery, wires, resistors, etc on a breadboard circuit studying setup. The only thing special about the CPU is the circuits are timed and coordinated off a master clock (also do able at a slow rate on a study board) and they are extremely fast (not doable on the breadboard) due to proximity, size, the properties of the materials used, and more.
Last edited on
@OP,

There are gates throughout all parts of a computer. However, the CPU contains the gates that execute the specific logic that corresponds to programs that you write. So, if you write

if ((a == 1) && (b == 5))

The logic gates that do the && are found in the CPU.

RAM (various types), periferals, I/O, etc. all contain gates, too.

It sounds like you might want a class in computer architecture.
Topic archived. No new replies allowed.