W04- (cont) Basic Pocessor Class
This week wasn’t very productive on the first few days as I can say. Has been working on source code that is to build a basic processor class in Java. Although the name of it is so called a BASIC processor class but unfortunately it isn’t 100% fall on the “basic” category for me. The fact that implementing the knowledge of microprocessor into source code format getting me confuse from time to time and I couldn’t clear out bugs that appeared.
Obviously it is different kind of implementation and usage of Java programming language compare to what we have learn in classroom. Implementing them into something “real” is getting my nerves on as their are so many details need to be taken care of and it isn’t that straight forward like a+b=c. With the fact that I’m personally weak in programming language as well is getting me sinking into despair as time goes by.
After getting some “lecture” from my supervisor for taking too long to get the class done, he give me some insight on how these basic unit of processor should function so that I could write out the program in the simplest way. But again, with my limitation on Java programming language, I still couldn’t write out the whole program and again get a “lecture” from my supervisor and pointing out my mistakes. Despair of my dummy, my supervisor ask me to go through the Java tutorial again and this time focus more on few chapter that are fundamental to build a class. Reading through for the second time and this time knowing my goal makes the understanding much better.
A better version of my source code is builded but yet still with bugs existing especially on machine state register (MSR) as masking technique needed to extract out value C & CC register for the current thread and another thread with everything else extracted except both C and CC register. After that both of these thread need to be merge again. Although I understand the whole working process of this MSR but I still couldn’t implement it into source code. Again, with supervisor’s guide, finally all these basic function for program counter, memory (8 bits, 16 bits, and 32 bits), machine state register (MSR) and register working without any bugs.
Supervisor also notified me to include few more details into the source code to make it better and complete class which includes valid range checking for each parameter, input validation, reset function and save object into file and restore it. While the first few details included and checked working, there is these error result printing when I try to restore the file into source code. Printing result for 32 bits memory giving an unsigned result when the data enter is 123456 (it suppose to print out 123456). After puzzling for some moment with supervisor, finally we found the source causing this error and to solve this, the upper short memory for both 16 bits and 32 bits memory to become 0 before shifted left.
Finally the misery solved.
Although through out the whole week, I get lots of “lecture” from supervisor but if all these can clear my tangled and puzzled mind and most importantly get current task done according to the schedule, it’s worth it anyway. For the current moment, I still manage to keep up on the timeline schedule. This week will start to work on building program for the 5 classic stage of RISC pipeline which includes fetch, decode, execute, memory access and writeback.