Sunday, December 13, 2009

How to Convince Xilinx Not to Optimize Away Your Wires!

As I was writing my last post, I remembered how much trouble my lab partner and I had with Xilinx WebPack 9.2 optimizing away our clock wire during synthesis, along with everything that was attached to (read: everything important). After several hours of fruitless Google searching, I finally came across a tiny blurb in a Xilinx PDF saying that putting

/* syn_keep = 1 */

next to a wire will force it to survive optimization!

I'm not sure about the specifics, but I do know is that it saved our project at the last minute, and it very may well save yours too!

Keep in mind, however, that more than likely there's a reason that Xilinx wants to kill your wires. You probably have other problems somewhere in your code (did you check for latches?). Also, keep in mind that this comment must be put next to each wire that you want to survive, not just at the end of a long declaration with many wires.

Happy coding!

Building a MIPS processor

To anyone who wishes to build a simple single-cycle MIPS processor, here's a diagram of how to do so!


Please excuse the not-so-straight lines, this was a crappy scan of a 22"x25.5" hand drawn diagram. It was made for a processor design class that I just finished up, and can execute the following instructions:
  • add
  • addi
  • sub
  • mul
  • lw
  • sw
  • sb
  • lh
  • lb
  • sh
  • lui
  • and
  • or
  • nor
  • xor
  • andi
  • ori
  • xori
  • sll
  • srl
  • slt
  • slti
  • movn
  • bgez
  • beq
  • bne
  • bgtz
  • blez
  • bltz
  • j
  • jr
  • jal
I don't know if anyone will ever have a use for this, but here it is, for all the world to enjoy! So.... Enjoy! :)

Sunday, August 16, 2009

This is why I should fully read the tutorials...

For the last few weeks I've been trying to create a GWT based game (which I will go into more detail about later), that included a HTML 5 Canvas element. I had been programming in Eclipse with the GWT plugin, and thankfully that included support for Eclipse's excellent debugging features. The GWT plugin even has a mini browser built in (seemingly based on Chrome) that makes quick testing a breeze.

Well, I wanted to include a fancy Canvas timer widget in my project. Unfortunately, GWT doesn't have a Canvas element widget built in (yet), so I used this. I programmed up my fancy timer and added some preliminary eye candy effects, and tested everything in the GWT browser. Everything worked. Life was good.

Then, I decided I would try and upload my project to AppEngine, Google's web app hosting service. Waited for a few minutes for the project to compile, checked the link it gave me, and was shocked to see that the timer widget I worked so hard on was not working at all in Firefox! CPU usage spiked after a second or two, and things went downhill from there...

Long story short, after a good 5 hours of searching, recoding, recompiling, and alcohol, I finally found my problem: I didn't tell the Canvas context that I was starting a new path. One simple ctx.beginPath(); and I was good to go.

Why did I post this? Because nothing in my Google searches brought up that this could happen, and if it did, I would have been done in a good 5 minutes! So, dear Google searcher from the future, if you are having an issue where your Canvas animation works in the GWT browser, and in Chrome, but ramps up the CPU to the point of freezing anywhere else, you're missing a beginPath() call.

Oh how I wish Google indexed the future....

Friday, May 22, 2009

All set up!

Well, that wasn't too hard! I got Blogger all set up, and now all that's left is to put stuff in it... I have a feeling that's going to be a bit more difficult