Follow us on Twitter!
Don't judge the unknown - Grindordie
Saturday, April 19, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 26
Guests Online: 25
Members Online: 1

Registered Members: 82843
Newest Member: hx47
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 07:38
I am not even sure how to put this but I will try. How does a computer know what the programming language is saying? What programmed the cpu to understand the program language it self? Does that make since? I understand we write programs but how the hell did the program get programed to understand the program. It is difficult to explain. I hope someone understands what I am asking and can explain.

I understand its based on 1's and 0's but how does it understand that....?

Like which came first the chicken or the egg?




Edited by on 20-05-10 07:42
Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 11:17
I'll try simplify some things for you, programming languages are converted to machine language for the computer to understand. The machine language is binary, the 1 has a different value to 0. 0 is off/false/no ect. and 1 is on/true/yes ect.. A small part of code can be compiled into a massive part of binary code, the command given to the machine requires processing, the processor processess the bits of machine code to explain to the systems components what is 1 and 0. I think I have confused myself, I'll shutup now.
Author

RE: simple


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 11:54
The programs you write are,of course,converted to binary code....

The 1's and 0's in binary code are high voltage and low voltage that are passed to the semiconductor circuits(gates).

(its not that simple,today's chips are Integrated circuits(with a lot of V's and L' as prefixes.))

The chips have the circuits printed on them(There are AND,NOT,etc gates in them)

Using such basic logic,one programs a computer,missile,phone,etc...

Of course,in large companies such low level twiddling is done only for research today,the actual circuit design on products is printed by machines.

Read up on semiconductors and chips to know more...I think basics is in grade 12 level(I don't know your grade syllabus) and the topic branches out from there



---------------------------------ALSO---------------------------------
Would people PLEASE stop using the chicken-egg problem???
The CHICKEN came first,the egg it emerged from was the egg of its predecessor in evolution(I don't know if u "believe" in itGrin)


Edited by on 20-05-10 11:56
Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 13:50
That's a good question.
People seem to be answering a different question from what I think you're asking.
Fair enough the cpu is given a bunch of numbers but how does it know what to do with them?

All a CPU has is a bunch of "gates" (like someone described above).
You can say use an AND and a XOR gate to add to binary numbers. A XOR will be one if and only if 1 bit is 1. Therefore it can be our lower bit. And then an AND will be out higher bit.

When an ADD x,y op code comes along another circuit reads it sees ADD (lets just say it's 0A) we give the cpu this as machine code. 0A0101 a circuit see's the 0A (it could just compared it to 1,0 if it fit's the correct order 00001010) now since we have 2bit for each value (we're adding 01+01) we need to set 4 pins on the cpu we set them LOW HIGH LOW HIGH these are connected to the ADD (described above for only 1 bit). This could then output to some LED's

If we also had pins for MUL and DIV and SUB we just made a very basic computer which is a calculator.

Making CPU's isn't only for rich companies. You can get an FPGA for about 30 which is effectively a reprogrammable computer. It has a bunch of "logic cell" which can be made to act as AND SUB whatever. These are programed in hardware description languages like verilog or just by schematics almost like building a circuit in a simulator.
here's an example of verilog.

Code

module adder(clk, a, b, h, l);
// a,b are input's form pins.
input a;
input b;
input clk; //the clock input
// high and low bits for the output.
output h;
output l;

//posedge is the leading edge of the clock pulse
always @(posedge clk);
assign l<=a^b; //XOR a,b goes to low bit
assign h<=a&b; //AND a,b goes to high bit
endmodule




(This isn't actually how you'd do it. verilog provides an + operation :P)
But I wrote that off the top of my head so it probably has a few mistakes, it should make sense anyways. This will be compiled then software will be used to design the circuit called "place and route" this file is transferred to the FPGA.

So a cpu doesn't understand it switch and buttons and highs and lows make stuff happen. Which is mind boggling after you consider what we do with it today.




Edited by on 20-05-10 17:24
Author

RE: odd question

stealth-
Member



Posts: 1003
Location: Eh?
Joined: 10.04.09
Rank:
Mad User
Posted on 20-05-10 16:10
To give a greater understanding of how the languages are turned into machine code, you could say they are "built on top of each other". The compiler, in C code, turns the code into a binary executable (1,0's). Python is interpreted by a C program, and the C program itself has been converted to binary. Really, all programing languages are is a method of functions and syntax designed to make programing less repetitive. They make it less repetitive by building on a lower level language to (for example) make one function in the new language do what might have taken 100 lines in the language it was built on. The higher level you go, the less code your supposed to have to write. Writing what might take one line in python could take a hundred in assembler.

If you were looking for a understanding on how things work at the hardware level, this podcast is actually not bad for teaching you the basics of stuff.

http://www.grc.co. . .itynow.htm

It covers everything from RAM to hardware interrupts, and is a great thing to listen to while gaming or something. They're about an hour to a hour and a half each, but you can skip through most of the crap and cut that number down pretty fast.

You'll want numbers 233, 235, 237, 239, 241, and 247. The rest really aren't that interesting.

Hope I helped somewhere in there Wink


The irony of man's condition is that the deepest need is to be free of the anxiety of death and annihilation; but it is life itself which awakens it, and so we must shrink from being fully alive.
http://www.stealt. . .
http://www.stealth-x.com
Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 17:25
http://xkcd.com/676/

imgs.xkcd.com/comics/abstraction.png
"If I'm such a God, why isn't Maru *my* cat?"


Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-10 18:54
The simple answer is that there are two parts, hardware and software. The more you code in one, the less you code in the other.

In my intro electronics we made a simple LED counter to count from 0-9, and connect all the wires by hand between 2 chips and the LED. That was pretty fun. You might like working out an electronics hobby kit like that one.




Edited by on 21-05-10 07:26
Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-05-10 07:05
Wolf hit the nail on the head. +rep



Author

RE: odd question

fashizzlepop
Member



Posts: 482
Location: Old folks home.
Joined: 08.04.08
Rank:
Moderate
Posted on 21-05-10 07:14
I agree. Good response Wolf. Also, good question.


"The definition of insanity is doing the same thing over and over again and expecting different results.
~Albert Einstein~


csullivan.codeinspire.net/images/boomsig2.png
fashizzlepop@gmail.com http://csullivan.codeinspire.net/
Author

RE: odd question


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-05-10 12:55
Thanks guys =D