> Computers | Thanks for visiting! |
|
It's practically easy to implement a nice-looking hardware-rendered graphics world in a computer program by using the latest APIs such as DirectX and OpenGL. Many people are fine with just learning a 3D graphics API functions and using that knowledge to render 3D worlds on the screen of their computers. I'm not sure about you but I'm personally a bit hesitant doing that. Many programmers will state that it is enough to just know C/C++, acknowledging that it is the fastest and more efficient way to program these days, "hey, that's what high-level programming is all about, why re-invent the wheel?", they say. The compilers will do all the dirty work. In my opinion this has nothing to do with reinventing anything and I believe there is just pure joy in knowing how stuff works. In programming world, knowledge is very important and if you believe otherwise you shouldn't be considering seriously doing this in the first place. If you are a serious programmer, in many cases, the low-level computer knowledge can be quite helpful. The tutorials and information presented to you here on this web-site have a goal of exploring the complexity of the machine and they also work well as a self-discovery for myself, as I am still learning these things. No matter how much knowledge you possess, there are always new things to learn and understand. Many of the things presented here come from the self-taught knowledge, so if you are more knowledgeable than me about the many topics presented here, or have more details on the subject, then please send me corrections and/or more information at navesele at gmail dot com
And here is a piece of a C program, as you can see the code is more readable and understandable to the programmer, however it is not as close to the hardware as the Assembly instructions are:
This function draws a pixel on the screen by the way. You can actually decipher some of the equations in this code as it is easier to comprehend. However, the point is, in the end this compiles and builds into 0's and 1s anyway, the level of understanding the code is higher but the level of controlling the real raw speed and performance of the CPU is lower than it is in the Assembly Language which is practically identical to "talking" to the machine. With the modern compiling tools the bridge between these concepts is being shortened, so that there is less need to use the Assembly Language, however it is still a very fundamental thing to know if you are a, should I say, serious programmer. This sums up this short discussion about machine instructions, and back to the history... Back to the history of computer processors As you might recall I was talking about the 8080 processor so we will go from there. The 8080 was an 8-bit processor and worked with 8 bits at a time. Today, this processor is obsolete, however it served as a breakthrough in the CPU world. The 8080 gave birth to a more advanced set of processors. Particularly the 8088 and 8086. These chips were very alike and had the same instruction set. The main difference between them was that the 8088 still worked with 8 bits at a time while the 8086 processor could operate on data containing 16 bits, which is two bytes or a "word" in computer data terms (a "word" data type is two bytes paired together). Consequently Intel has produced microprocessors with ascending advancements based on the 8086 chip architecture. These include: 80286, 80386 and 80486. Further, the Pentium processor (also known as the 80586), Pentium II, Pentium III, and Pentium IV which at this time serves as the current standard in the microprocessing world. Pentium IV The difference in speed and performance between 8088 and Pentium IV is tremendous. What could be done back in the mid-70’s can now be done hundreds of times faster, and in computer time, it’s a really mind-boggling change in performance. The main difference between all of the mentioned models, apart from the performance boost-up, is that every time Intel comes out with a new microprocessor, they always maximize the number of transistors on the chip. The early 8088 processors had only 6,000 transistors, while a Pentium IV chip has 55,000,000 of them. As you can imagine these transistors are very small in size and their size has been decreasing through the years of microprocessor development. The following is an excerpt from the Intel web-site: “Like Intel's processors, the fabrication techniques used to produce them have also evolved considerably during the 25 years since the first 8086 chips were rolled out. In those days, the connections etched into the silicon were about 3 microns wide. Today, Intel's most recent chips have connections that are 90 nanometers in length, and research continues into ever-smaller dimensions”. This is a picture of a modern CPU transistor. I won’t go any further than this into the history of computer processors as we (as programmers, I assume) need to catch up with how they actually work, and not who (and when) built them... Actually I just don't have that much time to explain everything, the KTM tutorials should merely make some fundamental points clear, and direct other programmers onto the right path, then you're basically on your own from there on. However, with all that said I still try to be as detailed as possible in my text, there is a lot of information out there and we're only touchnig the tip of a vastly gigantic iceberg. I also want to point out right now, I don't want the KTM tutorial series have any strong inclination on how the text is structured, there is no particular order in the topics of consequent paragraphs as you might have noticed already, but I try to put things together in an understandable way and explain some fundamental knowledge. However, this is all just general information. The next part (ktm1) is more technical as you will see. So these tutorials pick up after a strange mannerism technique that i've myself just developed -- so... get used to it! I'm going to generalize some concepts now and we will move on to one of the most fundamental comcepts of programming - computer memory. Storage and Memory access So how exactly is anything stored on the CPU chip? This brings us to an explanation of what computer memory is and how it works; actually this is a topic of the next part of the "Know the Machine" series where I explain memory addressing, memory access and more in greater detail, however here I want to write down some memory fundamentals and some hardware specifications. Read this and the following chapter and we will get to understanding memory in greater detail. So, listen carefully and (try to) remember. As previously concealed, a transistor and a capacitor are paired to create a memory cell which represents a single bit of data. The capacitor holds the bit of information which is a 0 or a 1. The transistor acts as a switch that lets the control circuitry on the memory chip read the capacitor or change its state. These memory cells are aligned so that it is convenient to read the data in blocks. On a 8-bit processor these blocks are bytes. On a modern 32-bit processors these blocks are represented as double words (32-bits = 4 bytes = a double word) memory cells. Commonly, there is an input and output pin (the Data Pin) and a few Address Pins alligned in a row on a memory storing device. Let's take a look at the following which is a representation of a RAM (Random Access Memory) chip. ![]() Simplified Memory Access Diagram of a RAM Chip So this is the basic RAM structure. The data pin acts as the input/output pin. I’m not sure about the exact states of that pin but I would assume that if there is voltage on that pin, then the chip is used to read memory from the data cells (the row of addresses indicated as Address/Data on the image), if otherwise, the chip is used to write memory to them. The data cells residing on the chip, as I’ve already mentioned it, are memory cells made out of transistors, particularly the silicon crystals carved in a special way to conduct electricity just how we want it. What I didn’t mention, is that the address pins act as a memory bus to quickly (well not so quickly as far as excessive reading/writing goes -- that‘s why there are optimizations and “hacks“ -- but getting slightly faster as the technology advances) identify and transfer whatever data at whatever address you need it. This is how it works. Basically some voltage is applied at specific address pins (and ignored at some of the other ones, depending on the address), so as you can imagine a binary digital “address” is formed on those pins. The Address Decoding Circuits (indicated by a yellow area on the image above) get the “right” data address to the combination of voltages on the Address Pins. Well, don’t get too concerned about this process, I’m not going to go deeply into explaining how it works because to us, this is done “automatically”, we only specify an address in our programs and the value stored at the requested address almost miraculously appears at our disposal. But this, is how memory access works in general on the hardware level. Quick overview When you input a certain command in a form of a processor instruction - which is a binary number, but typically represented by a hexadecimal number and ultimately by an Assembly Language instruction for the programmer’s convenience - a chain reaction in the electric circuitry progresses until a given function is accomplished. In turn this generates a certain result according to the instruction name and the values stored in specific locations also on the CPU called registers. A register is a special memory address on the chip itself which regularly stores a value. The number of registers on a processor is limited because of the elegancy of the space limitations and the architecture of the chip itself. These registers are mainly used as placeholders for data and it is very fast to access and manipulate them for the CPU because they are residing on the chip itself so there is no need for a memory bus to be involved. In turn you get faster performance. However, since the number of the registers on a chip is limited, a programmer would require to know a few "tricks" or "hacks" to be really versatile with the computer on its lowest level. Anyway, a series of microprocessor instructions coupled with any given register values is what forms a computer program on the lowest level possible. A single instruction is executed after another one in a linear order, unless an instruction commands the process to jump to a different address from the current address. And this is the common flow of a computer program. To the eyes of a C-language programmer, all of these underlying processes are of course hidden by the compiler, however knowing what’s really going on the inside could help in certain situations so if you haven’t looked into the Assembly Language at all, I would recommend doing so. There are various books and internet resources on the topic that could expand your knowledge. I would recommend digging out the infamous (and outprinted) Michael Abrash's Graphics Programming Black Book and Jeff Duntemann's Assembly Language Step-by-Step books for that purpose. As for now, this sums up my discussions of the CPU in this section; I might be able to update this page with even more information in the future. Also I want to point out that I would like to know what you guys think of this and other tutorials on this page, so by sending me your feedback you will encourage me to write more informational and programming tutorials.
If someone thumbs up your comment, your gain +1 mana (authority) on this page's subject.
If someone thumbs down your comment, you lose 1 mana. If your comment is thumbed down by the author of this page, you will lose 3 manas.
Are you good at writing? Then Authentic Society needs your help! Add your own articles to the site! Other articles you might like:
|
|
||||||||||||
You need to be logged in to have access to all parts of the site. Luckily, Authentic Society is free to join.
© 2007-08 Authentic Society. Page load time: 0.184ms