Monday, October 8, 2012

Are you as smart as a 6-year-old?

"Maybe the Dingo ate your baby."  ... "I said, the DINGO ate your BABY!".

There was a montage of Seinfeld clips on TV last night - which meant I was watching the hundredth episode of Seinfeld on reruns.  The clip above played, and I elbowed my wife who was nodding off.  She said "Haha" and started falling asleep again.  I said "Isn't it funny how much the kids love that clip?" (I have showed it to them many times on YouTube).


"They don't even know why it's funny."

"Hah, yeah," she said.

"Wait, you know what.. I don't know why it's funny either.."

The next day I was thinking about how my 6-year-old boy David is growing up and discussing it with Nancy again.  I said "He is so innocent.  He doesn't know why people are mean.  He knows some people are, and I'm glad he does because he reacts by keeping his distance and toughening up his feelings a bit (just a bit).  But he has no idea why they're mean."


"Wait, you know what, I don't know why people are mean either."

With two such occurrences in two days I realized I may not have much on David, or perhaps any 6-year-olds.  On a moral and social level I wonder how much more he really has to learn?

Wednesday, August 29, 2012

Rest in peace Paul Steed

I remember meandering through the aisles of the UCI bookstore between classes and coming across "Modeling a Character in 3DS Max" by Paul Steed.  Flipping through the pages, I realized that the book would take me through every step of creating a professional-quality 3D video game character.  The step-by-step nature of the book made it seem simple, causing a light to go off in my brain when I realized... I could do this!  My jaw dropped, and I bought the book instantly.  Ever since, I knew if I ever wrote a book then it had to be in the same spirit as Steed's: to enable the reader to build something really cool.

My favorite memories from high school classrooms were building things in Physics class like a 6-foot tower made from a single sheet of paper, an electric car with pie-tin wheels, and a kayak built entirely out of milk cartons (winning 2nd prize).  Outside of those projects, I also remember that instead of paying attention in class I would make games on my TI-82 calculator programming in BASIC.

While those projects seem trivial, they are the kinds of learning experiences that change lives.  Paul Steed brought such an experience to life in his book, inspiring me that some day I might also try my hand, and for that I will always be grateful.

Paul died on August 11, 2012, may he rest in peace.

Thursday, May 17, 2012

Slashdot Comment of the Day #4

A recent post on slashdot by jd entitled "CPU Competition Heating Up in 2012" gets excited about processors that are anticipated to be released this year, noting " with three new 'Aptiv-class' MIPS64 cores being circulated in soft form, a quad-core ARM A15, a Samsung ARM A9 variant, a seriously beefed-up 8-core Intel Itanium and AMD's mobile processors."

Along the lines of "Hey 32 nanometer, where's my 16 cores?", Taco Cowboy notes:
"Intel has been dragging its feet on releasing an 8-core i7 desktop CPU to the users.  It took merely 2 years to upgrade from uni-processor machine to a 4-core CPU, and then it stopped.  It has been 10 years and counting, and there is still no 8-core i7 desktop CPU."

Too right Taco Cowboy. What's more, it's been 15 years since the first affordable dual processor system (Dual Celeron 300a with modded slockets). Intel is the once and future king of serial processor performance, with AMD a distant second, so I suppose it comes as no surprise that Intel is de-emphasizing the role of parallel processing.

What's more, many slashdot readers correctly recognize that, instead of being "radically different", as jd claims, the anticipated processors are merely an evolutionary development of current architectures. (though, to be fair, radical new computer architectures are not easy to invent, let alone productize!). Sponge Bath notes:

"Evolutionary upgrades to intel processors and memory standards, titanium is not dead yet, AMD still can't keep up and ARM rules low power applications. Yes, it will be a landmark year for processors." </sarcasm>

To which TheRaven64 responds:

"I think the news is that MIPS is not dead, it's just pining for the fjords!"

Congratulations TheRaven64, you win Best Slashdot Comment of the Day #4!

Wednesday, May 9, 2012

Mechanical Computers

Some people are surprised to find out that computers can be built from mechanical operations without any electronics.  I would like to some day implement a mechanical computer that can do things people would recognize, like word processing and other things - but getting these things to operate faster than ~10hertz can be tricky.  In addition, if an invalid instruction is programmed into the mechanical processor then it is possible to damage the computer, possibly taking months to repair.  (ouch!)

Here's an example of Charles Babbage's difference engine (invented in the early 1800's), reconstructed with legos, which can be seen operating in a video below.  The difference engine can calculate polynomial functions with sufficient accuracy to approximate non-polynomial functions like logarithm or square root.  These could then be used in a table to look up the approximate results of the function for a certain input.  Considering that slide rules were in common use as recently as the 70's, the difference engine was really ahead of its time.

Perhaps best of all, mechanical computers make mechanical noise - perfect for providing that steampunk atmosphere!

P.S. That picture is from The Guild.  The episode and show are definitely worth watching :-D

Monday, May 7, 2012

Trust & word of mouth

Here's an anecdote about the importance of trust and word of mouth.

Over the last 10 weeks I've had some mobility issues.  I woke up one day and my foot basically no longer worked.  I've had this problem before - it's basically a sprained ankle I get from kicking while I sleep (if this is TMI, feel free to skip the blog post :).  Second, the 2000 Saturn LS I drive (6-cylinder with an excellent second gear) started making terrible knocking sounds and so I parked it and began looking into getting it serviced.  During the process of fixing the Saturn I borrowed my Dad's OptiBike - a really excellent electric bike with a range of ~20 miles per charge.

I never took proper care of my foot which is why it took so long to get better - never went to see the doctor and never stopped wearing sandals.  My bad, but let's move on.

Saturn has no dealerships.  This may not seem like a big deal at first since Chevrolet has taken over servicing Saturns, but what it really means is that there really is no place to go for expert Saturn repairmen - i.e. no place where they say "Yeah, it's normally an extremely rare problem except it happens in this car every 80,000 miles".  Took it to Dave's Auto Repair, which has good reviews and was generally responsive on the phone.  They suspected the timing belt but couldn't be sure - $1500 to replace the timing belt but they could not guarantee it would work afterwards.  No charge for the diagnostic - it was not obvious they had moved the car at all but had probably just listened with the hood open.

About this time the Optibike failed in a cascade of events that led to a twisted chain and front gear that was constantly skipping.  There was no crash, the chain just kept falling off the gear worse and worse until it didn't catch much at all.  This repair took two weeks because Cognition Cyclery changed the chain, saying it should work, and refused to test ride the bike until after I tested it and it continually skipped riding 10 feet in front of the bike shop, leading to special ordering the front gear (which they had said did not need replacing despite my voiced suspicion) - which did not arrive with all of the other parts that had been special ordered because where they had ordered it from did not have it in stock... so it took 12 days to arrive (this part they thought did not need replacing..).  That's not a big deal for a regular bike but taking an expensive bike off the road for two weeks because you didn't check if a part was in stock is not so cool (I checked up on it every 2 days or so, which did not end up helping..).

Around this time we took the car to Mechanica Auto Repair.  They were very responsive and were quite confident (maybe 90%) that the timing belt was the problem, arguing that the engine would have much worse sounds/problems if the timing belt was not the problem, meaning some part of the crank attachment etc. was the problem (the traditional source of a "knocking" sound).  I was less sure than they were that the problem was the timing belt because Dave's auto had been less sure, and the quoted price of... wait for it... $1800... was too much to take the risk.  No charge for the diagnostic.

Next we had a mechanic from Craig's List come listen to it.  He was quite sure it WAS NOT the timing belt and was very hesitant to start the work.  He would have charged as little as $300-$500 (a "Craig's List Special" as it were) but did not want to do the work because of his lack of confidence in the timing belt being the problem - and his lack of confidence of getting paid if the car did not work in the end.  There were some language issues but my wife speaks Spanish so it was no problem.  No charge for the diagnostic - a good experience in general though he seemed to be less experienced than he claimed (no surprise there I guess).

Finally, the bike gets repaired, ending a two week stint in which I had no wheels or feet of my own to speak of (well, the foot was good enough for walks at that point, but that is less dramatic :).  Bike skips just a little bit, every couple minutes or so, and only in certain gears.  Certainly rideable but my Dad, like a soup Nazi, is a perfectionist and wants me to take it back to a different bike shop.  Hard to argue with experience, which, with the Optibike, he has a lot of (I think only two serious accidents </blue commedy>, but I wear a full face masking helmet, so I'll be ok right?).

Lastly, I get advice from a local friend after asking him if he knows of a cost-effective repair shop.  He points me to Mountain View Radiator.  Great experience here, they put the car up on the lift and were certain the sound was coming from under the timing belt cover.  Quoted ~$900, including water pump.  They were 100% confident it was the timing belt, and because their price was the best from a real shop I rolled the dice and OK'd the work.  Picked up the car the next day and it drives perfectly.  Hooray!

The final problem was not in fact the timing belt, which indeed would not normally make a knocking sound, but one of the idler/tensioners for the timing belt, which everyone knows should always be replaced with the timing belt, but are often not replaced by dealerships in order to result in a sooner future repair that will result in more money to the dealership.  I can't say for sure that they were not replaced, but it seems quite likely the original Saturn dealership that replaced the timing belt the first time did not appropriately replace the idler/tensioners along with the timing belt.

All is well that ends well.  Having moved quite a few time in the last 10 years I can easily say one of the most important things is to find a mechanic you trust and that charges fairly.  We found this in White River Junction  when we moved to Dartmouth by calling the local auto parts shop and getting refered to White River Automotive.  You won't find Cory running that shop anymore because the prices were a bit too low and he went out of business (a nice guy running a business can often end up that way.. too bad).  Along with a very forgiving inspection service place (New Hampshire's Live Free Or Die ends with the automotive repair's successful lobby for legally required car inspections I guess), which passed my Jeep with its very rusted underside (I can't name them publicly, they don't deserve any blowback).  A similar story to the one above could have been written for that Jeep which was quoted $2500 by Midas to fix an exhaust leak, which Cory fixed for $60 using a welder.  Ironically, Cory now works for Midas after his auto repair shop went out of business.

Car repair can be merciless for customers and even business owners.  Maybe in a future post I will figure out the proper metaphor for a computer hardware company - but trust and word of mouth are really universally important and perhaps further simplification is unnecessary.

Peace, out!

Sunday, May 6, 2012

Volunteer sysadmins for Mozilla

The open source organization Mozilla is looking for volunteers to help run their servers.  I imagine this would look fantastic on a resume' so for any that could use that or have wanted to get started helping open source this is your friendly "heads up".

Saturday, May 5, 2012

Beware of mixing mrjob & pythonwin

I installed mrjob during an excellent course given at the Hacker Dojo on MapReduce.  I love mrjob (it is great for programming MapReduce in python - try it!), but as soon as I installed it my pythonwin installation (a FANTASTIC editor, because there is intellisense INSIDE the interpreter, and it was the only python interpreter with this feature for a very long time).  Whenever I try to use the "Find" feature I get the error:

struct.error: unpack requires a string argument of length 20
win32ui.error: Error in Command Message handler for command ID 109, Code 0

It is very hard to edit code without the Find feature!  A member at python-forum named basc had the exact same issue back in 2010.  No matter how many times I uninstall/reinstall etc. (and remove old files so the uninstall is as complete as I can make it) the error doesn't go away.  I tried at length again today to fix the installation to no avail.  This really is one of those classic operating system problems we used to get all the time due to register errors back in the 90's, but I haven't had such a resilient OS error in a very long time.  It is enough to make me switch operating systems, but I am truly torn between Mac and Linux (Linux laptop battery life is historically terrible - so a Macbook Air and its incredible 10+ hours of battery life running Linux would lose one of its best features :-(

For now I installed a different version of Python and Pythonwin in a separate location and use that editor for now.  To run things in the old Python installation I'll have to copy/paste my source files, but that is not so bad.

Just a heads up for pythonwin users trying to do MapReduce with mrjob.  If anybody knows how to fix the above problem please leave a comment and I will post a follow-up so Google can find it.

Thursday, May 3, 2012

Useful C reinterpret_cast-like #define's

While starting to write a very large chunk of code with lots of casting I created the following set of #define's which I think anyone trying to perform C++ reinterpret_cast-style functionality will find useful.

//These just set up the regular types with useful mnemonics:

typedef char int8;
typedef char* int8p;
typedef unsigned char uint8;
typedef unsigned char * uint8p;
typedef short int16;
typedef short* int16p;
typedef unsigned short uint16;
typedef unsigned short * uint16p;
typedef int int32;
typedef int* int32p;
typedef unsigned int uint32;
typedef unsigned int * uint32p;
typedef long long int64;
typedef long long* int64p;
typedef unsigned long long uint64;
typedef unsigned long long * uint64p;
typedef float f32;
typedef float* f32p;
typedef double f64;
typedef double* f64p;

//These set up easy casting:

#define cast_uint8 *(uint8p)(void*)&
#define cast_int8 *(int8p)(void*)&
#define cast_uint16 *(uint16p)(void*)&
#define cast_int16 *(int16p)(void*)&
#define cast_uint32 *(uint32p)(void*)&
#define cast_int32 *(int32p)(void*)&
#define cast_uint64 *(uint64p)(void*)&
#define cast_int64 *(int64p)(void*)&
#define cast_f32 *(f32p)(void*)&
#define cast_f64 *(f64p)(void*)&

The above code lets you do things like this (note that 0x4a66666 is hexadecimal of the floating point value "5.2" in IEE 754 format) :

long long a = 0x40a66666;
long long b = 0x40a66666;
long long result;
cast_f64 result = cast_f32 a + cast_f32 b;
printf("result %f\n",result);

The result of the above code is the output "10.4".  We can see that the one line of "cast_f64 result = cast_f32 a + cast_f32 b;" does a lot quite concisely.  We converted from 32-bit integer to single precision floating point using 64-bit integer registers for data storage - and upconvert the result to double precision floating point (This is strangely different from the SystemCrafter synthesizer  which upconverts first using the destination type... probably in an attempt to be helpful). Wikipedia notes that the above code works thanks to x86 using little endian for both integer and floating point, but this is not the case on all architectures so the above code doesn't work everywhere. As with any kind of reinterpret casts, jury rigged C or otherwise, you have to know your hardware.

Note that you have be careful with #define's like this, because if you accidentally type something like:

cast_f64 result = 5.2 cast_f32 b;

you will get a confusing error:
'*' : illegal, right operand has type 'f32p'

This is because the compiler interprets the "*" in our #define as multiplication instead of the unary dereference operator.  These types of errors are why C++ uses templates etc... but one of the greatest programmers I have ever had the pleasure of knowing, Brandyn Webb, helped me appreciate the simplicity of C over the syntactic sugar of C++.  I appreciate C++ and historically have used Python and C++. (It is interesting to note that analysis of Cognitive hardware designs indicate it will do exceedingly well on C++, possibly even better than on C).  Compatibility has become more important in my current role and C is one of the most compatible (i.e. available on arbitrary hardware) programming languages of all time - hence my current attention to it.

Happy programming!  Like riding without training wheels, reinterpret casting is fun but dangerous!

Tuesday, May 1, 2012

Slashdot comments of the day #3

There are some hysterics going on over at Slashdot because a rumor about Hulu requiring a cable subscription is being reported as fact.  Lots of dialogue over whether this would apply to Hulu Plus members, whether it would be implemented soon or take several years, whether Hulu is acting like a cable company pawn because it is scared of being sued, or because it is being controlled by Comcast (which apparently controls NBCUniversal, which owns Hulu in part).

Many in the slashdot community are irate because they hate cable companies, which are seen as charging too much for falsely advertised bandwidth speeds, and generally manipulating the market and people in unfair ways due to a monopoly on what is the only high speed wire available to homes in many cases (was hard not to use First Person there).  Now that you have the setting, you can enjoy:

Ukemike comments:

"Not in a box.
Not with a fox.
Not in a house.
Not with a mouse.
I would not watch it
here or there.
I would not watch it anywhere.
I would not watch cable TV.
I do not like it, no-sir-ee"

BobNet cites this very funny comic:

But the best has got to be this ill-typed comment by Moby Disk:
"People use Hulu because I don't have cable. Isn't that the point?"

To which an Anonymous Coward responded:
"I don't know about anyone else... but I use Hulu and I had no idea whether or not you had cable."

Sunday, April 29, 2012

Power adapter fun

This is one of those posts that will help one person out there who is googling around for a power adapter for a Western Digital MyBook Essential (or other MyBook model).  (Well, rereading it, it is somewhat useful for learning to match power adapters to electronic devices in general.)

The Western Digital MyBook Essential is a USB hard drive which comes in 1TB, 2TB, and 3TB sizes  and is very economical for the space you get, and has slightly more expensive models that support built-in full disk encryption.  Unfortunately it is useless if you do not have a power adapter (which it comes with but is easy to lose), because USB does not supply sufficient power to drive the 3.5" desktop-sized hard drive it houses. After some research it looks like the power adapter is 12v center positive.  I have a multi-volt power adapter that works great (solid constant power even when powered from a car inverter.... don't ask) but it is only 300ma.  The higher powered multivolt adapters I've purchased from Radioshack and Fry's tend to have dirty power when driven from a car inverter or simply don't work for some reason - these have all ended up in the trash.  The 300ma power adapter is not enough to power the MyBook USB hard drive, which comes with a 1.5 amp power supply, so it was back to the drawing board.  I remembered from robot labs that Bioloid AX-12 etc. actuators use 12v and have huge amperage - 5 amps (60 watts total!).  Looking at the ax-12 adapter, it is indeed center positive (also called "tip positive") so I tried the plug to see if it fits and... viola', MyBook works like a charm.

Although trying reversed polarity seems like it would break electronics in my experience the electronics do not break on reversed polarity but simply don't turn on (I tried this while playing with some electronics I never expected to work, so the risk was low, and they eventually did work so I learned reversed polarity didn't break them).  This doesn't apply to anything we did above because we checked and matched polarity properly - I digress.

Now to find the USB 3.0->USB 2.0 adapter, ugh!

Saturday, April 28, 2012

Slashdot comment of the day #2

The original post titled "Hobbit Film Underwhelms at 48 frames per second" continues to say:

"Warner Bros. aired ten minutes of footage from The Hobbit at CinemaCon, and reactions have been mixed. The problem? Peter Jackson is filming the movie at 48 frames per second, twice the industry standard 24 frames per second, lending the film a '70s era BBC-video look..."

To which an Anonymous Coward responds:

"Could you show me what this "70s era BBC-video look" is. Despite having seen lots of 70s era BBC-video, I'm unable to understand what you're talking about based on the description."

A cultural reference nobody gets, LOL.  * slaps knee

Monday, April 23, 2012

Censorship: you link it, you bought it

In the aftermath of the unexpected and exceptional success of protests against PIPA ("Protect IP Act") and SOPA ("Stop Online Piracy Act") we can begin to rethink what world it is exactly that we live in.  For one, it is a world where legislators better think twice before fucking with the Internet.  Making linking a crime (or a de facto crime) is not a solution.  The burden of implementing filters is too heavy for those entrepreneurs trying to stretch what the Internet can do.  For example, a wiki can be implemented in just 4 lines of Perl Code!  If links posted to the wiki must be filtered to protect the wiki owner from a PIPA-like or SOPA-like law, then the implementation requires tens of thousands of lines of additional code.  In addition, a huge database of song/text/video signatures must be maintained to enable such filtering (which afaik does not generally exist, though YouTube has coordinated with content owners to get such signatures, and Apple has obviously created one for music), potentially increasing the cost of running sites like a wiki by many times.

Censorship is becoming an increasingly important issue as the amount of content continues to explode:

I was reminded of this while watching The Hunger Games for the second time (spoiler alert!).  At the end of the movie Cato is being eaten by monsters and Katniss decides to put him out of his misery by shooting him with an arrow.  In the book he is shot in the head, an ending that is very quick and humane.  In the movie the director Gary Ross had to achieve a PG-13 rating, and therefore thought in his mind what a PG-13 rating would most likely allow, or may have even  been guided by the MPAA more directly.  He must have concluded a shot to the center of the chest, because that's where the arrow lands, however this would be a MUCH GORIER death than an arrow to the head.  Why an agency is able to dictate what is and is not acceptable movie watching is beyond me.

When the choice of whether to be exposed to a piece of content is "opt-in" (whether a movie or a wiki post), then why not let artists and authors decide what to do using their best judgement?  The workarounds for consumer judgement, however well intentioned, have all sorts of ill side effects, which consumers are necessarily made blind to.

Sunday, April 22, 2012

Flash vs DRAM follow-up: chip stacking

As a follow-up to our Flash vs DRAM article, which has become quite popular with search engines, I thought I would do a little research into verifying that flash chips are indeed stacked as we understood them to be at the time of writing.  We can see that to reach 32GBytes (256Gbit) chips built by Toshiba on 43nm back in 2008 were using 8-way chip stacks.  Micron even has 64Gbyte (512Gbit) Flash "chips" (multichip packages) in production.  Contrast this with Micron's largest DDR3 chip weighing in at 1GByte maximum, which is only just sampling, and you can see a difference of 64x capacity improvement.

What is great about Flash is that it is essentially "dark silicon", i.e. silicon that is not actively switching transistors most of the time, meaning less power consumption, which equals less heat.  This is because the bit-saving charge is held in nonvolatile capacitors and does not need to be refreshed, read, or written to unless a user program needs to read and/or modify the relevant data.  Chip stacking has the unfortunate downside of insulating the inner layers so that the ability to effectively cool the overall package is severely diminished.  At 1/2 watt  - 2 watts in aggregate (or 0 watts when inactive), Flash chips/modules are in no danger of overheating.  This means Flash is the type of chip product that is most amenable to chip stacking, and therefore it is no surprise that chip stacking has only really taken off with the recent attempt of Flash manufacturers to beat Moore's law at chip density (see that 20nm single-chip thick flash chips are only now reaching 16Gbytes).

Here we can see a beautiful picture of Toshiba stacking 8 Flash chips on top of each other.  All told that is 1.4 mm thick including plastic packaging!

Note another reason that Flash is amenable to stacking: it doesn't support high bandwidth, so pins on the edges of the chips are sufficient to support the reads and writes.  This is truly profound and in conjunction with its dark silicon characteristics we get we get the dynamic duo that enables chip stacking today: Stacked flash needs no cooling improvements or 3D interconnection of the dies.  Slam dunk.

The 3D integrated circuits of tomorrow will have an improved ability to provide communication between the chips at higher bandwidth, (see here, here, here) but heat will continue to be an issue.

Saturday, April 21, 2012

Wherefore art thou AMD?

33-year-old techies like myself, and the giants who came before (upon whose shoulders I enjoy standing) can remember back to a few times where AMD got to eat cake.  K6-2, Athlon, and AMD 64 processors all did well... until Intel's Core 2 microarchitecture blew AMD out of the water, a volley AMD has never recovered from.

One of the issues is clock speed.  I was reading through material (kudos to David Kanter over at realworldtech) today and realized there are stark differences in Intel's Core 2 memory management unit (MMU) and AMD's Barcelona (the poor gladiator that got thrown into the ring with the Core 2 titan :-(

Somebody must have sneaked a Scooby Snack into my Taco Bell burritos because I decided to follow a hunch..

The purpose of the MMU is to translate virtual memory addresses (the ones that a user program thinks are real) into physical addresses (the ones the operating system knows are real).  The translation-lookaside-buffer (TLB) is a content-addressable memory, which works like a hash table in order to map an input A to an output, where there are too many possibilities for the value of A to fit all possible mappings in the TLB, so you hold just the few you can fit in hardware.

Given a bag of useful A values, determining which one corresponds to  the current MMU address input is tough (i.e. power, time, and silicon hungry).  You could look through them one by one but that would be really time consuming.  Instead, two techniques are used: 1) the least significant bits of A are used for lookup into the TLB, and 2) Multiple values are fetched from the corresponding TLB entry (called "ways" of "set associativity") and verified to match the higher bits of A.  If one of the "ways" matches then you have found a proper mapping to physical memory and can proceed to do the physical memory operation.  If none of them match, then you have a "TLB miss" and have to resort to plan B.  Plan B  is an exception handler written in software or firmware (microcode) that looks into a larger memory for a match (slow).

From David's excellent article (his greatest work to date IMHO) we see that Barcelona implemented a grand total of 48 ways, and uses NO BITS to sort between them using step #1 above.  In contrast, Intel's Core 2 has 4 ways, and uses 2 bits to sort a total of 16 entries into 4 sets of 4 ways each.

It is obvious that Intel's strategy is more conservative.  In this case Intel's method delivered more speed using less silicon area and power.  As I discovered this tidbit I remembered that Barcelona had problems, not the least of which was lower-than-expected clock speeds.  This is best exemplified by AMD's switch at that time from frequency comparisons with Intel to PR Ratings.  Oh brother, they also switched to giving power consumption in terms of ACP rather than just TDP (the term upon which Barcelona was unfit to compete).

Barcelona arrived later than late to the party.  Truly unfashionably late.  During my research for this blog post (Oy vey, we are getting long aren't we) I rediscovered that Barcelona's production was reduced for many more months after its release due to, what else... a bug in the TLB!

Looks like our hunch was right, 48 fully associative entries in the primary TLB was the wrong design.

Note to self: don't fuck up the TLB.

Friday, April 20, 2012

Best slashdot comment of the day #1

In a discussion about new electric vehicle battery technology from IBM that would have very high capacity but would still take a long time to recharge; Belial6 writes:

"That's why the cars need a standard connector on the back. So you can hook up that generator trailer and recharge while you drive. "

+5 Funny :-)

Zipcar: some pros, some cons, but very different

Picked up my Zipcar for the first time today and had a surprising experience in many ways.  First, it was not easy to get an account set up because their website wanted two years worth of driving experience records and my California driver's license only goes back to this summer.  Since I did not know my New Hampshire driver's license number (they make you turn it in when you switch states) I just left that part blank and figured it would go through.

Nope.  Got an email the next day asking for a previous driver's license number.  If I were dueling zipcar this would be Point Zipcar.  Fortunately my wife Nancy was willing to give it an effort and called up New Hampshire.  Having lived there for 5 years we got pretty good at anticipating the quirky way things go there (some might say backwards way, but after 5 years it strangely starts to all make sense).  She called up our previously local DMV (only 70 miles from where we lived!  and people considered our area "urban") and got the driver's license number pretty easily after I popped on the phone to say that I was me.  Point Nancy!

Well it can't be that simple can it?  While filing taxes we took my driver's license out of my wallet to see when we had become residents according to the DMV.  You know what happened next.  It was lost.  I blame 1-year-old Gabby, whose light fingers have gotten us into trouble before.

Well to get to an appointment today I needed a rental car, and without a driver's license it is not possible to rent from a traditional rental place (even with a temporary driver's license, if it is from New Hampshire they will still likely turn you down because they look incredibly fake, rather than officially temporary like a regular piece of paper.. but that is a different way-too-long story).  The prices for local Enterprise compact/economy cars are great, near $25/day, but without a license that is not an option.

Enter Zipcar.  With my newly activated ZipCard I reserved a car.  Only one was available, and I could not figure out how to get their website to show me more options.  Very strange.  Regardless, it was only 5 miles away (note to Zipcar, you need to become sufficiently ubiquitous that you are always walking distance from home - this is why you have so much success on university campuses of course).

I got the above prius, named Pygmalion, but without the cartoon backdrop unfortunately.  Got off without a hitch, though for some reason I figured the card scanner was close to the door lock, rather than the windshield, and that direction of the card wouldn't matter (which was proximity based) but it seemed to.  No points for picking it up a 1/2 hour late, I got charged for that, oh well.

Drove to my appointment in a somewhat abusive manner - the Prius has plenty of power to make you feel unencumbered, especially when the gas is free (Point Zipcar) and your foot is heavy.  The only strange things were that if you push hard on the brake, as I sometimes do when I stretch, it deactivates all acceleration (probably something to do with that Toyota accident and subsequent recall?).  Also it is slow to takeoff from a stop unless you give it a lot of gas, but I think that is just the programming hybridness of the car trying to force you to be efficient.  It seems to me that you could apply just the electric motor for the first 10 mph and use very little energy even when accelerating - I think the Prius programmers were trying to train my psyche to slow down.  The car would beep at me whenever I parked and left the vehicle, perhaps something to do with the key being left in the car, which you must do in zipcar.  That was a little unnerving but whatever.

I arrived back at the zipcar parking spot 13 minutes late.  In the city being within 13 minutes of anything is a victory in my opinion, but not, apparently, in zipcar's.  This led me to 1) be looked at in a suspect manner by the next zipcar user who waited patiently for me to get out and looked even more unnerved by the strange beeping 2) be charged for an extra hour of rental.  That seems a bit too much, and scheduling things down to the second seems  a bit excessive as well.  Point Zipcar?

In the end Zipcar has all the points, some gained by its nice features (e.g. ease of renting with a lost license) and some gained as an adversary against whom you have no recourse.  I get 1 point because I married a wonderful wife that knows how to jump through hoops and help me through them.

In the end the Zipcar was more expensive to rent for 3 hours and 13 minutes than a 1-day Enterprise rental, but for these short durations the differences are only a few bucks (taking free gas into account) and convenience trumps.  This means Zipcar wins the competition, unless I happen to be the zipper dropping off the car right before you, in which case you will have some moments of nervousness wondering when you will see the car :-)

Monday, March 26, 2012

For the kids

I went to a Hawaiian themed benefit for the students at my son David's elementary school on Friday.  It was the first social evening event I'd really gone to after having moved here and I must say it was exactly as I had hoped.  I met many friendly people, with every Dad working at a tech company with an easily recognizable name (Cisco (that guy was trying to think of ways to keep the startup mentality alive in a big company, heh), AOL (that guy was a bit depressed, heh), etc. etc.), and everyone was talkative and actually requiring brain cells to communicate with because we had shared knowledge and so could dive below "how's the weather" very rapidly.  It was shocking.  I was completely unprepared and might have drank a bit slower if I had known the conversation would be so good (well, maybe that is getting carried away ;-)

<blows whistle>... Point Palo Alto!

Friday, February 3, 2012

I want to want a Mac

I have heard great things about Mac, and my IBM laptop is beginning to show its age (overheating when running simulated circuits) so I'm soon to be in the market.  I have heard that it is easy to upgrade operating systems on Mac (it's an app in the app store and supposedly "just works").  I have also heard that Mac's new OS has the ability to suspend applications, which is a feature I love and one of the reasons I use VMWare so much (I never want to lose my Undo queue - an Undo Tree would be even better).

I logged onto their website and went to the part I already know I want: Macbook Pro 15.4".  I have had multiple 15.4" computers and they have always been a great compromise between desktop-replacement-sized screen and weight (can get down to 6 pounds).  I just really like the 15.4" form factor - it's a no frills (not 17", not 13", not 11") - it's for people who want to get stuff done and don't want to lug a behemoth (as my old 3.8Ghz Pentium 4 12-pound 17" alienware would attest).

I was shocked to find that my only  options are a quad-core processor with a speed of 2.5Ghz.  My unkeen tongue responds "Hello, 2010 decade, come in 2010 decade, I can't hear you, over."  I would opt for a dual-core high-speed laptop as my SystemC simulator and my Xilinx Synthesizer are single-threaded (Oh woe is me!).  This is a real bummer, and sort of a deal breaker, because my current processor is 2.8Ghz... now, yes it is a dual core Core 2, and the Mac is apparently a quad-core Sandy Bridge with 3.6 Ghz Turbo boost, but there's no gaurantee you will typically get 3.6 Ghz as browsers often hog cpu (usually due to poorly programmed web pages) , thereby requiring throttling of the turbo boost.  To reiterate, woe is me!

Oh Mac, why do the gold walls in your glorious garden have to be so tall?  And why are we categorizing these products by hard drive size? - they are not Ipods!  They are laptops with real processors!

Shhhhh!  We must not wake the Fuhrer.  ;-/

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