Mar 27, 2014

SPU operation dual issue

Today I learned how to manually calculate SPU operation dual issue rate. One of documents SPU document explained it very well.

There are two different types of operations: Even and Odd. When Even operation and Odd operation are fetched together they can be dual-issued. Each operation consists of 4bytes and OPCODE is most of time significant 11bits; the PDF document has list of instructions with their OPCODEs.

There is an important alignment limitation. When Even operations are stored in odd memory address or Odd operations are stored in even memory address, they cannot be dual-issued. Here the term, Even address means, any address value whose 3rd bits from LSB is zero; one for Odd address. For example, 0xXXX0, 0xXXX1, 0xXXX2 and 0xXXX3 belong to Even address.

Each operation size is 4byte and instruction fetching occurs for each 8bytes. For example, address from 0xXXX0 to 0xXXX7 will be fetched at once and address from 0xXXX8 to 0xXXXF will be fetched next.

When Even operation is stored at Odd address, 0xXXX4~0xXXX7 or 0xXXXC~0xXXXF, it will prevent the fetched instructions from being dual issued. Likewise, when Odd operation is stored at even adress, 0xXXX0~0xXXX3 or 0xXXX8~0xXXXB, it will prevent too. Whenever dual-issuing fails, one of pipeline units stalls.

I remember reading the same thing from one of articles in the book, "GPU pro". But I have almost forgotten it.

Mar 25, 2014

RetroPie is great.

My wife told me that she want to play Super Mario Bro that she used to play in her friend's house. I thought about getting an ArcadePi but it was too expensive. So I just installed "RetroPie" in one of my RaspberryPis:

I never thought that I will enjoy old games. But when I put my hands on, I liked Super Mario Bro a lot. The graphic looks old and it uses only limited number of colors but it was simple and straight forward; even my wife can enjoy games!

I started looking for other old games. I found that there are so many good games that runs on emulators. For example, this website lists so many good PS1 games: It reminded me of time I spend in arcade game centers with my friends. These games are actually not that old games. The last PS1 game I remember is Final Fantasy 9, which was made in 2000.

I think the fun factor of the game was little different from what we have now. I had to put coins in the machine and I wanted to play longer. If I play better, I didn't need to spend too much money and I coul enjoy later part of the game. So "Play skillfully" was important. Now a days we play games at home most of time and skillfully is less important, because there is no fear of spending money. Also the games were more casual and intuitive. I guess it is the characteristics of "casual games" in general.

It may be only me but if I play "casual games" with my PlayStation3/4, it feels like I am doing a wrong thing. With such a powerful machine, why would I play casual games? Wouldn't it be a waste? It is like commuting with a school bus by myself. So it is actually preventing me from playing casual games. In my mind set, I don't have way to play casual games.

The point is that old games reminded me of something that I have forgotten for long time for long time. I tried to write down this to think louder. lol

Mar 16, 2014

I got TonTec 2.4inch LCD monitor for Raspberry Pi

Last week I found an small and very thin LED monitor, "HL161ABB". I thought I can use it for one of my RaspberryPis. It was LED and I has VGA port not HDMI port. It was super thin and the price was only $70.

However, I also found an interesting LCD monitor for Pi. It was Tontec 2.4inch 320x240 LCD monitor connected via GPIO. The "GPIO" part is the best part of the product. It doesn't require any additional power supply and it turned out that I can still use USB keyword and USB Wifi with no power problem. Compare to "HL161ABB", the price is too high, $45, but I got it because of the GPIO part.

I was thinking to run arcade game with the LCD attached Pi. I found a problem tho. It was utilizing CPU resource to copy the video frame buffer too much. CPU utilization was almost always at max.

The source code was very simple and straight forward; about 80lines. It reads /dev/fp0 and checks if the colors are changed and if it did, it changes the color value on the LCD. It seems like the LCD displays 16bit colors, which means it takes R5G6B5 instead of full R8G8B8.

But I was wondering if it can utilize GPU rather than CPU not only for speed up but also for saving CPU availability for other applications.

I am tempted to optimize the source code but I need to figure out if there are better versions or if anybody have done it already. The source code had a URL advertisement like this:
    printf ("\n") ;

It turned out that it is a Chinese website. I was hoping that if they made any new version of the software but I couldn't read a thing.