failing like never before


Classess, and Stuff

Its been a distressingly long time since I last blogged, but thats OK because I'm the only one that cares. My numerous lamentations now aired out, we move onto the good stuff (or bad stuff, depending on your point of view...)

So this last quarter, I found my digital design course consuming an inordinate amount of time, and with each passing week the amount of time I spent in lab per day increased at a logarithmic rate (logarthmic, because there are only so many hours a person can spend in lab before there simply ceases to be hours in the day). The premise of the class was quite simple: spend the first few weeks going through cookie-cutter labs whilst learning the ins-and-outs of the tools and VHDL, and then spend the rest of the quarter builidng your own personal project on a FPGA. My group of three proposed to create a system where a user could drive an iRobot Create by mimicking driving motions in front of a camera, an idea perhaps less ambitious then other groups in the class but nonetheless quite daunting. Unlike Microsoft's super-amazing-funtastic-galactic-awesome Kinect, our system made no use of fancy infrared projectors. Instead, we simply required the user to wear blue gloves or grip a stick tipped in blue, and place their foot over a piece of green cloth. Take a look at our demo:

You'll notice also, that on the disply we drew solid bounding boxes over the blue and green objects in the frame.

This was done almost entirely on the FPGA and was written in VHDL, with only  communication over serial port handled by the PPC405 CPU. So yeah, it took a really long time.


Seven-Segment Display in VHDL

I wrote my first VHDL project last night during lab, andgot to see my design come to life when I programmed it into a Spartan3 FPGA. It was a pretty basic program, that changed a seven-segment display (like those old LED screens on old calculators) based on which switches were flipped. The four switches used were a BCD (Binary Encoded Decimal) value, so if the first and fourth switches were on and the second and third switches were off, then the BCD value would be 9 (1001). The seven-segment display would then display the value "9" if the switches were in position 1001. Fairly simple to design and program, but quite fun to play with. My VHDL code is below.

entity seven_segment is

    x3,x2,x1,x0: in std_logic;
    a,b,c,d,e,i,g: out std_logic

end seven_segment;

architecture Behavioral of seven_segment is

    a <= NOT( x1 OR x3 OR (x2 AND x0) OR (NOT(x2) AND NOT(x0)) );
    b <= NOT( NOT(x2) OR x3 OR (x1 AND x0) OR (NOT(x1) AND NOT(x0)) );
    c <= NOT( x3 OR x2 OR x0 OR (NOT(x0) AND NOT(x1)) );
    d <= NOT( x3 OR (NOT(x0) AND NOT(x2)) OR (x1 AND NOT(x0)) OR
        (x1 AND NOT(x2)) OR (x2 AND x0 AND NOT(x1)) );
    e <= NOT( (x1 AND NOT(x0)) OR (NOT(x2) AND NOT(x0)) );
    i <= NOT( x3 OR (NOT(X0) AND NOT(x1)) OR (x2 AND NOT(X0) AND x1) OR
        (x2 AND NOT(x1)) );
    g <= NOT( x3 OR (NOT(x1) AND x2) OR (x1 AND NOT(x0)) OR
        (x1 and NOT(x2)) );

end Behavioral;