# Dive in to the hardware of a computer

1. May 1, 2015

### ncd5883

dear all,
I am not a electronic engineer. i want to understand the basics in which a code written in C language gets
converted to voltage signals inside the flipflop(transistor). basically when i write x=3+4,print x through a C language, what happens inside the hardware? I know the x=3+4 is converted or compiled to 1 and 0 as a text file. how the text file 1 and 0 goes inside as voltage changes. i know i get in to the depth, but someone can throw light.

thanks
ncd

2. May 1, 2015

### phinds

You are basically asking us to inform you of the contents of several full-semester college courses. I'm a speed typist but that's a bit too much even for me.

3. May 2, 2015

4. May 2, 2015

### Jarvis323

You have a cpu clock running that produces a square wave of high and low votage. At each rising edge, the wires coming out of the clock become hot, and voltage travels through the circuitry. In the circuitry are various gates which can either allow current through or not depending on which inputs are hot. For example, you may have a gate in which a signal is let through unless 2/2 input pins are hot. That would be a nand gate, which is well known because nand is logically complete, i.e., you can make any logic circuit with just wires and nand gates.

When you run machine code, the code is in memory, in the form of high or low voltages; It's in the mix of this complex dance of voltages flying through gates and wires. The outputs in the memory, connected to wires, and then to gates, can control which pathways are activated and therefore what the CPU does, as well as what it does it with.

When a number is sent to the ALU, it's represented as a set of high or low voltage wires fed into input pins. Using control signals ( fetched from memory the machine instructions in memory ), you can change which paths these voltages take, for example to multiply two numbers, the control signal activates the paths for multiplication, the signals representing the numbers are routed accordingly, and the output is the resulting high and low voltages on the output pins.

We can build computer hardware much like we build programming languages. Complex computer systems are really made from simple components. We can treat a component as a black box that has a simple well defined behavior and forget about how it works, even though it is actually made up of many other components.

Assembly language is an abstraction of machine code in a form more feasible to work with by human beings. It translates into machine code, which are just ones and zeros ( really high and low voltages in some memory module ). C is a high abstraction of assembly language just like assembly language is an abstraction of machine code.

This is really simplified, and I didn't talk about how memory works or the specifics of the CPU and other components, but it basically summarizes how computers work.

Last edited: May 2, 2015