Sunday, January 29, 2012

Visual studio gamification

If you've seen this excellent TED video, then this news about a game-style achievement system being built into the common software engineer programming tool Visual Studio should come as no surprise.  I like the idea but think they left out a very important achievement - that I just observed with astonishment: It took Visual Studio about 20 seconds to un-indent my file, using full CPU (2.8Ghz Core 2).  I won't say how many lines of code are in this .cpp file, but it's fair to say a lot.  The code compiles to about a million lines of VHDL :-D (though most of that is redeclaring tons of variables in separate files, even if they aren't used, so not doing anything).

Anyway, my fellow netizens, congrats on making it through January - not much of an achievement here in the Bay Area  but I have certainly not forgotten the giant brass ones it takes to make it through a New Hampshire winter, so here is your shout out NH!  Live free or die trying!

Wednesday, January 25, 2012

Raspberry Pi

My hacked XBOX has been completely outclassed by a featherweight, literally! (well, I suppose a feather is still an exageration, so figuratively I guess)  Seriously mad props to the Raspberry Pi team and the Xbox Media Center team, and especially XBMC's Gimli and Davilla.

XBMC has come a long way... <nostalgic interlude>

I was lucky to be in on the XBox hacking thing so was in on the action when XBMC was becoming a big deal.  At the time (~2002-2004) it was something of a new discovery that you could do very smooth high resolution video playback of highly compressed video (divx) in pure software on slow processors.My favorite example of this comes from the PocketPC world, where the Dell Axim x50v could render divx on its 640x480 screen (4x the resolution of typical PDAs at the time) with a measly 624mhz mobile processor.  I'm talking about betaplayer, which could stream Divx over Wifi to your palm three years before anyone had ever heard of the iPhone or iPod touch.

I've referred in previous posts to what my friends and I liked to call "The System".  To further whet your appetite for that glorious blog post to be revealed some time in the future, let's just say the XBOX with XBMC was the TV client, and a betaplayer'd Pocket PC was the mobile wireless client.  TV was captured on a DVR, encoded automatically at multiple bitrates and put on a secure server for streaming, with commercials removed, no human intervention, and the latest episodes replacing older episodes according to a configuration file.  New shows could even be added to The System by having my elite band of users (my friends, heh) log onto a web page and schedule the recording in a friendly GUI.

</ nostalgic interlude>

Raspberry Pi weighs almost a hundred times less (45g vs 3.86 Kg) than the original XBox, costs 6x less, and plays back at several times the resolution.  That has got to deserve some serious snaps!  (bonus points for era-appropriate slang :-)  Well done team XBMC and Raspberry Pi!

Tuesday, January 24, 2012

VM-only OSes

The hacker dojo runs all of its servers and applications on BSD (not sure which one), and they have a european BSD magazine in the Loo, so I took notice when news came out today about VirtualBSD's 9.0 release.  This is FreeBSD with drivers etc. optimized to run in VMWare - and distributed as an image (instead of an installation CD) - which is sort of the new LiveCD.  Just download the OS as a program and run it (not sure if VMWare needs to be installed, but VMWare Player is free, which I have used and works fine, so no worries there).

VirtualBSD is one of the first OS's I've seen that has been optimized to run inside a VM.  I'm not sure if it in fact works outside of a VM - it may lack the drivers to do so as an optimization, though a USB stick should be able to transfer files if for some reason you wanted to run native. (USB sticks are supported quite well in VMWare, wiht default mode such that if the VM window has focus, then any USB stick that is plugged into the host is routed through to the guest and in fact not available to the host... I love it!)

BSD is interesting - as with any BSD license you can modify the source code and distribute the resulting program without any requirement to distribute the source.  In some ways the BSD license is considered the most open of the open source licenses (MIT's a close second, which requires the maintenance of the license text in any distributions).

One of the biggest problems with software is versioning - just try to compile a large program that hasn't been updated in a few years in a new Linux installation and you probably will come to the same sad realization I have: A few of the updated compiler toolchain's components probably have an incompatible version for the given software.  This is one reason I have been carefully considering a switch to Mac - the pseudo-BSD OS that lies underneath the GUI environment has only major release versions, and is only updated once or a few times per year.  The build environments in future releases of Mac OS are quite likely to be able to compile old programs, given those programs were compatible with the BSD-like Mac OS system at some point.  As a practical engineer, I have to trade the nobility and anarchy of the GPL'd Linux for the Fuhrer's "it just works" system almost every time. </backhanded Apple complement>  :-D

Saturday, January 21, 2012

Xilinx Virtex-7 2000T power estimation

Ever since I watched this video showing the Virtex-7 2000T running 3600 cores at 100mhz (daaaamn) I wanted to investigate the architecture and what kinds of performance per watt it could reasonably be expected to deliver running other kinds of soft cores.  Initially I thought the only easy-to-use tool to estimate the power for a given level of utilization and frequency was the pocket power estimator.  This got me to back up my iPhone and upgrade from a 2-year old version of iOS (shout out to iOS 3.1.2 users!) to one that is new enough to actually run current apps (yeah yeah, I know, don't put off to tomorrow what you can do today - but I don't want to clutter my PC with iTunes and the backup process takes hours!  In the words of Gob from Arrested Development.  "Yeah, the guy with the million dollar PC needs to wait three hours to backup his phone.  COME ON!") - (for the humor impaired, my PC did not actually cost a million dollars :)

When I saw the XPE Xilinx Power Estimator spreadsheet my initial suspicion was that it would be difficult to use.  I downloaded it anyway and am proud to say that it works quite well.  You can bump the numbers for frequency, logic utilization, BRAM utilization, DSP (multiplier) utilization, etc..  It was a bit harder to estimate Flip-Flop (FF) usage - and toggle rate was hard to guess so I went with the default (12.5%).  Dynamic power for the logic scales linearly with the toggle rate, which I was not figuring to be true.  In contrast I had figured the miniature SRAMs inside each programmable logic module (64-bits in 6-input Lookup Tables (LUTs)) would perform a table lookup whether or not the inputs had changed at all.  Thus, either the table lookup is not happening when the inputs stay constant, or it doesn't consume much power to do the lookups, or looking up the same value twice in a row doesn't use much, if any, power the second time.

I highly recommend the Xilinx Power Estimator.  Given a design on a different generation of Xilinx product, it is fairly easy to guess how many distributed copies of the design could be spread across a different Xilinx product with X times as many logic gate equivalents (e.g. Spartan-3 4M -> Xilinx-7 20M is 5x increase). Scale the units such as BRAMs and DSPs by 5x, maintain the logic utilization and FF percentage utilization, and scale the frequency as is reasonable.  Pop the numbers in the spreadsheet and you've got a power estimate.  (In the words of Desmond from Fallout 3's Point Lookout, "Easy Peasy").

(Note that although IO is not considered here, that is an important aspect of scaling performance to a new FPGA.  Still, many designs will find plenty of bandwidth on a superior new FPGA, and the power consumption of the IO is often small relative to logic power consumption.)

Friday, January 20, 2012

Finding well-reviewed netflix streams

Was on the Roku looking for something to watch on netflix and found a 5-star show under Gory titled "Kill-Theory".  Anyone who has seen the star ratings on netflix knows that can't be trusted very much.  Even my rule-of-thumb of trusting 5-stars has been shaken of late (Elfen Lied was visually spectacular but with long lulls).  I tend to feel bad giving low ratings so things come up with 5 stars for me a lot.  What can I say, the Roku didn't do anything wrong, it was doing the best it could, so.... 5 stars!  (Heh)

I decided to check Kill-Theory on Rotten Tomatoes, which my hipper and cooler younger brother-in-law Daniel points me to frequently.  Rotten Tomatoes gave it a 28%, which got me thinking that if less than half the people liked the movie, I probably won't like it.

So I decided to browse Rotten Tomatoes a bit a clicked on their "Top Movies" link, then sub-category "Horror" (where's my Gory) - I love these kinds of movies because I find them easy to ignore while working and feel that I've accomplished something when I get to the end.  I wanted some way to filter the list of movies so that only movies that are instantly streamable on netflix would show.  If there is a way to do that directly, I couldn't figure it out.  The search features seem a little basic.

Just then I realized that some of the shows had quite a bit more reviews than others (most having 50 reviews, but some having over 150) - I quickly tested a theory and verified that it seems that shows that are netflix-streamable have a predictably higher number of reviews than other movies.  Thus, on a list of the top-100 horror movies it is quite easy to see the 5-10 that are streamable on netflix by quickly scanning the "Reviews" column.  This is somewhat similar to how I use newegg, where I sort not by the highest rating, but by what has the most reviews, since that shows you what people are buying, and where the best deals are as well (my next step is to look for the worst reviews and see whether their complaint is likely to how I plan to use the product).

This got me thinking - before I figured out this trick I was thinking that somebody should really invent a web site that allows searching of rotten tomatoes with filters like netflix streaming.  Clever people who could make a website like that are probably also unforunately clever enough to find workarounds like the one I listed above.  I wonder how many inventions have been cut short because the inventor was clever enough to figure out why they didn't need the invention - the workaround doesn't have to be all that easy to do either, sometimes it just has to be easier than building the invention.

Anyway, here's a shout out to Hacker Dojo in Mountain View!  Ima hack me up something good... after I meet these deadlines I gots me!  :-D