======Part 1====== =====Entries===== ====February 9th, 2012==== Well let me summarize what we have done so far in class. Our big project this semester is a cpu simulator. We have started this out by building the basic logic gates that everything else will be built on. Yesterday we were introduced to flipflops. Flipflops are these crazy things that I have no idea how they work. I am currently trying to get some understanding of them so I can move on to registers. I am excited even now to see how everything we are doing is building on itself. ====February 13, 2012==== Today I worked on my first keyword for my opus. As I was thinking, I realized this would be my last first keyword. As I held back the tears I started to define me some logic gates which was pretty fun. I'm still pretty excited about this whole cpu simulator thing. I've been reading more in my book about how we are going to be building everything. Peace out yo! ====February 24th, 2012==== I'm back dating this entry since I forgot to do it on Friday. Today in Computer Organization we all discussed a Turing machine. A Turing machine is a device that changes symbols on a infinite strip of tape. It changes these symbols by referencing a table of instructions. This machine can simulate logic that is used in computer algorithms. This theoretical device was imagined by Alan Turing in 1936 and is useful for representing a computer.. Other than that, our class is still working on our CPU simulator. The next steps are building a menu and building registers. ====February 28th, 2012==== Toady had been fairly productive. I finished up my keywords and have started work on my experiments. I'm kinda struggling with what to do for my experiments though. Some of the experiments I can think of just seem trivial to do. I'll keep thinking about it and come up with something. I also need to do an objective. Looking at the course objectives, most of them have to do with knowing the assembly language. I think that I still can do one of them at this point. Well have a happy leap day tmrw! =====Keywords===== {{page>asmpart1&nofooter}} =====Experiments===== ====Experiment 1==== ===Question=== I don't know if this is a particular question but I will playing around with a fairly new feature in C++. This feature is the **auto** typed variable. What this allows you to do is create a variable with the keyword **auto**. The compiler will determine what kinda of variable it is based upon its initializing expression. I guess I will be testing whether this actually works or not. ===Resources=== http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf ===Hypothesis=== Based upon my reading of this article, I think the feature will work as expected. ===Experiment=== I will create a test program that declares variable of different types including the **auto** type. I will the initialize them to the same value and print out the contents of the variables. ===Data=== The following is the test program that I wrote. #include using namespace std; int main() { int intvar1 = 'a'; char charvar1 = 'a'; double doublevar1 = 'a'; auto autovar1 = 'a'; int intvar2 = 65; char charvar2 = 65; double doublevar2 = 65; auto autovar2 = 65; int intvar3 = 65.51; char charvar3 = 65.51; double doublevar3 = 65.51; auto autovar3 = 65.51; cout << "intended value 'a'" << endl; cout << "intvar1 = " << intvar1 << endl << "doublevar1 = " << doublevar1 << endl << "charvar1 = " << charvar1 << endl << "autovar1 = " << autovar1 << endl << endl; cout << "intended value 65" << endl; cout << "intvar2 = " << intvar2 << endl << "doublevar2 = " << doublevar2 << endl << "charvar2 = " << charvar2 << endl << "autovar2 = " << autovar2 << endl << endl; cout << "intended value 65.51" << endl; cout << "intvar3 = " << intvar3 << endl << "doublevar3 = " << doublevar3 << endl << "charvar3 = " << charvar3 << endl << "autovar3 = " << autovar3 << endl << endl; return (0); } I then tried to compile this code with the following command and got this error message. lab46:~$ g++ autotest.cc -o autotest autotest.cc: In function 'int main()': autotest.cc:10: error: ISO C++ forbids declaration of 'autovar1' with no type autotest.cc:14: error: ISO C++ forbids declaration of 'autovar2' with no type autotest.cc:18: error: ISO C++ forbids declaration of 'autovar3' with no type lab46:~$ I then talked to Matt about why this was happening and he found out that i needed to include the following argument. lab46:~$ g++ --std=c++0x autotest.cc -o autotest lab46:~$ I believe this was to tell the compiler to include the right libraries which it wouldn't do by default. Once the code was compiled I ran the code. lab46:~$ ./autotest intended value 'a' intvar1 = 97 doublevar1 = 97 charvar1 = a autovar1 = a intended value 65 intvar2 = 65 doublevar2 = 65 charvar2 = A autovar2 = 65 intended value 65.51 intvar3 = 65 doublevar3 = 65.51 charvar3 = A autovar3 = 65.51 lab46:~$ ===Analysis=== Based on the data collected: * Was your hypothesis correct? Yes. The variable behaved as expected. * Was your hypothesis not applicable?No * Is there more going on than you originally thought? There may be but with the level of the experiment that I ran I am happy with the results. * What shortcomings might there be in your experiment? None that I am aware of. * What shortcomings might there be in your data? None that I am aware of. ===Conclusions=== The auto typed variable is just as simple to use as any other type of variable. As of now I am not aware of any big advantages this type of variable has besides dumbing down the programming a bit. Maybe as I explore this more some of those advantages will show themselves. ====Experiment 2==== ===Question=== I guess this will piggy back of the last experiment. The question I am posing is will a **auto** typed variable once initialized be able to change types. ===Resources=== http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf ===Hypothesis=== I believe it will not be able to change data types once initialized. ===Experiment=== I will write a program that declares and initializes an **auto** typed variable to an int. I will then try to put different data types in it and see what happens. ===Data=== Here is the short program I wrote to test my hypothesis. #include using namespace std; int main() { auto autovar = 'a';//i will be changing this initialization through my testing proccess. cout << "value stored in auto typed variable - > " << autovar << endl; cout << "enter value to put in auto typed variable: " ; cin >> autovar; cout << "value stored in auto typed variable - > " << autovar << endl; return (0); } I then compiled and ran my code. lab46:~$ ./autotest value stored in auto typed variable - > a enter value to put in auto typed variable: b value stored in auto typed variable - > b lab46:~$ ./autotest value stored in auto typed variable - > a enter value to put in auto typed variable: 7 value stored in auto typed variable - > 7 lab46:~$ ./autotest value stored in auto typed variable - > a enter value to put in auto typed variable: 6.234 value stored in auto typed variable - > 6 lab46:~$ I then changes the initialized value to 5. lab46:~$ ./autotest value stored in auto typed variable - > 5 enter value to put in auto typed variable: 6 value stored in auto typed variable - > 6 lab46:~$ ./autotest value stored in auto typed variable - > 5 enter value to put in auto typed variable: a value stored in auto typed variable - > 5 lab46:~$ ./autotest value stored in auto typed variable - > 5 enter value to put in auto typed variable: 6.34 value stored in auto typed variable - > 6 lab46:~$ ===Analysis=== Based on the data collected: * Was your hypothesis correct?Yes. once initialized to a certain type the variable can't change data types. * Was your hypothesis not applicable?No. * Is there more going on than you originally thought? Not that I am aware of. * What shortcomings might there be in your experiment?None that I am aware of. * What shortcomings might there be in your data?None that I am aware of. ===Conclusions=== Just as expected, once an autotyped variable is given a data type it cannot be changed. ====Experiment 3==== ===Question=== My final experiment will be whether you can declare an auto variable without initializing it and if so how will it respond. ===Resources=== http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf ===Hypothesis=== I believe you will not be able to declare the **auto** typed variable without initializing it. ===Experiment=== I will write a program that declares an auto typed variable without initializing it. If it compiles, I will then try to store data in the variable and print its contents. ===Data=== Here is my code. #include using namespace std; int main() { auto autovar; cout << "enter value to put in auto typed variable: " ; cin >> autovar; cout << "value stored in auto typed variable - > " << autovar << endl; return (0); } I then tried to compile my code and got this error. lab46:~$ g++ --std=c++0x autotest.cc -o autotest autotest.cc: In function 'int main()': autotest.cc:7: error: declaration of 'auto autovar' has no initializer lab46:~$ ===Analysis=== Based on the data collected: * Was your hypothesis correct?Yes. You must initialize the auto typed variable. * Was your hypothesis not applicable?No. * Is there more going on than you originally thought? None that I am aware of. * What shortcomings might there be in your experiment?None that i am aware of. * What shortcomings might there be in your data?None that i am aware of. ===Conclusions=== This experiment has furthered my lack of understanding for why there would be a need for this type of declaration. If the the variable has to be initialized before compile time, you obviously know what type of variable you will need anyways. Ugh!