New CPU Research

Started by
7 comments, last by Horatius83 19 years ago
I am a newb, so please forgive my ignorence. I asked a question like this in the newb section and got some good advice, but not the answer I was looking for. So, I am hoping someone here knows what I need. First, I don't have much formal training in programming. I took some intro classes at the University of Minnesota, but they were just programming basics and learning the languages. If you are intersted I stopped attending classes in my third year of aerospace engineering. Then I changed majors a couple times until I just dropped out. Meaning, I think I have the ability to lear, but I think I am impatient and bad at research so I am asking for help at this website. However, I have been reading books and trying different things for the past year. My problem is that the book "3D Game Engine Programming" has a section about recognizing processors and their features. According to the author every CPU since the old 386 has a CPUID feature. If you put the value 1 in the EAX register you get the vendors name. By putting other values in other registers you might be able to get a list of the features of the processor. He says that you can get the specifics of what is returned for each processor in its documentation. But the book didn't have enough detail for me on this subject. So, I looked through the documentation of some random processor for a few hours until I got a big headache. Can someone tell me what documents I should be looking through and a name or some way to recognize the info I am looking for. Also, a website or something that sorts through all the pointless stuff and summorizes the important info for non-chip-designers would be super. If that is too specific I would greatly appreciate a source of knowledge to learn what I need to know about chips and processors so that I may optimize code appropriately. In the newb area I was told to just get the info from the windows registry, however I would like a more multi-platform answer. I was also directed to an example writen 10 years ago; and while it might recognize MMX I don't think it recognizes SSE, SSE2, SSE3, 3DNow! or other newer technologies. Also, I already have an example in the book I read, I just need to know how to update it when new technology comes out. Thanks for whatever help/advice you can give, it all helps even if not exactly what I wanted to know.
Advertisement
I'm pretty sure the CPUID stuff only works for Intel x86 processors, the PowerPC has a different method of accessing information. So does the ARM chipset.
There's a GetSystemInfo() function in Win32, I imagine other operating systems might have a similar function. Generally you can look up C++ and Win32 info in the MSDN (msdn.microsoft.com). I believe you can contact Intel, AMD, and others and they are generally happy to send you some info on processor specs and such (LaMothe mentions something about it in "Tricks of the 3D Game Programming Gurus")
As for a cross platform answer, if you're using assembly language I'm not sure if that would be cross platform, unless all vendors observe some kind of protocol regardless of processor architecture. Also, I would like to point out that the HAL (hardware abstraction layer) in OpenGL and DirectX are built specifically so you don't have to know the details of the hardware you are using.



"Think you Disco Duck, think!" Professor Farnsworth
this page looks quite good: http://www.paradicesoftware.com/specs/cpuid/index.htm
that website is great, thanks.

and isn't the point of assembly so that you don't have to know the machine code for eash system. but yes, the processor has to have the CPUID feature or according to that webiste it could crash the processor. and I don't know much about HAL, but I was thinking more about vector math. according to the info I have read, I think MMX was 32 bit registers for faster math, however you could still only do one thing at a time. then I think it was 64 bit, so you could do the same calculation on 2 32 bit numbers at the same time. now it is 128 bit, so you can input a vector, with 4 32 bit numbers, and pump the entire thing through at once. I think HAL is for the GPU. and I understand that there are undoutably librarys that do the vector math for me, but I would like to know about how to do it myself. and also I would like to know if it changes to 256 bits so you can have vectors of 64 bit floats instead of the more limited 32. don't get me wrong, SSE2 is great, but I am never satisfied.

if I can mention, I was looking up the PS3 and it said it was based on Cell processor technology, and I thought "what is that?", so i looked it up. if you like the idea of the vector calculations I mentioned above then you will probably go nuts when you read about the PS3. i found this website (http://www.blachford.info/computer/Cells/Cell0.html) that said the PS3 will have 8 128 bit vector processors. I am no expert but it seems to me that this could make vector calculations 8 times faster. I imagine looping through all the objects and rays and calculating distance or whatever else. then I imagine each one of the 8 processors doing one from the list. so instead of going through the list one at a time you can do it 8 at a time. though it would probably be limited to pure mathematics, no function calls or anything else, but still...

[Edited by - StubornAH on March 28, 2005 1:44:13 AM]
Quote:Original post by StubornAH
isn't the point of assembly so that you don't have to know the machine code for eash system.


No, that's the point of high level languages. Assembly exists so that you don't have to remember the numeric opcodes for each instruction. The mnemonics stay largely the same across each new processor in the same family but there may be new instructions added each time, and each family of processors has different instructions, and there are even different conventions for the mnemonic syntax.

Since you say that you have little formal programming training I would like to take this point to advise you that there are very very few occasions when looking up the precise processor type is necessary. But if you are really interested in this area, good luck with it.
Quote:
Quote:
isn't the point of assembly so that you don't have to know the machine code for eash system.




No, that's the point of high level languages. Assembly exists so that you don't have to remember the numeric opcodes for each instruction.


I stand corrected, thank you. Maybe I will look for a good book on assembly. I realize that I shouldn't need to ever use it. I should be able to find librarys that are already optimized by experts. But I look at this like as my education. I am trying to prove to myself that I can learn, and maybe if I go at my own pace I will learn and get a better job then working in fast food for the rest of my life.
Windows also has IsProcessFeaturePresent to detect mmx/sse/sse2/etc.
-Mike
try "IBM PC Assembly Language and Programming (5th Ed)" by Peter Abel, it's a little dated, but still pretty good.
"Think you Disco Duck, think!" Professor Farnsworth

This topic is closed to new replies.

Advertisement